Run 'npm run build'

This commit is contained in:
mannie.exe 2022-05-06 09:31:23 -07:00 committed by Manpreet Singh
parent 7d279e1d70
commit 57edf6c8ba
2 changed files with 33 additions and 21 deletions

20
dist/setup/index.js vendored
View file

@ -71768,15 +71768,25 @@ function translateArchToDistUrl(arch) {
} }
} }
function parseNodeVersionFile(contents) { function parseNodeVersionFile(contents) {
var _a; var _a, _b;
let nodeVersion;
const found = contents.match(/^(?:nodejs\s+)?v?(?<version>[^\s]+)$/m); const found = contents.match(/^(?:nodejs\s+)?v?(?<version>[^\s]+)$/m);
const nodeVersion = (_a = found === null || found === void 0 ? void 0 : found.groups) === null || _a === void 0 ? void 0 : _a.version; nodeVersion = (_a = found === null || found === void 0 ? void 0 : found.groups) === null || _a === void 0 ? void 0 : _a.version;
if (nodeVersion) { if (!nodeVersion) {
return nodeVersion; try {
// Try parsing the file as an NPM `package.json`
// file.
nodeVersion = (_b = JSON.parse(contents).engines) === null || _b === void 0 ? void 0 : _b.node;
if (!nodeVersion)
throw new Error();
} }
catch (err) {
// In the case of an unknown format, // In the case of an unknown format,
// return as is and evaluate the version separately. // return as is and evaluate the version separately.
return contents.trim(); nodeVersion = contents.trim();
}
}
return nodeVersion;
} }
exports.parseNodeVersionFile = parseNodeVersionFile; exports.parseNodeVersionFile = parseNodeVersionFile;
function isLatestSyntax(versionSpec) { function isLatestSyntax(versionSpec) {

View file

@ -495,24 +495,26 @@ function translateArchToDistUrl(arch: string): string {
} }
export function parseNodeVersionFile(contents: string): string { export function parseNodeVersionFile(contents: string): string {
let nodeVersion: string | undefined;
const found = contents.match(/^(?:nodejs\s+)?v?(?<version>[^\s]+)$/m);
nodeVersion = found?.groups?.version;
if (!nodeVersion) {
try {
// Try parsing the file as an NPM `package.json`
// file.
nodeVersion = JSON.parse(contents).engines?.node;
if (!nodeVersion) throw new Error();
} catch (err) {
// In the case of an unknown format, // In the case of an unknown format,
// return as is and evaluate the version separately. // return as is and evaluate the version separately.
let nodeVersion = contents.trim(); nodeVersion = contents.trim();
}
try {
// Assume all content parseable as JSON is a valid,
// NPM `package.json` file
const packageJson = JSON.parse(contents);
nodeVersion = packageJson.engines.node || nodeVersion;
if (!nodeVersion) throw
} catch (err) {
// If not, assume it is a node version file
const found = nodeVersion.match(/^(?:nodejs\s+)?v?(?<version>[^\s]+)$/m);
nodeVersion = found?.groups?.version || nodeVersion;
} }
return nodeVersion; return nodeVersion as string;
} }
function isLatestSyntax(versionSpec): boolean { function isLatestSyntax(versionSpec): boolean {