Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(lockfile-utils): checking dependenciesMeta #4463

Merged
merged 1 commit into from Mar 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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)
})