diff --git a/.github/workflows/versions.yml b/.github/workflows/versions.yml index 082550c..2d72d40 100644 --- a/.github/workflows/versions.yml +++ b/.github/workflows/versions.yml @@ -158,7 +158,8 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, windows-latest, macos-latest] - node-version-file: [.nvmrc, .tool-versions, package.json] + node-version-file: + [.nvmrc, .tool-versions, .tool-versions-node, package.json] steps: - uses: actions/checkout@v3 - name: Remove volta from package.json diff --git a/__tests__/data/.tool-versions-node b/__tests__/data/.tool-versions-node new file mode 100644 index 0000000..8e8ac41 --- /dev/null +++ b/__tests__/data/.tool-versions-node @@ -0,0 +1 @@ +node 14.0.0 diff --git a/dist/cache-save/index.js b/dist/cache-save/index.js index 1b205cd..cfef463 100644 --- a/dist/cache-save/index.js +++ b/dist/cache-save/index.js @@ -60754,7 +60754,7 @@ function parseNodeVersionFile(contents) { core.info('Node version file is not JSON file'); } if (!nodeVersion) { - const found = contents.match(/^(?:nodejs\s+)?v?(?[^\s]+)$/m); + const found = contents.match(/^(?:node(js)?\s+)?v?(?[^\s]+)$/m); nodeVersion = (_c = found === null || found === void 0 ? void 0 : found.groups) === null || _c === void 0 ? void 0 : _c.version; } // In the case of an unknown format, diff --git a/dist/setup/index.js b/dist/setup/index.js index 5d2b235..0077497 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -72336,7 +72336,7 @@ function parseNodeVersionFile(contents) { core.info('Node version file is not JSON file'); } if (!nodeVersion) { - const found = contents.match(/^(?:nodejs\s+)?v?(?[^\s]+)$/m); + const found = contents.match(/^(?:node(js)?\s+)?v?(?[^\s]+)$/m); nodeVersion = (_c = found === null || found === void 0 ? void 0 : found.groups) === null || _c === void 0 ? void 0 : _c.version; } // In the case of an unknown format, diff --git a/src/util.ts b/src/util.ts index 39e4824..3ae94a2 100644 --- a/src/util.ts +++ b/src/util.ts @@ -13,7 +13,7 @@ export function parseNodeVersionFile(contents: string): string { } if (!nodeVersion) { - const found = contents.match(/^(?:nodejs\s+)?v?(?[^\s]+)$/m); + const found = contents.match(/^(?:node(js)?\s+)?v?(?[^\s]+)$/m); nodeVersion = found?.groups?.version; }