fix: don't ignore pnpm.patchedDependencies from package.json (#9228)

close #9226
This commit is contained in:
Zoltan Kochan
2025-03-07 00:56:11 +01:00
committed by GitHub
parent 8371664f6f
commit c3aa4d8dd6
3 changed files with 19 additions and 0 deletions

View File

@@ -0,0 +1,6 @@
---
"@pnpm/config": patch
"pnpm": patch
---
Don't ignore pnpm.patchedDependencies from `package.json` [#9226](https://github.com/pnpm/pnpm/issues/9226).

View File

@@ -39,6 +39,7 @@ export function getOptionsFromRootManifest (manifestDir: string, manifest: Proje
'onlyBuiltDependenciesFile',
'overrides',
'packageExtensions',
'patchedDependencies',
'peerDependencyRules',
'supportedArchitectures',
], manifest.pnpm ?? {}),

View File

@@ -1,3 +1,4 @@
import path from 'path'
import { getOptionsFromRootManifest } from '../lib/getOptionsFromRootManifest'
test('getOptionsFromRootManifest() should read "resolutions" field for compatibility with Yarn', () => {
@@ -91,3 +92,14 @@ test('getOptionsFromRootManifest() should return the list from onlyBuiltDependen
})
expect(options.onlyBuiltDependencies).toStrictEqual(['electron'])
})
test('getOptionsFromRootManifest() should return patchedDependencies', () => {
const options = getOptionsFromRootManifest(process.cwd(), {
pnpm: {
patchedDependencies: {
foo: 'foo.patch',
},
},
})
expect(options.patchedDependencies).toStrictEqual({ foo: path.resolve('foo.patch') })
})