Skip to content

Commit ca2d4e0

Browse files
authored
feat: handling the case where "node" is used for tool-versions file. (#812)
1 parent c7a93de commit ca2d4e0

File tree

5 files changed

+6
-4
lines changed

5 files changed

+6
-4
lines changed

Diff for: .github/workflows/versions.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,8 @@ jobs:
158158
fail-fast: false
159159
matrix:
160160
os: [ubuntu-latest, windows-latest, macos-latest]
161-
node-version-file: [.nvmrc, .tool-versions, package.json]
161+
node-version-file:
162+
[.nvmrc, .tool-versions, .tool-versions-node, package.json]
162163
steps:
163164
- uses: actions/checkout@v3
164165
- name: Remove volta from package.json

Diff for: __tests__/data/.tool-versions-node

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node 14.0.0

Diff for: dist/cache-save/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -60754,7 +60754,7 @@ function parseNodeVersionFile(contents) {
6075460754
core.info('Node version file is not JSON file');
6075560755
}
6075660756
if (!nodeVersion) {
60757-
const found = contents.match(/^(?:nodejs\s+)?v?(?<version>[^\s]+)$/m);
60757+
const found = contents.match(/^(?:node(js)?\s+)?v?(?<version>[^\s]+)$/m);
6075860758
nodeVersion = (_c = found === null || found === void 0 ? void 0 : found.groups) === null || _c === void 0 ? void 0 : _c.version;
6075960759
}
6076060760
// In the case of an unknown format,

Diff for: dist/setup/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -72336,7 +72336,7 @@ function parseNodeVersionFile(contents) {
7233672336
core.info('Node version file is not JSON file');
7233772337
}
7233872338
if (!nodeVersion) {
72339-
const found = contents.match(/^(?:nodejs\s+)?v?(?<version>[^\s]+)$/m);
72339+
const found = contents.match(/^(?:node(js)?\s+)?v?(?<version>[^\s]+)$/m);
7234072340
nodeVersion = (_c = found === null || found === void 0 ? void 0 : found.groups) === null || _c === void 0 ? void 0 : _c.version;
7234172341
}
7234272342
// In the case of an unknown format,

Diff for: src/util.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export function parseNodeVersionFile(contents: string): string {
1313
}
1414

1515
if (!nodeVersion) {
16-
const found = contents.match(/^(?:nodejs\s+)?v?(?<version>[^\s]+)$/m);
16+
const found = contents.match(/^(?:node(js)?\s+)?v?(?<version>[^\s]+)$/m);
1717
nodeVersion = found?.groups?.version;
1818
}
1919

0 commit comments

Comments
 (0)