feat: handling the case where "node" is used for tool-versions file. (#812)

This commit is contained in:
Vytis Valentinavičius 2023-07-18 14:01:34 +03:00 committed by GitHub
parent c7a93deeac
commit ca2d4e0cdd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 6 additions and 4 deletions

View File

@ -158,7 +158,8 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
os: [ubuntu-latest, windows-latest, macos-latest] 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: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Remove volta from package.json - name: Remove volta from package.json

View File

@ -0,0 +1 @@
node 14.0.0

View File

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

2
dist/setup/index.js vendored
View File

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

View File

@ -13,7 +13,7 @@ export function parseNodeVersionFile(contents: string): string {
} }
if (!nodeVersion) { if (!nodeVersion) {
const found = contents.match(/^(?:nodejs\s+)?v?(?<version>[^\s]+)$/m); const found = contents.match(/^(?:node(js)?\s+)?v?(?<version>[^\s]+)$/m);
nodeVersion = found?.groups?.version; nodeVersion = found?.groups?.version;
} }