From aad7eebc2de67f2ddf045802261b471eea114831 Mon Sep 17 00:00:00 2001 From: Alexander Tkachev Date: Mon, 19 May 2025 12:42:04 +0400 Subject: [PATCH] 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 --- .changeset/old-symbols-invite.md | 6 ++++++ releasing/plugin-commands-deploy/src/createDeployFiles.ts | 2 -- .../plugin-commands-deploy/test/shared-lockfile.test.ts | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) create mode 100644 .changeset/old-symbols-invite.md diff --git a/.changeset/old-symbols-invite.md b/.changeset/old-symbols-invite.md new file mode 100644 index 0000000000..307ecf76a6 --- /dev/null +++ b/.changeset/old-symbols-invite.md @@ -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). diff --git a/releasing/plugin-commands-deploy/src/createDeployFiles.ts b/releasing/plugin-commands-deploy/src/createDeployFiles.ts index cad587e5cb..0739847222 100644 --- a/releasing/plugin-commands-deploy/src/createDeployFiles.ts +++ b/releasing/plugin-commands-deploy/src/createDeployFiles.ts @@ -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 }, diff --git a/releasing/plugin-commands-deploy/test/shared-lockfile.test.ts b/releasing/plugin-commands-deploy/test/shared-lockfile.test.ts index 16d7962e8b..544509ef9a 100644 --- a/releasing/plugin-commands-deploy/test/shared-lockfile.test.ts +++ b/releasing/plugin-commands-deploy/test/shared-lockfile.test.ts @@ -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({