mirror of
https://github.com/pnpm/pnpm.git
synced 2025-12-23 23:29:17 -05:00
7
.changeset/tidy-seas-dance.md
Normal file
7
.changeset/tidy-seas-dance.md
Normal file
@@ -0,0 +1,7 @@
|
||||
---
|
||||
"@pnpm/config": minor
|
||||
"@pnpm/core": minor
|
||||
"pnpm": minor
|
||||
---
|
||||
|
||||
When `ignore-compatibility-db` is set to `true`, the [compatibility database](https://github.com/yarnpkg/berry/blob/master/packages/yarnpkg-extensions/sources/index.ts) will not be used to patch dependencies [#5132](https://github.com/pnpm/pnpm/issues/5132).
|
||||
@@ -28,6 +28,7 @@ export interface Config {
|
||||
dir: string
|
||||
bin: string
|
||||
ignoreScripts?: boolean
|
||||
ignoreCompatibilityDb?: boolean
|
||||
includeWorkspaceRoot?: boolean
|
||||
save?: boolean
|
||||
saveProd?: boolean
|
||||
|
||||
@@ -60,6 +60,7 @@ export const types = Object.assign({
|
||||
'git-branch-lockfile': Boolean,
|
||||
hoist: Boolean,
|
||||
'hoist-pattern': Array,
|
||||
'ignore-compatibility-db': Boolean,
|
||||
'ignore-pnpmfile': Boolean,
|
||||
'ignore-workspace': Boolean,
|
||||
'ignore-workspace-root-check': Boolean,
|
||||
|
||||
@@ -8,6 +8,7 @@ import { DEFAULT_REGISTRIES } from '@pnpm/normalize-registries'
|
||||
|
||||
export type ListMissingPeersOptions = Partial<GetContextOptions>
|
||||
& Pick<InstallOptions, 'hooks'
|
||||
| 'ignoreCompatibilityDb'
|
||||
| 'linkWorkspacePackagesDepth'
|
||||
| 'nodeVersion'
|
||||
| 'nodeLinker'
|
||||
@@ -57,6 +58,7 @@ export async function getPeerDependencyIssues (
|
||||
forceFullResolution: true,
|
||||
hooks: {
|
||||
readPackage: createReadPackageHook({
|
||||
ignoreCompatibilityDb: opts.ignoreCompatibilityDb,
|
||||
lockfileDir,
|
||||
overrides: opts.overrides,
|
||||
packageExtensions: opts.packageExtensions,
|
||||
|
||||
@@ -32,6 +32,7 @@ export interface StrictInstallOptions {
|
||||
linkWorkspacePackagesDepth: number
|
||||
lockfileOnly: boolean
|
||||
fixLockfile: boolean
|
||||
ignoreCompatibilityDb: boolean
|
||||
ignorePackageManifest: boolean
|
||||
preferFrozenLockfile: boolean
|
||||
saveWorkspaceProtocol: boolean | 'rolling'
|
||||
@@ -147,6 +148,7 @@ const defaults = async (opts: InstallOptions) => {
|
||||
nodeLinker: 'isolated',
|
||||
overrides: {},
|
||||
ownLifecycleHooksStdio: 'inherit',
|
||||
ignoreCompatibilityDb: false,
|
||||
ignorePackageManifest: false,
|
||||
packageExtensions: {},
|
||||
packageManager,
|
||||
|
||||
@@ -177,6 +177,7 @@ export async function mutateModules (
|
||||
// so reading its manifest explicitly here.
|
||||
await safeReadProjectManifestOnly(opts.lockfileDir)
|
||||
opts.hooks.readPackage = createReadPackageHook({
|
||||
ignoreCompatibilityDb: opts.ignoreCompatibilityDb,
|
||||
readPackageHook: opts.hooks.readPackage,
|
||||
overrides: opts.overrides,
|
||||
lockfileDir: opts.lockfileDir,
|
||||
@@ -546,12 +547,14 @@ export function createObjectChecksum (obj: Object) {
|
||||
|
||||
export function createReadPackageHook (
|
||||
{
|
||||
ignoreCompatibilityDb,
|
||||
lockfileDir,
|
||||
overrides,
|
||||
packageExtensions,
|
||||
peerDependencyRules,
|
||||
readPackageHook,
|
||||
}: {
|
||||
ignoreCompatibilityDb?: boolean
|
||||
lockfileDir: string
|
||||
overrides?: Record<string, string>
|
||||
packageExtensions?: Record<string, PackageExtension>
|
||||
@@ -563,7 +566,9 @@ export function createReadPackageHook (
|
||||
if (!isEmpty(overrides ?? {})) {
|
||||
hooks.push(createVersionsOverrider(overrides!, lockfileDir))
|
||||
}
|
||||
hooks.push(createPackageExtender(fromPairs(compatPackageExtensions)))
|
||||
if (!ignoreCompatibilityDb) {
|
||||
hooks.push(createPackageExtender(fromPairs(compatPackageExtensions)))
|
||||
}
|
||||
if (!isEmpty(packageExtensions ?? {})) {
|
||||
hooks.push(createPackageExtender(packageExtensions!))
|
||||
}
|
||||
|
||||
@@ -114,3 +114,18 @@ test('manifests are patched by extensions from the compatibility database', asyn
|
||||
const lockfile = await project.readLockfile()
|
||||
expect(lockfile.packages['/debug/4.0.0'].peerDependenciesMeta?.['supports-color']?.optional).toBe(true)
|
||||
})
|
||||
|
||||
test('manifests are not patched by extensions from the compatibility database when ignoreCompatibilityDb is true', async () => {
|
||||
const project = prepareEmpty()
|
||||
|
||||
await addDependenciesToPackage(
|
||||
{},
|
||||
['debug@4.0.0'],
|
||||
await testDefaults({
|
||||
ignoreCompatibilityDb: true,
|
||||
})
|
||||
)
|
||||
|
||||
const lockfile = await project.readLockfile()
|
||||
expect(lockfile.packages['/debug/4.0.0'].peerDependenciesMeta).toBeUndefined()
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user