refactor!: remove ignoreDepScripts and neverBuiltDependencies (#11220)

* refactor: remove ignoreDepScripts and neverBuiltDependencies settings

These settings are redundant in v11:
- `ignore-dep-scripts` is superseded by the default behavior of `allowBuilds`
- `neverBuiltDependencies` was already dead code, replaced by `allowBuilds`

* chore: add changeset for removed ignore-dep-scripts setting
This commit is contained in:
Zoltan Kochan
2026-04-07 13:41:13 +02:00
committed by GitHub
parent 16cfde66ec
commit 51b04c3e9a
17 changed files with 11 additions and 55 deletions

View File

@@ -0,0 +1,6 @@
---
"@pnpm/config.reader": major
"pnpm": major
---
Removed the `ignore-dep-scripts` setting. It is no longer needed because dependency build scripts are already blocked by default — use `allowBuilds` in `pnpm-workspace.yaml` to allow specific packages to run scripts.

View File

@@ -46,7 +46,6 @@ export type StrictBuildOptions = {
pending: boolean
shamefullyHoist: boolean
deployAllFiles: boolean
neverBuiltDependencies?: string[]
allowBuilds?: Record<string, boolean | string>
virtualStoreDirMaxLength: number
peersSuffixMaxLength: number

View File

@@ -99,7 +99,6 @@ CreateStoreControllerOptions &
reporter?: (logObj: LogBase) => void
pending: boolean
skipIfHasSideEffectsCache?: boolean
neverBuiltDependencies?: string[]
allowBuilds?: Record<string, boolean | string>
}

View File

@@ -69,7 +69,6 @@ export interface Config extends OptionsFromRootManifest {
dir: string
bin: string
verifyDepsBeforeRun?: VerifyDepsBeforeRun
ignoreDepScripts?: boolean
ignoreScripts?: boolean
ignoreCompatibilityDb?: boolean
includeWorkspaceRoot?: boolean

View File

@@ -80,7 +80,6 @@ export const excludedPnpmKeys = [
'hoist-pattern',
'hoist-workspace-packages',
'ignore-compatibility-db',
'ignore-dep-scripts',
'ignore-pnpmfile',
'ignore-workspace',
'ignore-workspace-cycles',

View File

@@ -49,7 +49,6 @@ export const pnpmTypes = {
'hoist-pattern': Array,
'hoist-workspace-packages': Boolean,
'ignore-compatibility-db': Boolean,
'ignore-dep-scripts': Boolean,
'ignore-pnpmfile': Boolean,
'ignore-workspace': Boolean,
'ignore-workspace-cycles': Boolean,

View File

@@ -1,2 +0,0 @@
neverBuiltDependencies:
- foo

View File

@@ -246,7 +246,6 @@ async function installFromLockfile (
globalVirtualStoreDir: path.join(opts.storeDir, 'links'),
allowBuilds: opts.allowBuilds,
ignoreScripts: true,
ignoreDepScripts: true,
force: false,
engineStrict: false,
currentEngine: {

View File

@@ -53,7 +53,6 @@ export interface StrictInstallOptions {
fixLockfile: boolean
dedupe: boolean
ignoreCompatibilityDb: boolean
ignoreDepScripts: boolean
ignorePackageManifest: boolean
/**
* When true, skip fetching local dependencies (file: protocol pointing to directories).
@@ -211,7 +210,6 @@ const defaults = (opts: InstallOptions): StrictInstallOptions => {
publicHoistPattern: undefined,
hooks: {},
ignoreCurrentSpecifiers: false,
ignoreDepScripts: false,
ignoreScripts: false,
include: {
dependencies: true,

View File

@@ -1455,7 +1455,7 @@ const _installInContext: InstallFunction = async (projects, ctx, opts) => {
extraBinPaths: ctx.extraBinPaths,
extraNodePaths: ctx.extraNodePaths,
extraEnv,
ignoreScripts: opts.ignoreScripts || opts.ignoreDepScripts,
ignoreScripts: opts.ignoreScripts,
lockfileDir: ctx.lockfileDir,
optional: opts.include.optionalDependencies,
preferSymlinkedExecutables: opts.preferSymlinkedExecutables,

View File

@@ -315,7 +315,6 @@ test('run prepare script for git-hosted dependencies', async () => {
await addDependenciesToPackage({}, ['pnpm/test-git-fetch#8b333f12d5357f4f25a654c305c826294cb073bf'], testDefaults({
fastUnpack: false,
allowBuilds: { 'test-git-fetch': true },
neverBuiltDependencies: undefined,
}))
const scripts = project.requireModule('test-git-fetch/output.json')
@@ -578,39 +577,6 @@ test('lifecycle scripts run after linking root dependencies', async () => {
// if there was no exception, the test passed
})
test('ignore-dep-scripts', async () => {
await using server1 = await createTestIpcServer()
await using server2 = await createTestIpcServer()
prepareEmpty()
const manifest = {
scripts: {
'pnpm:devPreinstall': server2.sendLineScript('pnpm:devPreinstall'),
install: server1.sendLineScript('install'),
postinstall: server1.sendLineScript('postinstall'),
preinstall: server1.sendLineScript('preinstall'),
},
dependencies: {
'@pnpm.e2e/pre-and-postinstall-scripts-example': '1.0.0',
},
}
await install(manifest, testDefaults({ fastUnpack: false, ignoreDepScripts: true }))
expect(server1.getLines()).toStrictEqual(['preinstall', 'install', 'postinstall'])
expect(server2.getLines()).toStrictEqual(['pnpm:devPreinstall'])
expect(fs.existsSync('node_modules/@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-preinstall.js')).toBeFalsy()
rimrafSync('node_modules')
server1.clear()
server2.clear()
await install(manifest, testDefaults({ fastUnpack: false, ignoreDepScripts: true }))
expect(server1.getLines()).toStrictEqual(['preinstall', 'install', 'postinstall'])
expect(server2.getLines()).toStrictEqual(['pnpm:devPreinstall'])
expect(fs.existsSync('node_modules/@pnpm.e2e/pre-and-postinstall-scripts-example/generated-by-preinstall.js')).toBeFalsy()
})
test('run pre/postinstall scripts in a workspace that uses node-linker=hoisted', async () => {
await restartWorkerPool()
const projects = preparePackages([

View File

@@ -429,7 +429,6 @@ test('installing Node.js runtime, when it is set via the engines field of a depe
testDefaults({
fastUnpack: false,
allowBuilds: { '@pnpm.e2e/cli-with-node-engine': true },
neverBuiltDependencies: undefined,
})
)
expect(fs.readFileSync('node_modules/@pnpm.e2e/cli-with-node-engine/node-version', 'utf8')).toBe('v22.19.0')

View File

@@ -31,7 +31,6 @@ test('patch package with exact version', async () => {
'is-positive@1.0.0': patchPath,
}
const opts = testDefaults({
neverBuiltDependencies: undefined,
allowBuilds: {},
fastUnpack: false,
sideEffectsCacheRead: true,
@@ -128,7 +127,6 @@ test('patch package with version range', async () => {
'is-positive@1': patchPath,
}
const opts = testDefaults({
neverBuiltDependencies: undefined,
allowBuilds: {},
fastUnpack: false,
sideEffectsCacheRead: true,
@@ -398,7 +396,6 @@ test('patch package when the package is not in allowBuilds list', async () => {
sideEffectsCacheRead: true,
sideEffectsCacheWrite: true,
patchedDependencies,
neverBuiltDependencies: undefined,
allowBuilds: {},
}, {}, {}, { packageImportMethod: 'hardlink' })
await install({
@@ -468,7 +465,6 @@ test('patch package when the package is not in allowBuilds list', async () => {
fastUnpack: false,
sideEffectsCacheRead: true,
sideEffectsCacheWrite: true,
neverBuiltDependencies: undefined,
allowBuilds: {},
offline: true,
}, {}, {}, { packageImportMethod: 'hardlink' }))

View File

@@ -125,7 +125,6 @@ export interface HeadlessOptions {
preferSymlinkedExecutables?: boolean
hoistingLimits?: HoistingLimits
externalDependencies?: Set<string>
ignoreDepScripts: boolean
ignoreScripts: boolean
ignorePackageManifest?: boolean
/**
@@ -571,7 +570,7 @@ export async function headlessInstall (opts: HeadlessOptions): Promise<Installat
extraBinPaths,
extraEnv,
depsStateCache,
ignoreScripts: opts.ignoreScripts || opts.ignoreDepScripts,
ignoreScripts: opts.ignoreScripts,
hoistedLocations,
lockfileDir,
optional: opts.include.optionalDependencies,

View File

@@ -3,7 +3,7 @@ import type { ProjectId } from '@pnpm/types'
import { convertToLockfileFile } from '../lib/lockfileFormatConverters.js'
test('empty overrides and neverBuiltDependencies are removed during lockfile normalization', () => {
test('empty overrides are removed during lockfile normalization', () => {
expect(convertToLockfileFile({
lockfileVersion: LOCKFILE_VERSION,
overrides: {},

View File

@@ -1969,7 +1969,7 @@ test('deploy should keep files created by lifecycle scripts', async () => {
}
})
test('rebuild in a directory created with "pnpm deploy" and with "pnpm.neverBuiltDependencies" configured should run lifecycle scripts', async () => {
test('rebuild in a directory created with "pnpm deploy" should run lifecycle scripts', async () => {
const preparedManifests = {
root: {
name: 'root',

View File

@@ -35,7 +35,7 @@ test('`pnpm recursive rebuild` specific dependencies', async () => {
writeYamlFileSync('pnpm-workspace.yaml', {
packages: ['**', '!store/**'],
neverBuiltDependencies: [],
allowBuilds: {},
})
await execPnpm(['recursive', 'install', '--ignore-scripts'])