Skip to content

Commit a56c80e

Browse files
committed
fix(deps-graph): keep the existing lockfileVersion on graph merge
Copilot review: convertGraphToLockfile hardcodes lockfileVersion '9.0', so preferring graph.lockfileVersion in the merge helper could silently downgrade workspaces whose pnpm writes a newer schema and trigger a full rewrite on the next install — the opposite of the goal here. Flip the fallback so existing wins whenever present; graph's value is only used when starting from no lockfile at all.
1 parent 3081743 commit a56c80e

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

scopes/dependencies/pnpm/pnpm.package-manager.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,11 @@ function mergeGraphLockfileIntoExisting(existing: LockfileFile, graph: LockfileF
546546
).sort();
547547
const merged = {
548548
...existing,
549-
lockfileVersion: graph.lockfileVersion ?? existing.lockfileVersion,
549+
// Keep the existing lockfile's schema version. convertGraphToLockfile hardcodes
550+
// lockfileVersion: '9.0', so preferring graph.lockfileVersion would silently
551+
// downgrade workspaces whose pnpm already writes a newer schema and trigger a
552+
// full rewrite on the next install.
553+
lockfileVersion: existing.lockfileVersion ?? graph.lockfileVersion,
550554
importers,
551555
packages: mergeEntryRecords(existing.packages, graph.packages),
552556
snapshots: mergeEntryRecords(existing.snapshots, graph.snapshots),

0 commit comments

Comments
 (0)