Adding Node.js version file support (#338)

This commit is contained in:
Hargun Kaur authored and GitHub committed 2021-11-29 12:18:31 +03:00
1 parent 360ab8b75b
commit d08cf22211
9 files changed
+221 -23

No files matched your search

+10 -1
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;
}