fix(lockfile): never add an empty patchedDependencies field to pnpm-lock.yaml (#4948)

This commit is contained in:
Zoltan Kochan
2022-06-28 20:45:34 +03:00
committed by GitHub
parent f7d422b744
commit ab684d77eb
3 changed files with 10 additions and 0 deletions

View File

@@ -0,0 +1,6 @@
---
"@pnpm/lockfile-file": patch
"pnpm": patch
---
Never add an empty patchedDependencies field to `pnpm-lock.yaml`.

View File

@@ -123,6 +123,9 @@ export function normalizeLockfile (lockfile: Lockfile, forceSharedFormat: boolea
if ((lockfileToSave.overrides != null) && isEmpty(lockfileToSave.overrides)) {
delete lockfileToSave.overrides
}
if ((lockfileToSave.patchedDependencies != null) && isEmpty(lockfileToSave.patchedDependencies)) {
delete lockfileToSave.patchedDependencies
}
if (lockfileToSave.neverBuiltDependencies != null) {
if (isEmpty(lockfileToSave.neverBuiltDependencies)) {
delete lockfileToSave.neverBuiltDependencies

View File

@@ -8,6 +8,7 @@ test('empty overrides and neverBuiltDependencies are removed during lockfile nor
onlyBuiltDependencies: [],
overrides: {},
neverBuiltDependencies: [],
patchedDependencies: {},
packages: {},
importers: {
foo: {