diff --git a/lib/commands/dedupe.js b/lib/commands/dedupe.js index 40974eea16b94..0cc0e80709883 100644 --- a/lib/commands/dedupe.js +++ b/lib/commands/dedupe.js @@ -9,6 +9,8 @@ class Dedupe extends ArboristWorkspaceCmd { static name = 'dedupe' static params = [ 'install-strategy', + 'legacy-bundling', + 'global-style', 'strict-peer-deps', 'package-lock', 'omit', diff --git a/lib/commands/find-dupes.js b/lib/commands/find-dupes.js index dad8be86ad07e..b99ea7a14eb21 100644 --- a/lib/commands/find-dupes.js +++ b/lib/commands/find-dupes.js @@ -6,6 +6,8 @@ class FindDupes extends ArboristWorkspaceCmd { static name = 'find-dupes' static params = [ 'install-strategy', + 'legacy-bundling', + 'global-style', 'strict-peer-deps', 'package-lock', 'omit', diff --git a/lib/commands/install.js b/lib/commands/install.js index 41e23f8638061..512226c6b5a05 100644 --- a/lib/commands/install.js +++ b/lib/commands/install.js @@ -21,6 +21,8 @@ class Install extends ArboristWorkspaceCmd { 'save-exact', 'global', 'install-strategy', + 'legacy-bundling', + 'global-style', 'omit', 'strict-peer-deps', 'package-lock', diff --git a/lib/commands/link.js b/lib/commands/link.js index df08b87c6c937..5af2c7c269f8f 100644 --- a/lib/commands/link.js +++ b/lib/commands/link.js @@ -23,6 +23,8 @@ class Link extends ArboristWorkspaceCmd { 'save-exact', 'global', 'install-strategy', + 'legacy-bundling', + 'global-style', 'strict-peer-deps', 'package-lock', 'omit', diff --git a/lib/commands/update.js b/lib/commands/update.js index 818f1f18cfb62..be9d35093d43b 100644 --- a/lib/commands/update.js +++ b/lib/commands/update.js @@ -15,6 +15,8 @@ class Update extends ArboristWorkspaceCmd { 'save', 'global', 'install-strategy', + 'legacy-bundling', + 'global-style', 'omit', 'strict-peer-deps', 'package-lock', diff --git a/lib/utils/config/definitions.js b/lib/utils/config/definitions.js index ebc4092a5f6e8..b8a7ec2d91de4 100644 --- a/lib/utils/config/definitions.js +++ b/lib/utils/config/definitions.js @@ -837,6 +837,25 @@ define('globalconfig', { flatten, }) +define('global-style', { + default: false, + type: Boolean, + description: ` + Only install direct dependencies in the top level \`node_modules\`, + but hoist on deeper dependendencies. + Sets \`--install-strategy=shallow\`. + `, + deprecated: ` + This option has been deprecated in favor of \`--install-strategy=shallow\` + `, + flatten (key, obj, flatOptions) { + if (obj[key]) { + obj['install-strategy'] = 'shallow' + flatOptions.installStrategy = 'shallow' + } + }, +}) + define('heading', { default: 'npm', type: String, @@ -1108,6 +1127,27 @@ define('key', { flatten, }) +define('legacy-bundling', { + default: false, + type: Boolean, + description: ` + Instead of hoisting package installs in \`node_modules\`, install packages + in the same manner that they are depended on. This may cause very deep + directory structures and duplicate package installs as there is no + de-duplicating. + Sets \`--install-strategy=nested\`. + `, + deprecated: ` + This option has been deprecated in favor of \`--install-strategy=nested\` + `, + flatten (key, obj, flatOptions) { + if (obj[key]) { + obj['install-strategy'] = 'nested' + flatOptions.installStrategy = 'nested' + } + }, +}) + define('legacy-peer-deps', { default: false, type: Boolean, diff --git a/tap-snapshots/test/lib/commands/config.js.test.cjs b/tap-snapshots/test/lib/commands/config.js.test.cjs index 83e137b1b6a76..4170dd9078c86 100644 --- a/tap-snapshots/test/lib/commands/config.js.test.cjs +++ b/tap-snapshots/test/lib/commands/config.js.test.cjs @@ -61,6 +61,7 @@ exports[`test/lib/commands/config.js TAP config list --json > output matches sna "git-tag-version": true, "global": false, "globalconfig": "{GLOBALPREFIX}/npmrc", + "global-style": false, "heading": "npm", "https-proxy": null, "if-present": false, @@ -83,6 +84,7 @@ exports[`test/lib/commands/config.js TAP config list --json > output matches sna "install-links": true, "install-strategy": "hoisted", "key": null, + "legacy-bundling": false, "legacy-peer-deps": false, "link": false, "local-address": null, @@ -211,6 +213,7 @@ fund = true git = "git" git-tag-version = true global = false +global-style = false globalconfig = "{GLOBALPREFIX}/npmrc" heading = "npm" https-proxy = null @@ -235,6 +238,7 @@ install-links = true install-strategy = "hoisted" json = false key = null +legacy-bundling = false legacy-peer-deps = false link = false local-address = null diff --git a/tap-snapshots/test/lib/docs.js.test.cjs b/tap-snapshots/test/lib/docs.js.test.cjs index e846449169c02..15ceed5c16d3a 100644 --- a/tap-snapshots/test/lib/docs.js.test.cjs +++ b/tap-snapshots/test/lib/docs.js.test.cjs @@ -1983,6 +1983,16 @@ When set to \`dev\` or \`development\`, this is an alias for \`--include=dev\`. Alias for \`--include=dev\`. +#### \`global-style\` + +* Default: false +* Type: Boolean +* DEPRECATED: This option has been deprecated in favor of + \`--install-strategy=shallow\` + +Only install direct dependencies in the top level \`node_modules\`, but hoist +on deeper dependendencies. Sets \`--install-strategy=shallow\`. + #### \`init.author.email\` * Default: "" @@ -2031,6 +2041,18 @@ Alias for \`--init-module\` Alias for \`--init-version\` +#### \`legacy-bundling\` + +* Default: false +* Type: Boolean +* DEPRECATED: This option has been deprecated in favor of + \`--install-strategy=nested\` + +Instead of hoisting package installs in \`node_modules\`, install packages in +the same manner that they are depended on. This may cause very deep +directory structures and duplicate package installs as there is no +de-duplicating. Sets \`--install-strategy=nested\`. + #### \`only\` * Default: null @@ -2130,6 +2152,7 @@ Array [ "git-tag-version", "global", "globalconfig", + "global-style", "heading", "https-proxy", "if-present", @@ -2153,6 +2176,7 @@ Array [ "install-strategy", "json", "key", + "legacy-bundling", "legacy-peer-deps", "link", "local-address", @@ -2280,6 +2304,7 @@ Array [ "git-tag-version", "global", "globalconfig", + "global-style", "heading", "https-proxy", "if-present", @@ -2291,6 +2316,7 @@ Array [ "install-strategy", "json", "key", + "legacy-bundling", "legacy-peer-deps", "local-address", "location", @@ -2578,6 +2604,7 @@ npm ci Options: [-S|--save|--no-save|--save-prod|--save-dev|--save-optional|--save-peer|--save-bundle] [-E|--save-exact] [-g|--global] [--install-strategy ] +[--legacy-bundling] [--global-style] [--omit [--omit ...]] [--strict-peer-deps] [--no-package-lock] [--foreground-scripts] [--ignore-scripts] [--no-audit] [--no-bin-links] [--no-fund] [--dry-run] @@ -2598,6 +2625,8 @@ aliases: clean-install, ic, install-clean, isntall-clean #### \`save-exact\` #### \`global\` #### \`install-strategy\` +#### \`legacy-bundling\` +#### \`global-style\` #### \`omit\` #### \`strict-peer-deps\` #### \`package-lock\` @@ -2672,9 +2701,10 @@ Usage: npm dedupe Options: -[--install-strategy ] [--strict-peer-deps] -[--no-package-lock] [--omit [--omit ...]] -[--ignore-scripts] [--no-audit] [--no-bin-links] [--no-fund] [--dry-run] +[--install-strategy ] [--legacy-bundling] +[--global-style] [--strict-peer-deps] [--no-package-lock] +[--omit [--omit ...]] [--ignore-scripts] +[--no-audit] [--no-bin-links] [--no-fund] [--dry-run] [-w|--workspace [-w|--workspace ...]] [-ws|--workspaces] [--include-workspace-root] [--no-install-links] @@ -2689,6 +2719,8 @@ alias: ddp \`\`\` #### \`install-strategy\` +#### \`legacy-bundling\` +#### \`global-style\` #### \`strict-peer-deps\` #### \`package-lock\` #### \`omit\` @@ -2932,9 +2964,10 @@ Usage: npm find-dupes Options: -[--install-strategy ] [--strict-peer-deps] -[--no-package-lock] [--omit [--omit ...]] -[--ignore-scripts] [--no-audit] [--no-bin-links] [--no-fund] +[--install-strategy ] [--legacy-bundling] +[--global-style] [--strict-peer-deps] [--no-package-lock] +[--omit [--omit ...]] [--ignore-scripts] +[--no-audit] [--no-bin-links] [--no-fund] [-w|--workspace [-w|--workspace ...]] [-ws|--workspaces] [--include-workspace-root] [--no-install-links] @@ -2945,6 +2978,8 @@ npm find-dupes \`\`\` #### \`install-strategy\` +#### \`legacy-bundling\` +#### \`global-style\` #### \`strict-peer-deps\` #### \`package-lock\` #### \`omit\` @@ -3103,6 +3138,7 @@ npm install [ ...] Options: [-S|--save|--no-save|--save-prod|--save-dev|--save-optional|--save-peer|--save-bundle] [-E|--save-exact] [-g|--global] [--install-strategy ] +[--legacy-bundling] [--global-style] [--omit [--omit ...]] [--strict-peer-deps] [--no-package-lock] [--foreground-scripts] [--ignore-scripts] [--no-audit] [--no-bin-links] [--no-fund] [--dry-run] @@ -3123,6 +3159,8 @@ aliases: add, i, in, ins, inst, insta, instal, isnt, isnta, isntal, isntall #### \`save-exact\` #### \`global\` #### \`install-strategy\` +#### \`legacy-bundling\` +#### \`global-style\` #### \`omit\` #### \`strict-peer-deps\` #### \`package-lock\` @@ -3147,6 +3185,7 @@ npm install-ci-test Options: [-S|--save|--no-save|--save-prod|--save-dev|--save-optional|--save-peer|--save-bundle] [-E|--save-exact] [-g|--global] [--install-strategy ] +[--legacy-bundling] [--global-style] [--omit [--omit ...]] [--strict-peer-deps] [--no-package-lock] [--foreground-scripts] [--ignore-scripts] [--no-audit] [--no-bin-links] [--no-fund] [--dry-run] @@ -3167,6 +3206,8 @@ alias: cit #### \`save-exact\` #### \`global\` #### \`install-strategy\` +#### \`legacy-bundling\` +#### \`global-style\` #### \`omit\` #### \`strict-peer-deps\` #### \`package-lock\` @@ -3191,6 +3232,7 @@ npm install-test [ ...] Options: [-S|--save|--no-save|--save-prod|--save-dev|--save-optional|--save-peer|--save-bundle] [-E|--save-exact] [-g|--global] [--install-strategy ] +[--legacy-bundling] [--global-style] [--omit [--omit ...]] [--strict-peer-deps] [--no-package-lock] [--foreground-scripts] [--ignore-scripts] [--no-audit] [--no-bin-links] [--no-fund] [--dry-run] @@ -3211,6 +3253,8 @@ alias: it #### \`save-exact\` #### \`global\` #### \`install-strategy\` +#### \`legacy-bundling\` +#### \`global-style\` #### \`omit\` #### \`strict-peer-deps\` #### \`package-lock\` @@ -3235,7 +3279,7 @@ npm link [] Options: [-S|--save|--no-save|--save-prod|--save-dev|--save-optional|--save-peer|--save-bundle] [-E|--save-exact] [-g|--global] [--install-strategy ] -[--strict-peer-deps] [--no-package-lock] +[--legacy-bundling] [--global-style] [--strict-peer-deps] [--no-package-lock] [--omit [--omit ...]] [--ignore-scripts] [--no-audit] [--no-bin-links] [--no-fund] [--dry-run] [-w|--workspace [-w|--workspace ...]] @@ -3255,6 +3299,8 @@ alias: ln #### \`save-exact\` #### \`global\` #### \`install-strategy\` +#### \`legacy-bundling\` +#### \`global-style\` #### \`strict-peer-deps\` #### \`package-lock\` #### \`omit\` @@ -4105,8 +4151,8 @@ npm update [...] Options: [-S|--save|--no-save|--save-prod|--save-dev|--save-optional|--save-peer|--save-bundle] -[-g|--global] [--install-strategy ] -[--omit [--omit ...]] +[-g|--global] [--install-strategy ] [--legacy-bundling] +[--global-style] [--omit [--omit ...]] [--strict-peer-deps] [--no-package-lock] [--foreground-scripts] [--ignore-scripts] [--no-audit] [--no-bin-links] [--no-fund] [--dry-run] [-w|--workspace [-w|--workspace ...]] @@ -4125,6 +4171,8 @@ aliases: up, upgrade, udpate #### \`save\` #### \`global\` #### \`install-strategy\` +#### \`legacy-bundling\` +#### \`global-style\` #### \`omit\` #### \`strict-peer-deps\` #### \`package-lock\` diff --git a/test/lib/utils/config/definitions.js b/test/lib/utils/config/definitions.js index 07d029c0290bb..21eba1617affd 100644 --- a/test/lib/utils/config/definitions.js +++ b/test/lib/utils/config/definitions.js @@ -908,3 +908,19 @@ t.test('loglevel silent', t => { t.match(flat.silent, true, 'flattens to assign silent') t.end() }) + +t.test('remap legacy-bundling', t => { + const obj = { 'legacy-bundling': true } + const flat = {} + mockDefs()['legacy-bundling'].flatten('legacy-bundling', obj, flat) + t.strictSame(flat, { installStrategy: 'nested' }) + t.end() +}) + +t.test('remap global-style', t => { + const obj = { 'global-style': true } + const flat = {} + mockDefs()['global-style'].flatten('global-style', obj, flat) + t.strictSame(flat, { installStrategy: 'shallow' }) + t.end() +})