fix(deploy): overrides contain peer dependencies (#9604)

close #9595
This commit is contained in:
Khải
2025-06-10 05:45:55 +07:00
committed by GitHub
parent 4366170d6b
commit 983efdc7f1
5 changed files with 12 additions and 2 deletions

View File

@@ -0,0 +1,7 @@
---
"@pnpm/plugin-commands-installation": minor
"@pnpm/plugin-commands-deploy": patch
"pnpm": patch
---
Fix a bug in which `pnpm deploy` fails due to overridden dependencies having peer dependencies causing `ERR_PNPM_OUTDATED_LOCKFILE` [#9595](https://github.com/pnpm/pnpm/issues/9595).

View File

@@ -317,6 +317,7 @@ export type InstallCommandOptions = Pick<Config,
| 'ignoreWorkspaceCycles'
| 'disallowWorkspaceCycles'
| 'updateConfig'
| 'overrides'
> & CreateStoreControllerOptions & {
argv: {
original: string[]

View File

@@ -120,6 +120,7 @@ export function createDeployFiles ({
lockfile: {
...lockfile,
patchedDependencies: undefined,
overrides: undefined, // the effects of the overrides should already be part of the package snapshots
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
importers: {
@@ -135,6 +136,7 @@ export function createDeployFiles ({
pnpm: {
...rootProjectManifest?.pnpm,
...pick(USEFUL_NON_ROOT_PNPM_FIELDS, selectedProjectManifest.pnpm ?? {}),
overrides: undefined, // the effects of the 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

@@ -261,6 +261,7 @@ async function deployFromSharedLockfile (
modulesDir: undefined,
confirmModulesPurge: false,
frozenLockfile: true,
overrides: undefined, // the effects of the overrides should already be part of the package snapshots
hooks: {
...opts.hooks,
readPackage: [

View File

@@ -257,7 +257,7 @@ test('deploy with a shared lockfile after full install', async () => {
}
})
test('the deploy manifest should inherit the pnpm object from the root manifest and the manifest of the selected project', async () => {
test('the deploy manifest should inherit some fields from the pnpm object from the root manifest and the manifest of the selected project', async () => {
const preparedManifests: Record<'root' | 'project-0', ProjectManifest> = {
root: {
name: 'root',
@@ -337,7 +337,6 @@ 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'])