fix: skip sha check when providing PKG_NODE_PATH (#50)

This commit is contained in:
Daniel Lando 2024-09-30 18:20:02 +02:00 committed by GitHub
parent e436d74e4c
commit 76bc9d0bbf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -62,9 +62,7 @@ export function satisfyingNodeVersion(nodeRange: string) {
const nodeVersion = versions.pop();
if (!nodeVersion) {
throw wasReported(
`No available node version satisfies '${nodeRange}'`
);
throw wasReported(`No available node version satisfies '${nodeRange}'`);
}
return nodeVersion;
@ -85,7 +83,6 @@ export function getNodeVersion(nodeRange: string) {
return nodeVersion;
}
export async function need(opts: NeedOptions) {
// eslint-disable-line complexity
const { forceFetch, forceBuild, dryRun, output, nodeRange } = opts || {};
@ -126,7 +123,11 @@ export async function need(opts: NeedOptions) {
return 'exists';
}
if ((await hash(fetched)) === EXPECTED_HASHES[remote.name]) {
// when node path is set, skip hash check
if (
!!process.env.PKG_NODE_PATH ||
(await hash(fetched)) === EXPECTED_HASHES[remote.name]
) {
return fetched;
}