Skip to content

Commit

Permalink
fix(lockfile-utils): checking dependenciesMeta (#4463)
Browse files Browse the repository at this point in the history
  • Loading branch information
zkochan committed Mar 21, 2022
1 parent 97d710c commit 688b0ea
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/nice-geese-press.md
@@ -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.
2 changes: 1 addition & 1 deletion packages/lockfile-utils/src/satisfiesPackageManifest.ts
Expand Up @@ -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] ?? {}
Expand Down
23 changes: 23 additions & 0 deletions packages/lockfile-utils/test/satisfiesPackageManifest.ts
Expand Up @@ -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)
})

0 comments on commit 688b0ea

Please sign in to comment.