mirror of
https://code.forgejo.org/actions/setup-node.git
synced 2024-12-26 04:25:48 +00:00
refactor: check volta first, then engine
This commit is contained in:
parent
9f20343a3a
commit
5b579f1638
1 changed files with 3 additions and 4 deletions
|
@ -502,10 +502,9 @@ export function parseNodeVersionFile(contents: string): string {
|
||||||
|
|
||||||
if (!nodeVersion) {
|
if (!nodeVersion) {
|
||||||
try {
|
try {
|
||||||
// Try parsing the file as an NPM `package.json`
|
// Try parsing the file as an NPM `package.json` file.
|
||||||
// file.
|
nodeVersion = JSON.parse(contents).volta?.node;
|
||||||
nodeVersion = JSON.parse(contents).engines?.node;
|
if (!nodeVersion)nodeVersion = JSON.parse(contents).engines?.node;
|
||||||
if (!nodeVersion) JSON.parse(contents).volta?.node;
|
|
||||||
if (!nodeVersion) throw new Error();
|
if (!nodeVersion) throw new Error();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
// In the case of an unknown format,
|
// In the case of an unknown format,
|
||||||
|
|
Loading…
Reference in a new issue