Skip to content

Commit 78396f1

Browse files
committed
chore: add --legacy-bundling and --global-style as deprecated remappings
1 parent d79c016 commit 78396f1

File tree

10 files changed

+128
-9
lines changed

10 files changed

+128
-9
lines changed

lib/commands/dedupe.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ class Dedupe extends ArboristWorkspaceCmd {
99
static name = 'dedupe'
1010
static params = [
1111
'install-strategy',
12+
'legacy-bundling',
13+
'global-style',
1214
'strict-peer-deps',
1315
'package-lock',
1416
'omit',

lib/commands/find-dupes.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ class FindDupes extends ArboristWorkspaceCmd {
66
static name = 'find-dupes'
77
static params = [
88
'install-strategy',
9+
'legacy-bundling',
10+
'global-style',
911
'strict-peer-deps',
1012
'package-lock',
1113
'omit',

lib/commands/install.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ class Install extends ArboristWorkspaceCmd {
2121
'save-exact',
2222
'global',
2323
'install-strategy',
24+
'legacy-bundling',
25+
'global-style',
2426
'omit',
2527
'strict-peer-deps',
2628
'package-lock',

lib/commands/link.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ class Link extends ArboristWorkspaceCmd {
2323
'save-exact',
2424
'global',
2525
'install-strategy',
26+
'legacy-bundling',
27+
'global-style',
2628
'strict-peer-deps',
2729
'package-lock',
2830
'omit',

lib/commands/update.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ class Update extends ArboristWorkspaceCmd {
1515
'save',
1616
'global',
1717
'install-strategy',
18+
'legacy-bundling',
19+
'global-style',
1820
'omit',
1921
'strict-peer-deps',
2022
'package-lock',

lib/utils/config/definitions.js

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -837,6 +837,25 @@ define('globalconfig', {
837837
flatten,
838838
})
839839

840+
define('global-style', {
841+
default: false,
842+
type: Boolean,
843+
description: `
844+
Only install direct dependencies in the top level \`node_modules\`,
845+
but hoist on deeper dependendencies.
846+
Sets \`--install-strategy=shallow\`.
847+
`,
848+
deprecated: `
849+
This option has been deprecated in favor of \`--install-strategy=shallow\`
850+
`,
851+
flatten (key, obj, flatOptions) {
852+
if (obj[key]) {
853+
obj['install-strategy'] = 'shallow'
854+
flatOptions.installStrategy = 'shallow'
855+
}
856+
},
857+
})
858+
840859
define('heading', {
841860
default: 'npm',
842861
type: String,
@@ -1108,6 +1127,27 @@ define('key', {
11081127
flatten,
11091128
})
11101129

1130+
define('legacy-bundling', {
1131+
default: false,
1132+
type: Boolean,
1133+
description: `
1134+
Instead of hoisting package installs in \`node_modules\`, install packages
1135+
in the same manner that they are depended on. This may cause very deep
1136+
directory structures and duplicate package installs as there is no
1137+
de-duplicating.
1138+
Sets \`--install-strategy=nested\`.
1139+
`,
1140+
deprecated: `
1141+
This option has been deprecated in favor of \`--install-strategy=nested\`
1142+
`,
1143+
flatten (key, obj, flatOptions) {
1144+
if (obj[key]) {
1145+
obj['install-strategy'] = 'nested'
1146+
flatOptions.installStrategy = 'nested'
1147+
}
1148+
},
1149+
})
1150+
11111151
define('legacy-peer-deps', {
11121152
default: false,
11131153
type: Boolean,

smoke-tests/tap-snapshots/test/index.js.test.cjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ npm ERR!
5757
npm ERR! Options:
5858
npm ERR! [-S|--save|--no-save|--save-prod|--save-dev|--save-optional|--save-peer|--save-bundle]
5959
npm ERR! [-E|--save-exact] [-g|--global] [--install-strategy <hoisted|nested|shallow>]
60+
npm ERR! [--legacy-bundling] [--global-style]
6061
npm ERR! [--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]]
6162
npm ERR! [--strict-peer-deps] [--no-package-lock] [--foreground-scripts]
6263
npm ERR! [--ignore-scripts] [--no-audit] [--no-bin-links] [--no-fund] [--dry-run]

tap-snapshots/test/lib/commands/config.js.test.cjs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ exports[`test/lib/commands/config.js TAP config list --json > output matches sna
6161
"git-tag-version": true,
6262
"global": false,
6363
"globalconfig": "{GLOBALPREFIX}/npmrc",
64+
"global-style": false,
6465
"heading": "npm",
6566
"https-proxy": null,
6667
"if-present": false,
@@ -83,6 +84,7 @@ exports[`test/lib/commands/config.js TAP config list --json > output matches sna
8384
"install-links": true,
8485
"install-strategy": "hoisted",
8586
"key": null,
87+
"legacy-bundling": false,
8688
"legacy-peer-deps": false,
8789
"link": false,
8890
"local-address": null,
@@ -211,6 +213,7 @@ fund = true
211213
git = "git"
212214
git-tag-version = true
213215
global = false
216+
global-style = false
214217
globalconfig = "{GLOBALPREFIX}/npmrc"
215218
heading = "npm"
216219
https-proxy = null
@@ -235,6 +238,7 @@ install-links = true
235238
install-strategy = "hoisted"
236239
json = false
237240
key = null
241+
legacy-bundling = false
238242
legacy-peer-deps = false
239243
link = false
240244
local-address = null

tap-snapshots/test/lib/docs.js.test.cjs

Lines changed: 57 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1983,6 +1983,16 @@ When set to \`dev\` or \`development\`, this is an alias for \`--include=dev\`.
19831983
19841984
Alias for \`--include=dev\`.
19851985
1986+
#### \`global-style\`
1987+
1988+
* Default: false
1989+
* Type: Boolean
1990+
* DEPRECATED: This option has been deprecated in favor of
1991+
\`--install-strategy=shallow\`
1992+
1993+
Only install direct dependencies in the top level \`node_modules\`, but hoist
1994+
on deeper dependendencies. Sets \`--install-strategy=shallow\`.
1995+
19861996
#### \`init.author.email\`
19871997
19881998
* Default: ""
@@ -2031,6 +2041,18 @@ Alias for \`--init-module\`
20312041
20322042
Alias for \`--init-version\`
20332043
2044+
#### \`legacy-bundling\`
2045+
2046+
* Default: false
2047+
* Type: Boolean
2048+
* DEPRECATED: This option has been deprecated in favor of
2049+
\`--install-strategy=nested\`
2050+
2051+
Instead of hoisting package installs in \`node_modules\`, install packages in
2052+
the same manner that they are depended on. This may cause very deep
2053+
directory structures and duplicate package installs as there is no
2054+
de-duplicating. Sets \`--install-strategy=nested\`.
2055+
20342056
#### \`only\`
20352057
20362058
* Default: null
@@ -2130,6 +2152,7 @@ Array [
21302152
"git-tag-version",
21312153
"global",
21322154
"globalconfig",
2155+
"global-style",
21332156
"heading",
21342157
"https-proxy",
21352158
"if-present",
@@ -2153,6 +2176,7 @@ Array [
21532176
"install-strategy",
21542177
"json",
21552178
"key",
2179+
"legacy-bundling",
21562180
"legacy-peer-deps",
21572181
"link",
21582182
"local-address",
@@ -2280,6 +2304,7 @@ Array [
22802304
"git-tag-version",
22812305
"global",
22822306
"globalconfig",
2307+
"global-style",
22832308
"heading",
22842309
"https-proxy",
22852310
"if-present",
@@ -2291,6 +2316,7 @@ Array [
22912316
"install-strategy",
22922317
"json",
22932318
"key",
2319+
"legacy-bundling",
22942320
"legacy-peer-deps",
22952321
"local-address",
22962322
"location",
@@ -2578,6 +2604,7 @@ npm ci
25782604
Options:
25792605
[-S|--save|--no-save|--save-prod|--save-dev|--save-optional|--save-peer|--save-bundle]
25802606
[-E|--save-exact] [-g|--global] [--install-strategy <hoisted|nested|shallow>]
2607+
[--legacy-bundling] [--global-style]
25812608
[--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]]
25822609
[--strict-peer-deps] [--no-package-lock] [--foreground-scripts]
25832610
[--ignore-scripts] [--no-audit] [--no-bin-links] [--no-fund] [--dry-run]
@@ -2598,6 +2625,8 @@ aliases: clean-install, ic, install-clean, isntall-clean
25982625
#### \`save-exact\`
25992626
#### \`global\`
26002627
#### \`install-strategy\`
2628+
#### \`legacy-bundling\`
2629+
#### \`global-style\`
26012630
#### \`omit\`
26022631
#### \`strict-peer-deps\`
26032632
#### \`package-lock\`
@@ -2672,9 +2701,10 @@ Usage:
26722701
npm dedupe
26732702
26742703
Options:
2675-
[--install-strategy <hoisted|nested|shallow>] [--strict-peer-deps]
2676-
[--no-package-lock] [--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]]
2677-
[--ignore-scripts] [--no-audit] [--no-bin-links] [--no-fund] [--dry-run]
2704+
[--install-strategy <hoisted|nested|shallow>] [--legacy-bundling]
2705+
[--global-style] [--strict-peer-deps] [--no-package-lock]
2706+
[--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]] [--ignore-scripts]
2707+
[--no-audit] [--no-bin-links] [--no-fund] [--dry-run]
26782708
[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
26792709
[-ws|--workspaces] [--include-workspace-root] [--no-install-links]
26802710
@@ -2689,6 +2719,8 @@ alias: ddp
26892719
\`\`\`
26902720
26912721
#### \`install-strategy\`
2722+
#### \`legacy-bundling\`
2723+
#### \`global-style\`
26922724
#### \`strict-peer-deps\`
26932725
#### \`package-lock\`
26942726
#### \`omit\`
@@ -2932,9 +2964,10 @@ Usage:
29322964
npm find-dupes
29332965
29342966
Options:
2935-
[--install-strategy <hoisted|nested|shallow>] [--strict-peer-deps]
2936-
[--no-package-lock] [--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]]
2937-
[--ignore-scripts] [--no-audit] [--no-bin-links] [--no-fund]
2967+
[--install-strategy <hoisted|nested|shallow>] [--legacy-bundling]
2968+
[--global-style] [--strict-peer-deps] [--no-package-lock]
2969+
[--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]] [--ignore-scripts]
2970+
[--no-audit] [--no-bin-links] [--no-fund]
29382971
[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
29392972
[-ws|--workspaces] [--include-workspace-root] [--no-install-links]
29402973
@@ -2945,6 +2978,8 @@ npm find-dupes
29452978
\`\`\`
29462979
29472980
#### \`install-strategy\`
2981+
#### \`legacy-bundling\`
2982+
#### \`global-style\`
29482983
#### \`strict-peer-deps\`
29492984
#### \`package-lock\`
29502985
#### \`omit\`
@@ -3103,6 +3138,7 @@ npm install [<package-spec> ...]
31033138
Options:
31043139
[-S|--save|--no-save|--save-prod|--save-dev|--save-optional|--save-peer|--save-bundle]
31053140
[-E|--save-exact] [-g|--global] [--install-strategy <hoisted|nested|shallow>]
3141+
[--legacy-bundling] [--global-style]
31063142
[--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]]
31073143
[--strict-peer-deps] [--no-package-lock] [--foreground-scripts]
31083144
[--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
31233159
#### \`save-exact\`
31243160
#### \`global\`
31253161
#### \`install-strategy\`
3162+
#### \`legacy-bundling\`
3163+
#### \`global-style\`
31263164
#### \`omit\`
31273165
#### \`strict-peer-deps\`
31283166
#### \`package-lock\`
@@ -3147,6 +3185,7 @@ npm install-ci-test
31473185
Options:
31483186
[-S|--save|--no-save|--save-prod|--save-dev|--save-optional|--save-peer|--save-bundle]
31493187
[-E|--save-exact] [-g|--global] [--install-strategy <hoisted|nested|shallow>]
3188+
[--legacy-bundling] [--global-style]
31503189
[--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]]
31513190
[--strict-peer-deps] [--no-package-lock] [--foreground-scripts]
31523191
[--ignore-scripts] [--no-audit] [--no-bin-links] [--no-fund] [--dry-run]
@@ -3167,6 +3206,8 @@ alias: cit
31673206
#### \`save-exact\`
31683207
#### \`global\`
31693208
#### \`install-strategy\`
3209+
#### \`legacy-bundling\`
3210+
#### \`global-style\`
31703211
#### \`omit\`
31713212
#### \`strict-peer-deps\`
31723213
#### \`package-lock\`
@@ -3191,6 +3232,7 @@ npm install-test [<package-spec> ...]
31913232
Options:
31923233
[-S|--save|--no-save|--save-prod|--save-dev|--save-optional|--save-peer|--save-bundle]
31933234
[-E|--save-exact] [-g|--global] [--install-strategy <hoisted|nested|shallow>]
3235+
[--legacy-bundling] [--global-style]
31943236
[--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]]
31953237
[--strict-peer-deps] [--no-package-lock] [--foreground-scripts]
31963238
[--ignore-scripts] [--no-audit] [--no-bin-links] [--no-fund] [--dry-run]
@@ -3211,6 +3253,8 @@ alias: it
32113253
#### \`save-exact\`
32123254
#### \`global\`
32133255
#### \`install-strategy\`
3256+
#### \`legacy-bundling\`
3257+
#### \`global-style\`
32143258
#### \`omit\`
32153259
#### \`strict-peer-deps\`
32163260
#### \`package-lock\`
@@ -3235,7 +3279,7 @@ npm link [<package-spec>]
32353279
Options:
32363280
[-S|--save|--no-save|--save-prod|--save-dev|--save-optional|--save-peer|--save-bundle]
32373281
[-E|--save-exact] [-g|--global] [--install-strategy <hoisted|nested|shallow>]
3238-
[--strict-peer-deps] [--no-package-lock]
3282+
[--legacy-bundling] [--global-style] [--strict-peer-deps] [--no-package-lock]
32393283
[--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]] [--ignore-scripts]
32403284
[--no-audit] [--no-bin-links] [--no-fund] [--dry-run]
32413285
[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
@@ -3255,6 +3299,8 @@ alias: ln
32553299
#### \`save-exact\`
32563300
#### \`global\`
32573301
#### \`install-strategy\`
3302+
#### \`legacy-bundling\`
3303+
#### \`global-style\`
32583304
#### \`strict-peer-deps\`
32593305
#### \`package-lock\`
32603306
#### \`omit\`
@@ -4105,8 +4151,8 @@ npm update [<pkg>...]
41054151
41064152
Options:
41074153
[-S|--save|--no-save|--save-prod|--save-dev|--save-optional|--save-peer|--save-bundle]
4108-
[-g|--global] [--install-strategy <hoisted|nested|shallow>]
4109-
[--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]]
4154+
[-g|--global] [--install-strategy <hoisted|nested|shallow>] [--legacy-bundling]
4155+
[--global-style] [--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]]
41104156
[--strict-peer-deps] [--no-package-lock] [--foreground-scripts]
41114157
[--ignore-scripts] [--no-audit] [--no-bin-links] [--no-fund] [--dry-run]
41124158
[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
@@ -4125,6 +4171,8 @@ aliases: up, upgrade, udpate
41254171
#### \`save\`
41264172
#### \`global\`
41274173
#### \`install-strategy\`
4174+
#### \`legacy-bundling\`
4175+
#### \`global-style\`
41284176
#### \`omit\`
41294177
#### \`strict-peer-deps\`
41304178
#### \`package-lock\`

test/lib/utils/config/definitions.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -908,3 +908,19 @@ t.test('loglevel silent', t => {
908908
t.match(flat.silent, true, 'flattens to assign silent')
909909
t.end()
910910
})
911+
912+
t.test('remap legacy-bundling', t => {
913+
const obj = { 'legacy-bundling': true }
914+
const flat = {}
915+
mockDefs()['legacy-bundling'].flatten('legacy-bundling', obj, flat)
916+
t.strictSame(flat, { installStrategy: 'nested' })
917+
t.end()
918+
})
919+
920+
t.test('remap global-style', t => {
921+
const obj = { 'global-style': true }
922+
const flat = {}
923+
mockDefs()['global-style'].flatten('global-style', obj, flat)
924+
t.strictSame(flat, { installStrategy: 'shallow' })
925+
t.end()
926+
})

0 commit comments

Comments
 (0)