mirror of
https://github.com/pnpm/pnpm.git
synced 2025-12-23 23:29:17 -05:00
fix: lockfile up-to-date check when it has dependenciesMeta field (#4152)
close #4098
This commit is contained in:
5
.changeset/cold-humans-end.md
Normal file
5
.changeset/cold-humans-end.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"pnpm": patch
|
||||
---
|
||||
|
||||
Install with `--frozen-lockfile` should not fail when the project has injected dependencies and a dedicated lockfile [#4098](https://github.com/pnpm/pnpm/issues/4098).
|
||||
5
.changeset/polite-readers-heal.md
Normal file
5
.changeset/polite-readers-heal.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@pnpm/lockfile-file": patch
|
||||
---
|
||||
|
||||
In a dedicated lockfile the `dependenciesMeta` field should be nested to `'.'` during normalization.
|
||||
5
.changeset/spotty-cows-destroy.md
Normal file
5
.changeset/spotty-cows-destroy.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@pnpm/lockfile-file": patch
|
||||
---
|
||||
|
||||
The `dependenciesMeta` field should be sorted after the dependencies fields.
|
||||
@@ -97,6 +97,7 @@ async function _read (
|
||||
lockfile.importers = {
|
||||
'.': {
|
||||
specifiers: lockfile['specifiers'],
|
||||
dependenciesMeta: lockfile['dependenciesMeta'],
|
||||
},
|
||||
}
|
||||
delete lockfile.specifiers
|
||||
|
||||
@@ -38,8 +38,9 @@ const ROOT_KEYS_ORDER = {
|
||||
dependencies: 11,
|
||||
optionalDependencies: 12,
|
||||
devDependencies: 13,
|
||||
importers: 14,
|
||||
packages: 15,
|
||||
dependenciesMeta: 14,
|
||||
importers: 15,
|
||||
packages: 16,
|
||||
}
|
||||
|
||||
function compareWithPriority (priority: Record<string, number>, left: string, right: string) {
|
||||
|
||||
5
packages/lockfile-file/test/fixtures/2/node_modules/.pnpm/lock.yaml
generated
vendored
5
packages/lockfile-file/test/fixtures/2/node_modules/.pnpm/lock.yaml
generated
vendored
@@ -1 +1,6 @@
|
||||
lockfileVersion: 3
|
||||
specifiers:
|
||||
foo: '1'
|
||||
dependenciesMeta:
|
||||
foo:
|
||||
injected: true
|
||||
|
||||
5
packages/lockfile-file/test/fixtures/2/pnpm-lock.yaml
generated
vendored
5
packages/lockfile-file/test/fixtures/2/pnpm-lock.yaml
generated
vendored
@@ -1 +1,6 @@
|
||||
lockfileVersion: 3
|
||||
specifiers:
|
||||
foo: '1'
|
||||
dependenciesMeta:
|
||||
foo:
|
||||
injected: true
|
||||
|
||||
@@ -15,7 +15,17 @@ test('readWantedLockfile()', async () => {
|
||||
const lockfile = await readWantedLockfile(path.join('fixtures', '2'), {
|
||||
ignoreIncompatible: false,
|
||||
})
|
||||
expect(lockfile!.lockfileVersion).toEqual(3)
|
||||
expect(lockfile?.lockfileVersion).toEqual(3)
|
||||
expect(lockfile?.importers).toStrictEqual({
|
||||
'.': {
|
||||
specifiers: {
|
||||
foo: '1',
|
||||
},
|
||||
dependenciesMeta: {
|
||||
foo: { injected: true },
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user