Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add volta as node-version-file #532

Merged
merged 21 commits into from
Sep 12, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
refactor: check volta first, then engine
  • Loading branch information
jef committed Jul 27, 2022
commit 5b579f16381b804435968b7cb2131868c08c0350
7 changes: 3 additions & 4 deletions src/installer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down