diff --git a/.changeset/remove-ignore-dep-scripts.md b/.changeset/remove-ignore-dep-scripts.md new file mode 100644 index 0000000000..86d3e2fe6b --- /dev/null +++ b/.changeset/remove-ignore-dep-scripts.md @@ -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. diff --git a/building/after-install/src/extendBuildOptions.ts b/building/after-install/src/extendBuildOptions.ts index 4408e0043e..a17a122f48 100644 --- a/building/after-install/src/extendBuildOptions.ts +++ b/building/after-install/src/extendBuildOptions.ts @@ -46,7 +46,6 @@ export type StrictBuildOptions = { pending: boolean shamefullyHoist: boolean deployAllFiles: boolean - neverBuiltDependencies?: string[] allowBuilds?: Record virtualStoreDirMaxLength: number peersSuffixMaxLength: number diff --git a/building/commands/src/build/rebuild.ts b/building/commands/src/build/rebuild.ts index 87f0dafe91..db9ff35d6c 100644 --- a/building/commands/src/build/rebuild.ts +++ b/building/commands/src/build/rebuild.ts @@ -99,7 +99,6 @@ CreateStoreControllerOptions & reporter?: (logObj: LogBase) => void pending: boolean skipIfHasSideEffectsCache?: boolean - neverBuiltDependencies?: string[] allowBuilds?: Record } diff --git a/config/reader/src/Config.ts b/config/reader/src/Config.ts index 15bdd8a06a..a77093e36a 100644 --- a/config/reader/src/Config.ts +++ b/config/reader/src/Config.ts @@ -69,7 +69,6 @@ export interface Config extends OptionsFromRootManifest { dir: string bin: string verifyDepsBeforeRun?: VerifyDepsBeforeRun - ignoreDepScripts?: boolean ignoreScripts?: boolean ignoreCompatibilityDb?: boolean includeWorkspaceRoot?: boolean diff --git a/config/reader/src/configFileKey.ts b/config/reader/src/configFileKey.ts index 2925e426fd..2983c4c489 100644 --- a/config/reader/src/configFileKey.ts +++ b/config/reader/src/configFileKey.ts @@ -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', diff --git a/config/reader/src/types.ts b/config/reader/src/types.ts index 2d9eac37d5..52dd1df2a9 100644 --- a/config/reader/src/types.ts +++ b/config/reader/src/types.ts @@ -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, diff --git a/config/reader/test/fixtures/never-built-dependencies/pnpm-workspace.yaml b/config/reader/test/fixtures/never-built-dependencies/pnpm-workspace.yaml deleted file mode 100644 index 4eb0cde36b..0000000000 --- a/config/reader/test/fixtures/never-built-dependencies/pnpm-workspace.yaml +++ /dev/null @@ -1,2 +0,0 @@ -neverBuiltDependencies: - - foo diff --git a/engine/pm/commands/src/self-updater/installPnpm.ts b/engine/pm/commands/src/self-updater/installPnpm.ts index df51594a9a..5281fc5977 100644 --- a/engine/pm/commands/src/self-updater/installPnpm.ts +++ b/engine/pm/commands/src/self-updater/installPnpm.ts @@ -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: { diff --git a/installing/deps-installer/src/install/extendInstallOptions.ts b/installing/deps-installer/src/install/extendInstallOptions.ts index 15615234e6..84d5500763 100644 --- a/installing/deps-installer/src/install/extendInstallOptions.ts +++ b/installing/deps-installer/src/install/extendInstallOptions.ts @@ -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, diff --git a/installing/deps-installer/src/install/index.ts b/installing/deps-installer/src/install/index.ts index 4b88835262..38a080f561 100644 --- a/installing/deps-installer/src/install/index.ts +++ b/installing/deps-installer/src/install/index.ts @@ -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, diff --git a/installing/deps-installer/test/install/lifecycleScripts.ts b/installing/deps-installer/test/install/lifecycleScripts.ts index fcea9dda4f..d1d12ec796 100644 --- a/installing/deps-installer/test/install/lifecycleScripts.ts +++ b/installing/deps-installer/test/install/lifecycleScripts.ts @@ -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([ diff --git a/installing/deps-installer/test/install/nodeRuntime.ts b/installing/deps-installer/test/install/nodeRuntime.ts index 696bb8c6ea..05912f55ec 100644 --- a/installing/deps-installer/test/install/nodeRuntime.ts +++ b/installing/deps-installer/test/install/nodeRuntime.ts @@ -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') diff --git a/installing/deps-installer/test/install/patch.ts b/installing/deps-installer/test/install/patch.ts index 76b66ff5f9..b32095581f 100644 --- a/installing/deps-installer/test/install/patch.ts +++ b/installing/deps-installer/test/install/patch.ts @@ -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' })) diff --git a/installing/deps-restorer/src/index.ts b/installing/deps-restorer/src/index.ts index f96b405edf..afc15c7d9a 100644 --- a/installing/deps-restorer/src/index.ts +++ b/installing/deps-restorer/src/index.ts @@ -125,7 +125,6 @@ export interface HeadlessOptions { preferSymlinkedExecutables?: boolean hoistingLimits?: HoistingLimits externalDependencies?: Set - ignoreDepScripts: boolean ignoreScripts: boolean ignorePackageManifest?: boolean /** @@ -571,7 +570,7 @@ export async function headlessInstall (opts: HeadlessOptions): Promise { +test('empty overrides are removed during lockfile normalization', () => { expect(convertToLockfileFile({ lockfileVersion: LOCKFILE_VERSION, overrides: {}, diff --git a/pnpm/test/monorepo/index.ts b/pnpm/test/monorepo/index.ts index 7bb057ec1b..7ff98088fb 100644 --- a/pnpm/test/monorepo/index.ts +++ b/pnpm/test/monorepo/index.ts @@ -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', diff --git a/pnpm/test/recursive/rebuild.ts b/pnpm/test/recursive/rebuild.ts index b601c4b41d..9dc4b67eae 100644 --- a/pnpm/test/recursive/rebuild.ts +++ b/pnpm/test/recursive/rebuild.ts @@ -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'])