fix: let deploy inherit overrides (#9546)

* fix: let deploy inherit overrides

Prevents the following error in "pnpm deploy" with "inject-workspace-packages=true":
  ERR_PNPM_LOCKFILE_CONFIG_MISMATCH Cannot proceed with the frozen installation.
  The current "overrides" configuration doesn't match the value found in the lockfile

* chore: add changeset

* docs: update old-symbols-invite.md

close #9283
close #9483
This commit is contained in:
Alexander Tkachev
2025-05-19 12:42:04 +04:00
committed by GitHub
parent 272129193c
commit aad7eebc2d
3 changed files with 7 additions and 3 deletions

View File

@@ -0,0 +1,6 @@
---
"@pnpm/plugin-commands-deploy": patch
"pnpm": patch
---
Let `pnpm deploy` work in repos with `overrides` when `inject-workspace-packages=true` [#9283](https://github.com/pnpm/pnpm/issues/9283).

View File

@@ -119,7 +119,6 @@ export function createDeployFiles ({
const result: DeployFiles = {
lockfile: {
...lockfile,
overrides: undefined, // the effects of package overrides should already be part of the package snapshots
patchedDependencies: undefined,
packageExtensionsChecksum: undefined, // the effects of the package extensions should already be part of the package snapshots
pnpmfileChecksum: undefined, // the effects of the pnpmfile should already be part of the package snapshots
@@ -136,7 +135,6 @@ export function createDeployFiles ({
pnpm: {
...rootProjectManifest?.pnpm,
...pick(USEFUL_NON_ROOT_PNPM_FIELDS, selectedProjectManifest.pnpm ?? {}),
overrides: undefined, // the effects of package overrides should already be part of the package snapshots
patchedDependencies: undefined,
packageExtensions: undefined, // the effects of the package extensions should already be part of the package snapshots
},

View File

@@ -337,9 +337,9 @@ test('the deploy manifest should inherit the pnpm object from the root manifest
const manifest = readPackageJson('deploy') as ProjectManifest
expect(manifest.pnpm).toStrictEqual({
onlyBuiltDependencies: preparedManifests.root.pnpm!.onlyBuiltDependencies,
overrides: preparedManifests.root.pnpm!.overrides,
executionEnv: preparedManifests['project-0'].pnpm!.executionEnv,
} as ProjectManifest['pnpm'])
expect(manifest.pnpm?.overrides).toBeUndefined() // by design
expect(readPackageJson('deploy/node_modules/is-positive/')).toHaveProperty(['version'], preparedManifests.root.pnpm!.overrides!['is-positive'])
expect(project.readLockfile().importers).toStrictEqual({