mirror of
https://github.com/actions/setup-node.git
synced 2024-11-10 04:18:24 +08:00
Fix test volta priority (#577)
This commit is contained in:
parent
9f3a02bbd1
commit
969bd26639
8
.github/workflows/versions.yml
vendored
8
.github/workflows/versions.yml
vendored
|
@ -95,6 +95,9 @@ jobs:
|
||||||
node-version-file: [.nvmrc, .tool-versions, package.json]
|
node-version-file: [.nvmrc, .tool-versions, package.json]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
- name: Remove volta from package.json
|
||||||
|
shell: bash
|
||||||
|
run: cat <<< "$(jq 'del(.volta)' ./__tests__/data/package.json)" > ./__tests__/data/package.json
|
||||||
- name: Setup node from node version file
|
- name: Setup node from node version file
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
|
@ -110,15 +113,12 @@ jobs:
|
||||||
os: [ ubuntu-latest, windows-latest, macos-latest ]
|
os: [ ubuntu-latest, windows-latest, macos-latest ]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- name: Remove engines from package.json
|
|
||||||
shell: bash
|
|
||||||
run: cat <<< "$(jq 'del(.engines)' ./__tests__/data/package.json)" > ./__tests__/data/package.json
|
|
||||||
- name: Setup node from node version file
|
- name: Setup node from node version file
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
node-version-file: '__tests__/data/package.json'
|
node-version-file: '__tests__/data/package.json'
|
||||||
- name: Verify node
|
- name: Verify node
|
||||||
run: __tests__/verify-node.sh 14
|
run: __tests__/verify-node.sh 16
|
||||||
|
|
||||||
node-dist:
|
node-dist:
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
|
|
|
@ -3,6 +3,6 @@
|
||||||
"node": "^14.0.0"
|
"node": "^14.0.0"
|
||||||
},
|
},
|
||||||
"volta": {
|
"volta": {
|
||||||
"node": "14.0.0"
|
"node": "16.0.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
2
dist/setup/index.js
vendored
2
dist/setup/index.js
vendored
|
@ -73539,7 +73539,7 @@ function parseNodeVersionFile(contents) {
|
||||||
nodeVersion = (_b = JSON.parse(contents).engines) === null || _b === void 0 ? void 0 : _b.node;
|
nodeVersion = (_b = JSON.parse(contents).engines) === null || _b === void 0 ? void 0 : _b.node;
|
||||||
}
|
}
|
||||||
catch (_d) {
|
catch (_d) {
|
||||||
core.warning('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(/^(?:nodejs\s+)?v?(?<version>[^\s]+)$/m);
|
||||||
|
|
|
@ -502,7 +502,7 @@ export function parseNodeVersionFile(contents: string): string {
|
||||||
nodeVersion = JSON.parse(contents).volta?.node;
|
nodeVersion = JSON.parse(contents).volta?.node;
|
||||||
if (!nodeVersion) nodeVersion = JSON.parse(contents).engines?.node;
|
if (!nodeVersion) nodeVersion = JSON.parse(contents).engines?.node;
|
||||||
} catch {
|
} catch {
|
||||||
core.warning('Node version file is not JSON file');
|
core.info('Node version file is not JSON file');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!nodeVersion) {
|
if (!nodeVersion) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user