Skip to content

Commit

Permalink
chore: add --legacy-bundling and --global-style as deprecated remappings
Browse files Browse the repository at this point in the history
  • Loading branch information
fritzy committed Oct 18, 2022
1 parent d79c016 commit 78396f1
Show file tree
Hide file tree
Showing 10 changed files with 128 additions and 9 deletions.
2 changes: 2 additions & 0 deletions lib/commands/dedupe.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
2 changes: 2 additions & 0 deletions lib/commands/find-dupes.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
2 changes: 2 additions & 0 deletions lib/commands/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ class Install extends ArboristWorkspaceCmd {
'save-exact',
'global',
'install-strategy',
'legacy-bundling',
'global-style',
'omit',
'strict-peer-deps',
'package-lock',
Expand Down
2 changes: 2 additions & 0 deletions lib/commands/link.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ class Link extends ArboristWorkspaceCmd {
'save-exact',
'global',
'install-strategy',
'legacy-bundling',
'global-style',
'strict-peer-deps',
'package-lock',
'omit',
Expand Down
2 changes: 2 additions & 0 deletions lib/commands/update.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ class Update extends ArboristWorkspaceCmd {
'save',
'global',
'install-strategy',
'legacy-bundling',
'global-style',
'omit',
'strict-peer-deps',
'package-lock',
Expand Down
40 changes: 40 additions & 0 deletions lib/utils/config/definitions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions smoke-tests/tap-snapshots/test/index.js.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ npm ERR!
npm ERR! Options:
npm ERR! [-S|--save|--no-save|--save-prod|--save-dev|--save-optional|--save-peer|--save-bundle]
npm ERR! [-E|--save-exact] [-g|--global] [--install-strategy <hoisted|nested|shallow>]
npm ERR! [--legacy-bundling] [--global-style]
npm ERR! [--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]]
npm ERR! [--strict-peer-deps] [--no-package-lock] [--foreground-scripts]
npm ERR! [--ignore-scripts] [--no-audit] [--no-bin-links] [--no-fund] [--dry-run]
Expand Down
4 changes: 4 additions & 0 deletions tap-snapshots/test/lib/commands/config.js.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
66 changes: 57 additions & 9 deletions tap-snapshots/test/lib/docs.js.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -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: ""
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -2130,6 +2152,7 @@ Array [
"git-tag-version",
"global",
"globalconfig",
"global-style",
"heading",
"https-proxy",
"if-present",
Expand All @@ -2153,6 +2176,7 @@ Array [
"install-strategy",
"json",
"key",
"legacy-bundling",
"legacy-peer-deps",
"link",
"local-address",
Expand Down Expand Up @@ -2280,6 +2304,7 @@ Array [
"git-tag-version",
"global",
"globalconfig",
"global-style",
"heading",
"https-proxy",
"if-present",
Expand All @@ -2291,6 +2316,7 @@ Array [
"install-strategy",
"json",
"key",
"legacy-bundling",
"legacy-peer-deps",
"local-address",
"location",
Expand Down Expand Up @@ -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 <hoisted|nested|shallow>]
[--legacy-bundling] [--global-style]
[--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]]
[--strict-peer-deps] [--no-package-lock] [--foreground-scripts]
[--ignore-scripts] [--no-audit] [--no-bin-links] [--no-fund] [--dry-run]
Expand All @@ -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\`
Expand Down Expand Up @@ -2672,9 +2701,10 @@ Usage:
npm dedupe
Options:
[--install-strategy <hoisted|nested|shallow>] [--strict-peer-deps]
[--no-package-lock] [--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]]
[--ignore-scripts] [--no-audit] [--no-bin-links] [--no-fund] [--dry-run]
[--install-strategy <hoisted|nested|shallow>] [--legacy-bundling]
[--global-style] [--strict-peer-deps] [--no-package-lock]
[--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]] [--ignore-scripts]
[--no-audit] [--no-bin-links] [--no-fund] [--dry-run]
[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
[-ws|--workspaces] [--include-workspace-root] [--no-install-links]
Expand All @@ -2689,6 +2719,8 @@ alias: ddp
\`\`\`
#### \`install-strategy\`
#### \`legacy-bundling\`
#### \`global-style\`
#### \`strict-peer-deps\`
#### \`package-lock\`
#### \`omit\`
Expand Down Expand Up @@ -2932,9 +2964,10 @@ Usage:
npm find-dupes
Options:
[--install-strategy <hoisted|nested|shallow>] [--strict-peer-deps]
[--no-package-lock] [--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]]
[--ignore-scripts] [--no-audit] [--no-bin-links] [--no-fund]
[--install-strategy <hoisted|nested|shallow>] [--legacy-bundling]
[--global-style] [--strict-peer-deps] [--no-package-lock]
[--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]] [--ignore-scripts]
[--no-audit] [--no-bin-links] [--no-fund]
[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
[-ws|--workspaces] [--include-workspace-root] [--no-install-links]
Expand All @@ -2945,6 +2978,8 @@ npm find-dupes
\`\`\`
#### \`install-strategy\`
#### \`legacy-bundling\`
#### \`global-style\`
#### \`strict-peer-deps\`
#### \`package-lock\`
#### \`omit\`
Expand Down Expand Up @@ -3103,6 +3138,7 @@ npm install [<package-spec> ...]
Options:
[-S|--save|--no-save|--save-prod|--save-dev|--save-optional|--save-peer|--save-bundle]
[-E|--save-exact] [-g|--global] [--install-strategy <hoisted|nested|shallow>]
[--legacy-bundling] [--global-style]
[--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]]
[--strict-peer-deps] [--no-package-lock] [--foreground-scripts]
[--ignore-scripts] [--no-audit] [--no-bin-links] [--no-fund] [--dry-run]
Expand All @@ -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\`
Expand All @@ -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 <hoisted|nested|shallow>]
[--legacy-bundling] [--global-style]
[--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]]
[--strict-peer-deps] [--no-package-lock] [--foreground-scripts]
[--ignore-scripts] [--no-audit] [--no-bin-links] [--no-fund] [--dry-run]
Expand All @@ -3167,6 +3206,8 @@ alias: cit
#### \`save-exact\`
#### \`global\`
#### \`install-strategy\`
#### \`legacy-bundling\`
#### \`global-style\`
#### \`omit\`
#### \`strict-peer-deps\`
#### \`package-lock\`
Expand All @@ -3191,6 +3232,7 @@ npm install-test [<package-spec> ...]
Options:
[-S|--save|--no-save|--save-prod|--save-dev|--save-optional|--save-peer|--save-bundle]
[-E|--save-exact] [-g|--global] [--install-strategy <hoisted|nested|shallow>]
[--legacy-bundling] [--global-style]
[--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]]
[--strict-peer-deps] [--no-package-lock] [--foreground-scripts]
[--ignore-scripts] [--no-audit] [--no-bin-links] [--no-fund] [--dry-run]
Expand All @@ -3211,6 +3253,8 @@ alias: it
#### \`save-exact\`
#### \`global\`
#### \`install-strategy\`
#### \`legacy-bundling\`
#### \`global-style\`
#### \`omit\`
#### \`strict-peer-deps\`
#### \`package-lock\`
Expand All @@ -3235,7 +3279,7 @@ npm link [<package-spec>]
Options:
[-S|--save|--no-save|--save-prod|--save-dev|--save-optional|--save-peer|--save-bundle]
[-E|--save-exact] [-g|--global] [--install-strategy <hoisted|nested|shallow>]
[--strict-peer-deps] [--no-package-lock]
[--legacy-bundling] [--global-style] [--strict-peer-deps] [--no-package-lock]
[--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]] [--ignore-scripts]
[--no-audit] [--no-bin-links] [--no-fund] [--dry-run]
[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
Expand All @@ -3255,6 +3299,8 @@ alias: ln
#### \`save-exact\`
#### \`global\`
#### \`install-strategy\`
#### \`legacy-bundling\`
#### \`global-style\`
#### \`strict-peer-deps\`
#### \`package-lock\`
#### \`omit\`
Expand Down Expand Up @@ -4105,8 +4151,8 @@ npm update [<pkg>...]
Options:
[-S|--save|--no-save|--save-prod|--save-dev|--save-optional|--save-peer|--save-bundle]
[-g|--global] [--install-strategy <hoisted|nested|shallow>]
[--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]]
[-g|--global] [--install-strategy <hoisted|nested|shallow>] [--legacy-bundling]
[--global-style] [--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]]
[--strict-peer-deps] [--no-package-lock] [--foreground-scripts]
[--ignore-scripts] [--no-audit] [--no-bin-links] [--no-fund] [--dry-run]
[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
Expand All @@ -4125,6 +4171,8 @@ aliases: up, upgrade, udpate
#### \`save\`
#### \`global\`
#### \`install-strategy\`
#### \`legacy-bundling\`
#### \`global-style\`
#### \`omit\`
#### \`strict-peer-deps\`
#### \`package-lock\`
Expand Down
16 changes: 16 additions & 0 deletions test/lib/utils/config/definitions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
})

0 comments on commit 78396f1

Please sign in to comment.