Adding Node.js version file support (#338)

This commit is contained in:
Hargun Kaur
2021-11-29 14:48:31 +05:30
committed by GitHub
parent 360ab8b75b
commit d08cf22211
9 changed files with 221 additions and 23 deletions

View File

@@ -371,7 +371,7 @@ async function queryDistForMatch(
}
let versions: string[] = [];
let nodeVersions = await module.exports.getVersionsFromDist();
let nodeVersions = await getVersionsFromDist();
nodeVersions.forEach((nodeVersion: INodeVersion) => {
// ensure this version supports your os and platform
@@ -464,3 +464,12 @@ function translateArchToDistUrl(arch: string): string {
return arch;
}
}
export function parseNodeVersionFile(contents: string): string {
let nodeVersion = contents.trim();
if (/^v\d/.test(nodeVersion)) {
nodeVersion = nodeVersion.substring(1);
}
return nodeVersion;
}