fix(lockfile-utils): checking dependenciesMeta (#4463)

This commit is contained in:
Zoltan Kochan
2022-03-21 21:56:29 +02:00
committed by GitHub
parent 97d710c136
commit 688b0eaff9
3 changed files with 29 additions and 1 deletions

View File

@@ -0,0 +1,5 @@
---
"@pnpm/lockfile-utils": patch
---
When checking if the lockfile is up-to-date, an empty dependenciesMeta field in the manifest should be satisfied by a not set field in the lockfile.

View File

@@ -11,7 +11,7 @@ export default (lockfile: Lockfile, pkg: ProjectManifest, importerId: string) =>
if (!equals({ ...pkg.devDependencies, ...pkg.dependencies, ...pkg.optionalDependencies }, importer.specifiers)) {
return false
}
if (!equals(pkg.dependenciesMeta, importer.dependenciesMeta)) return false
if (!equals(pkg.dependenciesMeta ?? {}, importer.dependenciesMeta ?? {})) return false
for (const depField of DEPENDENCIES_FIELDS) {
const importerDeps = importer[depField] ?? {}
const pkgDeps = pkg[depField] ?? {}

View File

@@ -236,4 +236,27 @@ test('satisfiesPackageManifest()', () => {
foo: '1.0.0',
},
}, '.')).toBe(true)
expect(satisfiesPackageManifest({
...DEFAULT_LOCKFILE_FIELDS,
importers: {
'.': {
dependencies: {
foo: '1.0.0',
},
specifiers: {
foo: '1.0.0',
},
},
},
}, {
...DEFAULT_PKG_FIELDS,
dependencies: {
foo: '1.0.0',
},
devDependencies: {
foo: '1.0.0',
},
dependenciesMeta: {},
}, '.')).toBe(true)
})