1
0
Fork 0
mirror of https://github.com/actions/setup-node.git synced 2024-09-19 16:06:43 +00:00

refactor: check volta first, then engine

This commit is contained in:
Jef LeCompte 2022-07-27 14:31:06 -07:00
parent 9f20343a3a
commit 5b579f1638
WARNING! Although there is a key with this ID in the database it does not verify this commit! This commit is SUSPICIOUS.
GPG key ID: 7F5BA322B5DC170C

View file

@ -502,10 +502,9 @@ export function parseNodeVersionFile(contents: string): string {
if (!nodeVersion) {
try {
// Try parsing the file as an NPM `package.json`
// file.
nodeVersion = JSON.parse(contents).engines?.node;
if (!nodeVersion) JSON.parse(contents).volta?.node;
// Try parsing the file as an NPM `package.json` file.
nodeVersion = JSON.parse(contents).volta?.node;
if (!nodeVersion)nodeVersion = JSON.parse(contents).engines?.node;
if (!nodeVersion) throw new Error();
} catch (err) {
// In the case of an unknown format,