mirror of
https://github.com/pnpm/pnpm.git
synced 2025-12-25 08:08:14 -05:00
6
.changeset/calm-walls-peel.md
Normal file
6
.changeset/calm-walls-peel.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
"@pnpm/plugin-commands-installation": patch
|
||||
"pnpm": patch
|
||||
---
|
||||
|
||||
Pass through the `--ignore-scripts` command to install, when running `pnpm dedupe --ignore-scripts` [#7102](https://github.com/pnpm/pnpm/issues/7102).
|
||||
@@ -4,9 +4,11 @@ import { dedupeDiffCheck } from '@pnpm/dedupe.check'
|
||||
import renderHelp from 'render-help'
|
||||
import { type InstallCommandOptions } from './install'
|
||||
import { installDeps } from './installDeps'
|
||||
import { types as allTypes } from '@pnpm/config'
|
||||
import pick from 'ramda/src/pick'
|
||||
|
||||
export function rcOptionsTypes () {
|
||||
return {}
|
||||
return pick(['ignore-scripts'], allTypes)
|
||||
}
|
||||
|
||||
export function cliOptionsTypes () {
|
||||
@@ -30,6 +32,10 @@ export function help () {
|
||||
description: 'Check if running dedupe would result in changes without installing packages or editing the lockfile. Exits with a non-zero status code if changes are possible.',
|
||||
name: '--check',
|
||||
},
|
||||
{
|
||||
description: "Don't run lifecycle scripts",
|
||||
name: '--ignore-scripts',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
@@ -51,6 +57,7 @@ export async function handler (opts: DedupeCommandOptions) {
|
||||
return installDeps({
|
||||
...opts,
|
||||
dedupe: true,
|
||||
ignoreScripts: opts.ignoreScripts ?? false,
|
||||
include,
|
||||
includeDirect: include,
|
||||
lockfileCheck: opts.check ? dedupeDiffCheck : undefined,
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import fs from 'fs'
|
||||
import path from 'path'
|
||||
import { DedupeCheckIssuesError } from '@pnpm/dedupe.check'
|
||||
import { readProjects } from '@pnpm/filter-workspace-packages'
|
||||
@@ -72,6 +73,41 @@ describe('pnpm dedupe', () => {
|
||||
},
|
||||
})
|
||||
})
|
||||
|
||||
test('dedupe: ignores all the lifecycle scripts when --ignore-scripts is used', async () => {
|
||||
const project = prepare({
|
||||
name: 'test-dedupe-with-ignore-scripts',
|
||||
version: '0.0.0',
|
||||
|
||||
dependencies: {
|
||||
'json-append': '1.1.1',
|
||||
},
|
||||
|
||||
scripts: {
|
||||
// eslint-disable:object-literal-sort-keys
|
||||
preinstall: 'node -e "process.stdout.write(\'preinstall\')" | json-append output.json',
|
||||
prepare: 'node -e "process.stdout.write(\'prepare\')" | json-append output.json',
|
||||
postinstall: 'node -e "process.stdout.write(\'postinstall\')" | json-append output.json',
|
||||
// eslint-enable:object-literal-sort-keys
|
||||
},
|
||||
})
|
||||
|
||||
const opts = {
|
||||
...DEFAULT_OPTS,
|
||||
recursive: true,
|
||||
dir: project.dir(),
|
||||
ignoreScripts: true,
|
||||
lockfileDir: project.dir(),
|
||||
workspaceDir: project.dir(),
|
||||
}
|
||||
|
||||
await install.handler(opts)
|
||||
|
||||
await dedupe.handler(opts)
|
||||
|
||||
expect(fs.existsSync('package.json')).toBeTruthy()
|
||||
expect(fs.existsSync('output.json')).toBeFalsy()
|
||||
})
|
||||
})
|
||||
|
||||
const noColor = (str: string) => str
|
||||
|
||||
Reference in New Issue
Block a user