mirror of
https://github.com/pnpm/pnpm.git
synced 2026-01-21 13:29:02 -05:00
refactor: call installDeps directly in dedupe command handler (#6403)
* refactor: call installDeps directly in dedupe command handler This allows the dedupe command to pass options to the `installDeps` function that aren't available on the pnpm install command line or config interface. This better matches the setup in the `add` and `update` command handlers, which also call `installDeps` directly. The previous setup mimicked the `prune` command. Keeping the dedupe and install commands as similar as possible was the original goal of having the dedupe command reuse the install command handler, but this may not be necessary due to how small the install command handler is. Small logic related to what dependency fields to use was copied over. There should be no expected behavior changes in this commit. The `frozenLockfile` setting was not necessary to copy the `dedupe` option skips all frozen lockfile logic. * break: remove unused dedupe argument on install command handler This becomes unnecessary now that the dedupe command handler no longer calls the install command handler directly.
This commit is contained in:
5
.changeset/fast-icons-retire.md
Normal file
5
.changeset/fast-icons-retire.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@pnpm/plugin-commands-installation": patch
|
||||
---
|
||||
|
||||
Internal refactor to call installDeps directly in the pnpm dedupe command handler. No behavior changes are expected with this refactor.
|
||||
5
.changeset/sixty-scissors-enjoy.md
Normal file
5
.changeset/sixty-scissors-enjoy.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@pnpm/plugin-commands-installation": major
|
||||
---
|
||||
|
||||
Remove the `dedupe` option from `InstallCommandOptions`. This was not intentionally part of the public install command's API when it was added.
|
||||
@@ -1,7 +1,8 @@
|
||||
import { docsUrl } from '@pnpm/cli-utils'
|
||||
import { UNIVERSAL_OPTIONS } from '@pnpm/common-cli-options-help'
|
||||
import renderHelp from 'render-help'
|
||||
import * as install from './install'
|
||||
import { type InstallCommandOptions } from './install'
|
||||
import { installDeps } from './installDeps'
|
||||
|
||||
export const rcOptionsTypes = cliOptionsTypes
|
||||
|
||||
@@ -27,11 +28,16 @@ export function help () {
|
||||
})
|
||||
}
|
||||
|
||||
export async function handler (
|
||||
opts: install.InstallCommandOptions
|
||||
) {
|
||||
return install.handler({
|
||||
export async function handler (opts: InstallCommandOptions) {
|
||||
const include = {
|
||||
dependencies: opts.production !== false,
|
||||
devDependencies: opts.dev !== false,
|
||||
optionalDependencies: opts.optional !== false,
|
||||
}
|
||||
return installDeps({
|
||||
...opts,
|
||||
dedupe: true,
|
||||
})
|
||||
include,
|
||||
includeDirect: include,
|
||||
}, [])
|
||||
}
|
||||
|
||||
@@ -296,7 +296,6 @@ export type InstallCommandOptions = Pick<Config,
|
||||
pruneDirectDependencies?: boolean
|
||||
pruneStore?: boolean
|
||||
recursive?: boolean
|
||||
dedupe?: boolean
|
||||
saveLockfile?: boolean
|
||||
workspace?: boolean
|
||||
includeOnlyPackageFiles?: boolean
|
||||
|
||||
Reference in New Issue
Block a user