mirror of
https://github.com/pnpm/pnpm.git
synced 2026-04-10 18:18:56 -04:00
fix(remove): read the production/optional/dev options (#3541)
This commit is contained in:
5
.changeset/clever-donuts-learn.md
Normal file
5
.changeset/clever-donuts-learn.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@pnpm/plugin-commands-installation": patch
|
||||
---
|
||||
|
||||
The remove command should read the production/optional/dev options.
|
||||
@@ -128,12 +128,15 @@ export async function handler (
|
||||
| 'allProjects'
|
||||
| 'bail'
|
||||
| 'bin'
|
||||
| 'dev'
|
||||
| 'engineStrict'
|
||||
| 'globalPnpmfile'
|
||||
| 'ignorePnpmfile'
|
||||
| 'lockfileDir'
|
||||
| 'linkWorkspacePackages'
|
||||
| 'lockfileDir'
|
||||
| 'optional'
|
||||
| 'pnpmfile'
|
||||
| 'production'
|
||||
| 'rawLocalConfig'
|
||||
| 'registries'
|
||||
| 'saveDev'
|
||||
@@ -147,14 +150,20 @@ export async function handler (
|
||||
params: string[]
|
||||
) {
|
||||
if (params.length === 0) throw new PnpmError('MUST_REMOVE_SOMETHING', 'At least one dependency name should be specified for removal')
|
||||
const include = {
|
||||
dependencies: opts.production !== false,
|
||||
devDependencies: opts.dev !== false,
|
||||
optionalDependencies: opts.optional !== false,
|
||||
}
|
||||
if (opts.recursive && (opts.allProjects != null) && (opts.selectedProjectsGraph != null) && opts.workspaceDir) {
|
||||
await recursive(opts.allProjects, params, { ...opts, selectedProjectsGraph: opts.selectedProjectsGraph, workspaceDir: opts.workspaceDir }, 'remove')
|
||||
await recursive(opts.allProjects, params, { ...opts, include, selectedProjectsGraph: opts.selectedProjectsGraph, workspaceDir: opts.workspaceDir }, 'remove')
|
||||
return
|
||||
}
|
||||
const store = await createOrConnectStoreController(opts)
|
||||
const removeOpts = Object.assign(opts, {
|
||||
storeController: store.ctrl,
|
||||
storeDir: store.dir,
|
||||
include,
|
||||
})
|
||||
if (!opts.ignorePnpmfile) {
|
||||
removeOpts['hooks'] = requireHooks(opts.lockfileDir ?? opts.dir, opts)
|
||||
|
||||
Reference in New Issue
Block a user