refactor: check volta first, then engine

This commit is contained in:
Jef LeCompte 2022-07-27 14:31:06 -07:00
父節點 9f20343a3a
當前提交 5b579f1638
沒有發現已知的金鑰在資料庫的簽署中
GPG 金鑰 ID: 7F5BA322B5DC170C
共有 1 個檔案被更改,包括 3 行新增4 行删除

查看文件

@ -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,