Skip to content

Commit

Permalink
feat(npm): efficient update-lockfile reuse for lockfileVersion>=2 (#1…
Browse files Browse the repository at this point in the history
  • Loading branch information
rarkins committed Feb 8, 2022
1 parent 31aab15 commit 9b6b59d
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions lib/manager/npm/update/locked-dependency/package-lock/index.ts
Expand Up @@ -39,10 +39,6 @@ export async function updateLockedDependency(
logger.warn({ err }, 'Failed to parse files');
return { status: 'update-failed' };
}
if (packageLockJson.lockfileVersion === 2) {
logger.debug('Only lockfileVersion 1 is supported');
return { status: 'update-failed' };
}
const lockedDeps = getLockedDependencies(
packageLockJson,
depName,
Expand All @@ -67,7 +63,12 @@ export async function updateLockedDependency(
);
status = 'already-updated';
} else {
if (allowHigherOrRemoved) {
if (packageLockJson.lockfileVersion !== 1) {
logger.debug(
`Found lockfileVersion ${packageLockJson.lockfileVersion}`
);
status = 'update-failed';
} else if (allowHigherOrRemoved) {
// it's acceptable if the package is no longer present
const anyVersionLocked = getLockedDependencies(
packageLockJson,
Expand Down

0 comments on commit 9b6b59d

Please sign in to comment.