Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: implement flag --prefer-dedupe for npm install #6483

Merged
merged 3 commits into from
May 22, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/commands/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class Install extends ArboristWorkspaceCmd {
'global-style',
'omit',
'strict-peer-deps',
'prefer-dedupe',
'package-lock',
'foreground-scripts',
'ignore-scripts',
Expand Down
10 changes: 10 additions & 0 deletions lib/utils/config/definitions.js
Original file line number Diff line number Diff line change
Expand Up @@ -1546,6 +1546,16 @@ define('parseable', {
flatten,
})

define('prefer-dedupe', {
default: false,
type: Boolean,
description: `
Prefer to deduplicate packages if possible., rather than
m4rch3n1ng marked this conversation as resolved.
Show resolved Hide resolved
choosing a newer version of a dependency.
`,
flatten,
})

define('prefer-offline', {
default: false,
type: Boolean,
Expand Down
2 changes: 2 additions & 0 deletions tap-snapshots/test/lib/commands/config.js.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ exports[`test/lib/commands/config.js TAP config list --json > output matches sna
"package-lock-only": false,
"pack-destination": ".",
"parseable": false,
"prefer-dedupe": false,
"prefer-offline": false,
"prefer-online": false,
"preid": "",
Expand Down Expand Up @@ -265,6 +266,7 @@ package = []
package-lock = true
package-lock-only = false
parseable = false
prefer-dedupe = false
prefer-offline = false
prefer-online = false
; prefix = "{REALGLOBALREFIX}" ; overridden by cli
Expand Down
16 changes: 14 additions & 2 deletions tap-snapshots/test/lib/docs.js.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -991,6 +991,14 @@ For \`list\` this means the output will be based on the tree described by the
Output parseable results from commands that write to standard output. For
\`npm search\`, this will be tab-separated table format.

#### \`prefer-dedupe\`

* Default: false
* Type: Boolean

Prefer to deduplicate packages if possible., rather than choosing a newer
version of a dependency.

#### \`prefer-offline\`

* Default: false
Expand Down Expand Up @@ -1802,6 +1810,7 @@ Array [
"package-lock-only",
"pack-destination",
"parseable",
"prefer-dedupe",
"prefer-offline",
"prefer-online",
"prefix",
Expand Down Expand Up @@ -1938,6 +1947,7 @@ Array [
"package-lock-only",
"pack-destination",
"parseable",
"prefer-dedupe",
"prefer-offline",
"prefer-online",
"preid",
Expand Down Expand Up @@ -2763,7 +2773,7 @@ Options:
[-E|--save-exact] [-g|--global]
[--install-strategy <hoisted|nested|shallow|linked>] [--legacy-bundling]
[--global-style] [--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]]
[--strict-peer-deps] [--no-package-lock] [--foreground-scripts]
[--strict-peer-deps] [--prefer-dedupe] [--no-package-lock] [--foreground-scripts]
[--ignore-scripts] [--no-audit] [--no-bin-links] [--no-fund] [--dry-run]
[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
[-ws|--workspaces] [--include-workspace-root] [--install-links]
Expand All @@ -2786,6 +2796,7 @@ aliases: add, i, in, ins, inst, insta, instal, isnt, isnta, isntal, isntall
#### \`global-style\`
#### \`omit\`
#### \`strict-peer-deps\`
#### \`prefer-dedupe\`
#### \`package-lock\`
#### \`foreground-scripts\`
#### \`ignore-scripts\`
Expand Down Expand Up @@ -2851,7 +2862,7 @@ Options:
[-E|--save-exact] [-g|--global]
[--install-strategy <hoisted|nested|shallow|linked>] [--legacy-bundling]
[--global-style] [--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]]
[--strict-peer-deps] [--no-package-lock] [--foreground-scripts]
[--strict-peer-deps] [--prefer-dedupe] [--no-package-lock] [--foreground-scripts]
[--ignore-scripts] [--no-audit] [--no-bin-links] [--no-fund] [--dry-run]
[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
[-ws|--workspaces] [--include-workspace-root] [--install-links]
Expand All @@ -2874,6 +2885,7 @@ alias: it
#### \`global-style\`
#### \`omit\`
#### \`strict-peer-deps\`
#### \`prefer-dedupe\`
#### \`package-lock\`
#### \`foreground-scripts\`
#### \`ignore-scripts\`
Expand Down