remove lowPriority
This commit is contained in:
parent
549748baea
commit
c3034ae929
25
lib/index.js
25
lib/index.js
@ -30,36 +30,17 @@ export async function need (opts = {}) { // eslint-disable-line complexity
|
||||
platform = toFancyPlatform(platform); // win32 -> win
|
||||
arch = toFancyArch(arch); // ia32 -> x86
|
||||
|
||||
function satisfyingNodeVersion (includeLowPriority) {
|
||||
function satisfyingNodeVersion () {
|
||||
const versions = Object.keys(patchesJson)
|
||||
.filter((nv) => includeLowPriority ||
|
||||
!patchesJson[nv].lowPriority)
|
||||
.filter((nv) => semver.satisfies(nv, nodeRange) ||
|
||||
nodeRange === 'latest')
|
||||
.sort((nv1, nv2) => semver.gt(nv1, nv2));
|
||||
return versions.pop();
|
||||
}
|
||||
|
||||
let nodeVersion;
|
||||
|
||||
if (nodeRange === 'latest') {
|
||||
nodeVersion = satisfyingNodeVersion(true);
|
||||
} else {
|
||||
nodeVersion = satisfyingNodeVersion(false);
|
||||
if (!nodeVersion) {
|
||||
nodeVersion = satisfyingNodeVersion(true);
|
||||
}
|
||||
}
|
||||
|
||||
const nodeVersion = satisfyingNodeVersion();
|
||||
if (!nodeVersion) {
|
||||
const withStars = Object.keys(patchesJson).map((nv) =>
|
||||
nv.slice(1) + (patchesJson[nv].lowPriority ? '*' : '')
|
||||
).reverse().join(', ');
|
||||
|
||||
throw wasReported(`No supported node version satisfies '${opts.nodeRange}'`, [
|
||||
'Supported node versions are:', withStars,
|
||||
'(*) Precompiled base binaries are available for limited number of',
|
||||
'platforms. Pkg will likely have to compile base binaries from source' ]);
|
||||
throw wasReported(`No available node version satisfies '${opts.nodeRange}'`);
|
||||
}
|
||||
|
||||
const fetched = localPlace({ from: 'fetched', arch, nodeVersion, platform, version });
|
||||
|
||||
Loading…
Reference in New Issue
Block a user