From 6d82835b311bee861ef8e428f21885eb04d99938 Mon Sep 17 00:00:00 2001 From: Nathan Fritz Date: Tue, 18 Oct 2022 00:45:32 -0700 Subject: [PATCH 1/3] feat: add --install-strategy config, replace --global-style with "shallow" style BREAKING CHANGE: remove --global-style, --global now sets --install-strategy=shallow --- lib/commands/dedupe.js | 2 +- lib/commands/find-dupes.js | 2 +- lib/commands/install.js | 2 +- lib/commands/link.js | 2 +- lib/commands/update.js | 2 +- lib/utils/config/definitions.js | 33 ++++++++++--------- .../arborist/lib/arborist/build-ideal-tree.js | 8 ++--- workspaces/arborist/lib/arborist/index.js | 1 + workspaces/arborist/lib/place-dep.js | 8 ++--- .../test/arborist/build-ideal-tree.js | 6 ++-- workspaces/arborist/test/arborist/index.js | 10 +++++- workspaces/arborist/test/arborist/reify.js | 2 +- workspaces/arborist/test/place-dep.js | 8 ++--- 13 files changed, 48 insertions(+), 38 deletions(-) diff --git a/lib/commands/dedupe.js b/lib/commands/dedupe.js index 2cc44b2a9fb2f..25239c59c3df9 100644 --- a/lib/commands/dedupe.js +++ b/lib/commands/dedupe.js @@ -8,7 +8,7 @@ class Dedupe extends ArboristWorkspaceCmd { static description = 'Reduce duplication in the package tree' static name = 'dedupe' static params = [ - 'global-style', + 'install-strategy', 'legacy-bundling', 'strict-peer-deps', 'package-lock', diff --git a/lib/commands/find-dupes.js b/lib/commands/find-dupes.js index a9de2410ec0d7..388385f08ba94 100644 --- a/lib/commands/find-dupes.js +++ b/lib/commands/find-dupes.js @@ -5,7 +5,7 @@ class FindDupes extends ArboristWorkspaceCmd { static description = 'Find duplication in the package tree' static name = 'find-dupes' static params = [ - 'global-style', + 'install-strategy', 'legacy-bundling', 'strict-peer-deps', 'package-lock', diff --git a/lib/commands/install.js b/lib/commands/install.js index ecc0727a2ef7c..6918bf6ccbedf 100644 --- a/lib/commands/install.js +++ b/lib/commands/install.js @@ -20,7 +20,7 @@ class Install extends ArboristWorkspaceCmd { 'save', 'save-exact', 'global', - 'global-style', + 'install-strategy', 'legacy-bundling', 'omit', 'strict-peer-deps', diff --git a/lib/commands/link.js b/lib/commands/link.js index c9169edc9e5c3..053215a889c75 100644 --- a/lib/commands/link.js +++ b/lib/commands/link.js @@ -22,7 +22,7 @@ class Link extends ArboristWorkspaceCmd { 'save', 'save-exact', 'global', - 'global-style', + 'install-strategy', 'legacy-bundling', 'strict-peer-deps', 'package-lock', diff --git a/lib/commands/update.js b/lib/commands/update.js index ca80d61537e70..9e1fa2a36c345 100644 --- a/lib/commands/update.js +++ b/lib/commands/update.js @@ -14,7 +14,7 @@ class Update extends ArboristWorkspaceCmd { static params = [ 'save', 'global', - 'global-style', + 'install-strategy', 'legacy-bundling', 'omit', 'strict-peer-deps', diff --git a/lib/utils/config/definitions.js b/lib/utils/config/definitions.js index c9d76249c7b1e..afab37e612f4d 100644 --- a/lib/utils/config/definitions.js +++ b/lib/utils/config/definitions.js @@ -823,20 +823,6 @@ define('global', { }, }) -define('global-style', { - default: false, - type: Boolean, - description: ` - Causes npm to install the package into your local \`node_modules\` folder - with the same layout it uses with the global \`node_modules\` folder. - Only your direct dependencies will show in \`node_modules\` and - everything they depend on will be flattened in their \`node_modules\` - folders. This obviously will eliminate some deduping. If used with - \`legacy-bundling\`, \`legacy-bundling\` will be preferred. - `, - flatten, -}) - // the globalconfig has its default defined outside of this module define('globalconfig', { type: path, @@ -1076,6 +1062,21 @@ define('install-links', { flatten, }) +define('install-strategy', { + default: 'hoisted', + type: ['hoisted', 'nested', 'shallow'], + description: ` + Sets the strategy for installing packages in node_modules. + hoisted (default): Install non-duplicated in top-level, and duplicated as + necessary within directory structure. + nested: (formerly --legacy-bundling) install in place, no hoisting. + shallow (formerly --global-style) only install direct deps at top-level. + linked: (coming soon) install in node_modules/.store, link in place, + unhoisted. + `, + flatten, +}) + define('json', { default: false, type: Boolean, @@ -1523,8 +1524,8 @@ define('prefix', { short: 'C', default: '', defaultDescription: ` - In global mode, the folder where the node executable is installed. In - local mode, the nearest parent folder containing either a package.json + In global mode, the folder where the node executable is installed. + Otherwise, the nearest parent folder containing either a package.json file or a node_modules folder. `, description: ` diff --git a/workspaces/arborist/lib/arborist/build-ideal-tree.js b/workspaces/arborist/lib/arborist/build-ideal-tree.js index 4caf310d40d7e..210c02a5fa11d 100644 --- a/workspaces/arborist/lib/arborist/build-ideal-tree.js +++ b/workspaces/arborist/lib/arborist/build-ideal-tree.js @@ -79,7 +79,7 @@ const _loadFailures = Symbol('loadFailures') const _pruneFailedOptional = Symbol('pruneFailedOptional') const _linkNodes = Symbol('linkNodes') const _follow = Symbol('follow') -const _globalStyle = Symbol('globalStyle') +const _installStrategy = Symbol('installStrategy') const _globalRootNode = Symbol('globalRootNode') const _usePackageLock = Symbol.for('usePackageLock') const _rpcache = Symbol.for('realpathCache') @@ -114,7 +114,7 @@ module.exports = cls => class IdealTreeBuilder extends cls { follow = false, force = false, global = false, - globalStyle = false, + installStrategy = 'hoisted', idealTree = null, includeWorkspaceRoot = false, installLinks = false, @@ -134,7 +134,7 @@ module.exports = cls => class IdealTreeBuilder extends cls { this[_usePackageLock] = packageLock this[_global] = !!global - this[_globalStyle] = this[_global] || globalStyle + this[_installStrategy] = global ? 'shallow' : installStrategy this[_follow] = !!follow if (this[_workspaces].length && this[_global]) { @@ -956,7 +956,7 @@ This is a one-time fix-up, please be patient... strictPeerDeps: this[_strictPeerDeps], installLinks: this.installLinks, legacyPeerDeps: this.legacyPeerDeps, - globalStyle: this[_globalStyle], + installStrategy: this[_installStrategy], })) const promises = [] diff --git a/workspaces/arborist/lib/arborist/index.js b/workspaces/arborist/lib/arborist/index.js index 6bffd843186ea..091e0b46574cc 100644 --- a/workspaces/arborist/lib/arborist/index.js +++ b/workspaces/arborist/lib/arborist/index.js @@ -76,6 +76,7 @@ class Arborist extends Base { workspacesEnabled: options.workspacesEnabled !== false, replaceRegistryHost: options.replaceRegistryHost, lockfileVersion: lockfileVersion(options.lockfileVersion), + installStrategy: options.global ? 'shallow' : (options.installStrategy ? options.installStrategy : 'hoisted'), } this.replaceRegistryHost = this.options.replaceRegistryHost = (!this.options.replaceRegistryHost || this.options.replaceRegistryHost === 'npmjs') ? diff --git a/workspaces/arborist/lib/place-dep.js b/workspaces/arborist/lib/place-dep.js index 9d84d3f1b08a5..98ab770c370f0 100644 --- a/workspaces/arborist/lib/place-dep.js +++ b/workspaces/arborist/lib/place-dep.js @@ -47,7 +47,7 @@ class PlaceDep { strictPeerDeps, installLinks, legacyPeerDeps, - globalStyle, + installStrategy, } = parent || options Object.assign(this, { preferDedupe, @@ -58,8 +58,8 @@ class PlaceDep { legacyBundling, strictPeerDeps, installLinks, + installStrategy, legacyPeerDeps, - globalStyle, }) this.children = [] @@ -78,10 +78,10 @@ class PlaceDep { edge, dep, preferDedupe, - globalStyle, legacyBundling, explicitRequest, updateNames, + installStrategy, checks, } = this @@ -176,7 +176,7 @@ class PlaceDep { // when installing globally, or just in global style, we never place // deps above the first level. - if (globalStyle) { + if (installStrategy === 'shallow') { const rp = target.resolveParent if (rp && rp.isProjectRoot) { break diff --git a/workspaces/arborist/test/arborist/build-ideal-tree.js b/workspaces/arborist/test/arborist/build-ideal-tree.js index 15378964b3eca..99edc83e9e008 100644 --- a/workspaces/arborist/test/arborist/build-ideal-tree.js +++ b/workspaces/arborist/test/arborist/build-ideal-tree.js @@ -607,7 +607,7 @@ t.test('link dep within node_modules and outside root', t => { }) t.test('global style', t => t.resolveMatchSnapshot(printIdeal(t.testdir(), { - globalStyle: true, + installStrategy: 'shallow', add: ['rimraf'], }))) @@ -1136,7 +1136,7 @@ t.test('resolve links in global mode', async t => { t.test('dont get confused if root matches duped metadep', async t => { const path = resolve(fixtures, 'test-root-matches-metadep') - const arb = new Arborist({ path, ...OPT }) + const arb = new Arborist({ path, installStrategy: 'hoisted', ...OPT }) const tree = await arb.buildIdealTree() t.matchSnapshot(printTree(tree)) }) @@ -2154,7 +2154,7 @@ t.test('properly assign fsParent when paths have .. in them', async t => { } }) -t.test('update global', async t => { +t.only('update global', async t => { // global root // ├─┬ @isaacs/testing-dev-optional-flags@1.0.0 // │ ├── own-or@1.0.0 diff --git a/workspaces/arborist/test/arborist/index.js b/workspaces/arborist/test/arborist/index.js index 7f69eb36ef74f..88da04b94ffed 100644 --- a/workspaces/arborist/test/arborist/index.js +++ b/workspaces/arborist/test/arborist/index.js @@ -213,7 +213,7 @@ t.test('excludeSet includes nonworkspace metadeps', async t => { spec: 'file:pkgs/b', }) - const arb = new Arborist() + const arb = new Arborist({}) const filter = arb.excludeWorkspacesDependencySet(tree) t.equal(filter.size, 3) @@ -245,3 +245,11 @@ t.test('valid replaceRegistryHost values', t => { t.equal(new Arborist({ replaceRegistryHost: 'never' }).options.replaceRegistryHost, 'never') t.end() }) + +t.test('valid global/installStrategy values', t => { + t.equal(new Arborist({ global: true }).options.installStrategy, 'shallow') + t.equal(new Arborist({ global: false }).options.installStrategy, 'hoisted') + t.equal(new Arborist({}).options.installStrategy, 'hoisted') + t.equal(new Arborist({ installStrategy: 'hoisted' }).options.installStrategy, 'hoisted') + t.end() +}) diff --git a/workspaces/arborist/test/arborist/reify.js b/workspaces/arborist/test/arborist/reify.js index 399031abbcfec..bae6280d57c5a 100644 --- a/workspaces/arborist/test/arborist/reify.js +++ b/workspaces/arborist/test/arborist/reify.js @@ -1116,7 +1116,7 @@ t.test('global style', t => { const rbinPart = '.bin/rimraf' + (process.platform === 'win32' ? '.cmd' : '') const rbin = resolve(nm, rbinPart) - return reify(path, { add: ['rimraf@2'], globalStyle: true }) + return reify(path, { add: ['rimraf@2'], installStrategy: 'shallow' }) .then(() => fs.statSync(rbin)) .then(() => t.strictSame(fs.readdirSync(nm).sort(), ['.bin', '.package-lock.json', 'rimraf'])) }) diff --git a/workspaces/arborist/test/place-dep.js b/workspaces/arborist/test/place-dep.js index 418d22884ca17..cf222825e9d16 100644 --- a/workspaces/arborist/test/place-dep.js +++ b/workspaces/arborist/test/place-dep.js @@ -46,7 +46,7 @@ t.test('placement tests', t => { // --legacy-peer-deps set? legacyPeerDeps = false, // installing with --global or --global-style? - globalStyle = false, + installStrategy = 'hoisted', } = options const node = tree.inventory.get(nodeLoc) @@ -83,7 +83,7 @@ t.test('placement tests', t => { legacyBundling, strictPeerDeps, legacyPeerDeps, - globalStyle, + installStrategy, }) } @@ -291,7 +291,7 @@ t.test('placement tests', t => { }), dep: new Node({ pkg: { name: 'bar', version: '1.0.0' } }), nodeLoc: 'node_modules/foo', - globalStyle: true, + installStrategy: 'shallow', test: (t, tree) => { const foobar = tree.children.get('foo').resolve('bar') t.equal(foobar.location, 'node_modules/foo/node_modules/bar') @@ -323,7 +323,7 @@ t.test('placement tests', t => { }), dep: new Node({ pkg: { name: 'baz', version: '1.0.0' } }), nodeLoc: 'node_modules/foo/node_modules/bar', - globalStyle: true, + installStrategy: 'shallow', test: (t, tree) => { const foobar = tree.children.get('foo').resolve('bar') const foobarbaz = foobar.resolve('baz') From d79c016216256cf5834630e33ba3f7de2ec5c907 Mon Sep 17 00:00:00 2001 From: Nathan Fritz Date: Tue, 18 Oct 2022 01:18:40 -0700 Subject: [PATCH 2/3] feat: replace --legacy-bundling with --install-strategy=nested BREAKING CHANGE: removed --legacy-bundling config --- lib/commands/dedupe.js | 1 - lib/commands/find-dupes.js | 1 - lib/commands/install.js | 1 - lib/commands/link.js | 1 - lib/commands/update.js | 1 - lib/utils/config/definitions.js | 12 --- .../tap-snapshots/test/index.js.test.cjs | 2 +- .../test/lib/commands/config.js.test.cjs | 6 +- tap-snapshots/test/lib/docs.js.test.cjs | 92 ++++++++----------- .../arborist/lib/arborist/build-ideal-tree.js | 4 - workspaces/arborist/lib/place-dep.js | 7 +- .../test/arborist/build-ideal-tree.js | 4 +- workspaces/arborist/test/arborist/reify.js | 22 ++--- workspaces/arborist/test/place-dep.js | 5 +- 14 files changed, 55 insertions(+), 104 deletions(-) diff --git a/lib/commands/dedupe.js b/lib/commands/dedupe.js index 25239c59c3df9..40974eea16b94 100644 --- a/lib/commands/dedupe.js +++ b/lib/commands/dedupe.js @@ -9,7 +9,6 @@ class Dedupe extends ArboristWorkspaceCmd { static name = 'dedupe' static params = [ 'install-strategy', - 'legacy-bundling', 'strict-peer-deps', 'package-lock', 'omit', diff --git a/lib/commands/find-dupes.js b/lib/commands/find-dupes.js index 388385f08ba94..dad8be86ad07e 100644 --- a/lib/commands/find-dupes.js +++ b/lib/commands/find-dupes.js @@ -6,7 +6,6 @@ class FindDupes extends ArboristWorkspaceCmd { static name = 'find-dupes' static params = [ 'install-strategy', - 'legacy-bundling', 'strict-peer-deps', 'package-lock', 'omit', diff --git a/lib/commands/install.js b/lib/commands/install.js index 6918bf6ccbedf..41e23f8638061 100644 --- a/lib/commands/install.js +++ b/lib/commands/install.js @@ -21,7 +21,6 @@ class Install extends ArboristWorkspaceCmd { 'save-exact', 'global', 'install-strategy', - 'legacy-bundling', 'omit', 'strict-peer-deps', 'package-lock', diff --git a/lib/commands/link.js b/lib/commands/link.js index 053215a889c75..df08b87c6c937 100644 --- a/lib/commands/link.js +++ b/lib/commands/link.js @@ -23,7 +23,6 @@ class Link extends ArboristWorkspaceCmd { 'save-exact', 'global', 'install-strategy', - 'legacy-bundling', 'strict-peer-deps', 'package-lock', 'omit', diff --git a/lib/commands/update.js b/lib/commands/update.js index 9e1fa2a36c345..818f1f18cfb62 100644 --- a/lib/commands/update.js +++ b/lib/commands/update.js @@ -15,7 +15,6 @@ class Update extends ArboristWorkspaceCmd { 'save', 'global', 'install-strategy', - 'legacy-bundling', 'omit', 'strict-peer-deps', 'package-lock', diff --git a/lib/utils/config/definitions.js b/lib/utils/config/definitions.js index afab37e612f4d..ebc4092a5f6e8 100644 --- a/lib/utils/config/definitions.js +++ b/lib/utils/config/definitions.js @@ -1108,18 +1108,6 @@ define('key', { flatten, }) -define('legacy-bundling', { - default: false, - type: Boolean, - description: ` - Causes npm to install the package such that versions of npm prior to 1.4, - such as the one included with node 0.8, can install the package. This - eliminates all automatic deduping. If used with \`global-style\` this - option will be preferred. - `, - flatten, -}) - define('legacy-peer-deps', { default: false, type: Boolean, diff --git a/smoke-tests/tap-snapshots/test/index.js.test.cjs b/smoke-tests/tap-snapshots/test/index.js.test.cjs index 5a08980433547..e4b8fa53f14e0 100644 --- a/smoke-tests/tap-snapshots/test/index.js.test.cjs +++ b/smoke-tests/tap-snapshots/test/index.js.test.cjs @@ -56,7 +56,7 @@ npm ERR! npm ci 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] [--global-style] [--legacy-bundling] +npm ERR! [-E|--save-exact] [-g|--global] [--install-strategy ] npm ERR! [--omit [--omit ...]] npm ERR! [--strict-peer-deps] [--no-package-lock] [--foreground-scripts] npm ERR! [--ignore-scripts] [--no-audit] [--no-bin-links] [--no-fund] [--dry-run] diff --git a/tap-snapshots/test/lib/commands/config.js.test.cjs b/tap-snapshots/test/lib/commands/config.js.test.cjs index 9f7b31d7a94b9..83e137b1b6a76 100644 --- a/tap-snapshots/test/lib/commands/config.js.test.cjs +++ b/tap-snapshots/test/lib/commands/config.js.test.cjs @@ -60,7 +60,6 @@ exports[`test/lib/commands/config.js TAP config list --json > output matches sna "git": "git", "git-tag-version": true, "global": false, - "global-style": false, "globalconfig": "{GLOBALPREFIX}/npmrc", "heading": "npm", "https-proxy": null, @@ -82,8 +81,8 @@ exports[`test/lib/commands/config.js TAP config list --json > output matches sna "init.module": "{HOME}/.npm-init.js", "init.version": "1.0.0", "install-links": true, + "install-strategy": "hoisted", "key": null, - "legacy-bundling": false, "legacy-peer-deps": false, "link": false, "local-address": null, @@ -212,7 +211,6 @@ fund = true git = "git" git-tag-version = true global = false -global-style = false globalconfig = "{GLOBALPREFIX}/npmrc" heading = "npm" https-proxy = null @@ -234,9 +232,9 @@ init.license = "ISC" init.module = "{HOME}/.npm-init.js" init.version = "1.0.0" 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 81be4ec21dd49..e846449169c02 100644 --- a/tap-snapshots/test/lib/docs.js.test.cjs +++ b/tap-snapshots/test/lib/docs.js.test.cjs @@ -1034,18 +1034,6 @@ folder instead of the current working directory. See * bin files are linked to \`{prefix}/bin\` * man pages are linked to \`{prefix}/share/man\` -#### \`global-style\` - -* Default: false -* Type: Boolean - -Causes npm to install the package into your local \`node_modules\` folder with -the same layout it uses with the global \`node_modules\` folder. Only your -direct dependencies will show in \`node_modules\` and everything they depend -on will be flattened in their \`node_modules\` folders. This obviously will -eliminate some deduping. If used with \`legacy-bundling\`, \`legacy-bundling\` -will be preferred. - #### \`globalconfig\` * Default: The global --prefix setting plus 'etc/npmrc'. For example, @@ -1188,6 +1176,18 @@ When set file: protocol dependencies will be packed and installed as regular dependencies instead of creating a symlink. This option has no effect on workspaces. +#### \`install-strategy\` + +* Default: "hoisted" +* Type: "hoisted", "nested", or "shallow" + +Sets the strategy for installing packages in node_modules. hoisted +(default): Install non-duplicated in top-level, and duplicated as necessary +within directory structure. nested: (formerly --legacy-bundling) install in +place, no hoisting. shallow (formerly --global-style) only install direct +deps at top-level. linked: (coming soon) install in node_modules/.store, +link in place, unhoisted. + #### \`json\` * Default: false @@ -1215,16 +1215,6 @@ key="-----BEGIN PRIVATE KEY-----\\nXXXX\\nXXXX\\n-----END PRIVATE KEY-----" It is _not_ the path to a key file, though you can set a registry-scoped "keyfile" path like "//other-registry.tld/:keyfile=/path/to/key.pem". -#### \`legacy-bundling\` - -* Default: false -* Type: Boolean - -Causes npm to install the package such that versions of npm prior to 1.4, -such as the one included with node 0.8, can install the package. This -eliminates all automatic deduping. If used with \`global-style\` this option -will be preferred. - #### \`legacy-peer-deps\` * Default: false @@ -1483,8 +1473,8 @@ look for updates immediately even for fresh package data. #### \`prefix\` * Default: In global mode, the folder where the node executable is installed. - In local mode, the nearest parent folder containing either a package.json - file or a node_modules folder. + Otherwise, the nearest parent folder containing either a package.json file + or a node_modules folder. * Type: Path The location to install global items. If set on the command line, then it @@ -2139,7 +2129,6 @@ Array [ "git", "git-tag-version", "global", - "global-style", "globalconfig", "heading", "https-proxy", @@ -2161,9 +2150,9 @@ Array [ "init.module", "init.version", "install-links", + "install-strategy", "json", "key", - "legacy-bundling", "legacy-peer-deps", "link", "local-address", @@ -2290,7 +2279,6 @@ Array [ "git", "git-tag-version", "global", - "global-style", "globalconfig", "heading", "https-proxy", @@ -2300,9 +2288,9 @@ Array [ "include-staged", "include-workspace-root", "install-links", + "install-strategy", "json", "key", - "legacy-bundling", "legacy-peer-deps", "local-address", "location", @@ -2589,7 +2577,7 @@ npm ci Options: [-S|--save|--no-save|--save-prod|--save-dev|--save-optional|--save-peer|--save-bundle] -[-E|--save-exact] [-g|--global] [--global-style] [--legacy-bundling] +[-E|--save-exact] [-g|--global] [--install-strategy ] [--omit [--omit ...]] [--strict-peer-deps] [--no-package-lock] [--foreground-scripts] [--ignore-scripts] [--no-audit] [--no-bin-links] [--no-fund] [--dry-run] @@ -2609,8 +2597,7 @@ aliases: clean-install, ic, install-clean, isntall-clean #### \`save\` #### \`save-exact\` #### \`global\` -#### \`global-style\` -#### \`legacy-bundling\` +#### \`install-strategy\` #### \`omit\` #### \`strict-peer-deps\` #### \`package-lock\` @@ -2685,9 +2672,9 @@ Usage: npm dedupe Options: -[--global-style] [--legacy-bundling] [--strict-peer-deps] [--no-package-lock] -[--omit [--omit ...]] [--ignore-scripts] -[--no-audit] [--no-bin-links] [--no-fund] [--dry-run] +[--install-strategy ] [--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] @@ -2701,8 +2688,7 @@ npm dedupe alias: ddp \`\`\` -#### \`global-style\` -#### \`legacy-bundling\` +#### \`install-strategy\` #### \`strict-peer-deps\` #### \`package-lock\` #### \`omit\` @@ -2946,9 +2932,9 @@ Usage: npm find-dupes Options: -[--global-style] [--legacy-bundling] [--strict-peer-deps] [--no-package-lock] -[--omit [--omit ...]] [--ignore-scripts] -[--no-audit] [--no-bin-links] [--no-fund] +[--install-strategy ] [--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] @@ -2958,8 +2944,7 @@ Run "npm help find-dupes" for more info npm find-dupes \`\`\` -#### \`global-style\` -#### \`legacy-bundling\` +#### \`install-strategy\` #### \`strict-peer-deps\` #### \`package-lock\` #### \`omit\` @@ -3117,7 +3102,7 @@ npm install [ ...] Options: [-S|--save|--no-save|--save-prod|--save-dev|--save-optional|--save-peer|--save-bundle] -[-E|--save-exact] [-g|--global] [--global-style] [--legacy-bundling] +[-E|--save-exact] [-g|--global] [--install-strategy ] [--omit [--omit ...]] [--strict-peer-deps] [--no-package-lock] [--foreground-scripts] [--ignore-scripts] [--no-audit] [--no-bin-links] [--no-fund] [--dry-run] @@ -3137,8 +3122,7 @@ aliases: add, i, in, ins, inst, insta, instal, isnt, isnta, isntal, isntall #### \`save\` #### \`save-exact\` #### \`global\` -#### \`global-style\` -#### \`legacy-bundling\` +#### \`install-strategy\` #### \`omit\` #### \`strict-peer-deps\` #### \`package-lock\` @@ -3162,7 +3146,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] [--global-style] [--legacy-bundling] +[-E|--save-exact] [-g|--global] [--install-strategy ] [--omit [--omit ...]] [--strict-peer-deps] [--no-package-lock] [--foreground-scripts] [--ignore-scripts] [--no-audit] [--no-bin-links] [--no-fund] [--dry-run] @@ -3182,8 +3166,7 @@ alias: cit #### \`save\` #### \`save-exact\` #### \`global\` -#### \`global-style\` -#### \`legacy-bundling\` +#### \`install-strategy\` #### \`omit\` #### \`strict-peer-deps\` #### \`package-lock\` @@ -3207,7 +3190,7 @@ npm install-test [ ...] Options: [-S|--save|--no-save|--save-prod|--save-dev|--save-optional|--save-peer|--save-bundle] -[-E|--save-exact] [-g|--global] [--global-style] [--legacy-bundling] +[-E|--save-exact] [-g|--global] [--install-strategy ] [--omit [--omit ...]] [--strict-peer-deps] [--no-package-lock] [--foreground-scripts] [--ignore-scripts] [--no-audit] [--no-bin-links] [--no-fund] [--dry-run] @@ -3227,8 +3210,7 @@ alias: it #### \`save\` #### \`save-exact\` #### \`global\` -#### \`global-style\` -#### \`legacy-bundling\` +#### \`install-strategy\` #### \`omit\` #### \`strict-peer-deps\` #### \`package-lock\` @@ -3252,7 +3234,7 @@ npm link [] Options: [-S|--save|--no-save|--save-prod|--save-dev|--save-optional|--save-peer|--save-bundle] -[-E|--save-exact] [-g|--global] [--global-style] [--legacy-bundling] +[-E|--save-exact] [-g|--global] [--install-strategy ] [--strict-peer-deps] [--no-package-lock] [--omit [--omit ...]] [--ignore-scripts] [--no-audit] [--no-bin-links] [--no-fund] [--dry-run] @@ -3272,8 +3254,7 @@ alias: ln #### \`save\` #### \`save-exact\` #### \`global\` -#### \`global-style\` -#### \`legacy-bundling\` +#### \`install-strategy\` #### \`strict-peer-deps\` #### \`package-lock\` #### \`omit\` @@ -4124,7 +4105,7 @@ npm update [...] Options: [-S|--save|--no-save|--save-prod|--save-dev|--save-optional|--save-peer|--save-bundle] -[-g|--global] [--global-style] [--legacy-bundling] +[-g|--global] [--install-strategy ] [--omit [--omit ...]] [--strict-peer-deps] [--no-package-lock] [--foreground-scripts] [--ignore-scripts] [--no-audit] [--no-bin-links] [--no-fund] [--dry-run] @@ -4143,8 +4124,7 @@ aliases: up, upgrade, udpate #### \`save\` #### \`global\` -#### \`global-style\` -#### \`legacy-bundling\` +#### \`install-strategy\` #### \`omit\` #### \`strict-peer-deps\` #### \`package-lock\` diff --git a/workspaces/arborist/lib/arborist/build-ideal-tree.js b/workspaces/arborist/lib/arborist/build-ideal-tree.js index 210c02a5fa11d..fd4f6789ec763 100644 --- a/workspaces/arborist/lib/arborist/build-ideal-tree.js +++ b/workspaces/arborist/lib/arborist/build-ideal-tree.js @@ -48,7 +48,6 @@ const _flagsSuspect = Symbol.for('flagsSuspect') const _workspaces = Symbol.for('workspaces') const _prune = Symbol('prune') const _preferDedupe = Symbol('preferDedupe') -const _legacyBundling = Symbol('legacyBundling') const _parseSettings = Symbol('parseSettings') const _initTree = Symbol('initTree') const _applyUserRequests = Symbol('applyUserRequests') @@ -143,7 +142,6 @@ module.exports = cls => class IdealTreeBuilder extends cls { this[_explicitRequests] = new Set() this[_preferDedupe] = false - this[_legacyBundling] = false this[_depsSeen] = new Set() this[_depsQueue] = [] this[_currentDep] = null @@ -252,7 +250,6 @@ module.exports = cls => class IdealTreeBuilder extends cls { this[_complete] = !!options.complete this[_preferDedupe] = !!options.preferDedupe - this[_legacyBundling] = !!options.legacyBundling // validates list of update names, they must // be dep names only, no semver ranges are supported @@ -952,7 +949,6 @@ This is a one-time fix-up, please be patient... auditReport: this.auditReport, force: this[_force], preferDedupe: this[_preferDedupe], - legacyBundling: this[_legacyBundling], strictPeerDeps: this[_strictPeerDeps], installLinks: this.installLinks, legacyPeerDeps: this.legacyPeerDeps, diff --git a/workspaces/arborist/lib/place-dep.js b/workspaces/arborist/lib/place-dep.js index 98ab770c370f0..2e37e35f6014b 100644 --- a/workspaces/arborist/lib/place-dep.js +++ b/workspaces/arborist/lib/place-dep.js @@ -43,7 +43,6 @@ class PlaceDep { explicitRequest, updateNames, auditReport, - legacyBundling, strictPeerDeps, installLinks, legacyPeerDeps, @@ -55,7 +54,6 @@ class PlaceDep { explicitRequest, updateNames, auditReport, - legacyBundling, strictPeerDeps, installLinks, installStrategy, @@ -78,7 +76,6 @@ class PlaceDep { edge, dep, preferDedupe, - legacyBundling, explicitRequest, updateNames, installStrategy, @@ -170,7 +167,7 @@ class PlaceDep { // nest packages like npm v1 and v2 // very disk-inefficient - if (legacyBundling) { + if (installStrategy === 'nested') { break } @@ -463,7 +460,7 @@ class PlaceDep { // prune all the nodes in a branch of the tree that can be safely removed // This is only the most basic duplication detection; it finds if there // is another satisfying node further up the tree, and if so, dedupes. - // Even in legacyBundling mode, we do this amount of deduplication. + // Even in installStategy is nested, we do this amount of deduplication. pruneDedupable (node, descend = true) { if (node.canDedupe(this.preferDedupe)) { // gather up all deps that have no valid edges in from outside diff --git a/workspaces/arborist/test/arborist/build-ideal-tree.js b/workspaces/arborist/test/arborist/build-ideal-tree.js index 99edc83e9e008..10a291065dfc2 100644 --- a/workspaces/arborist/test/arborist/build-ideal-tree.js +++ b/workspaces/arborist/test/arborist/build-ideal-tree.js @@ -364,7 +364,7 @@ t.test('dedupe example - deduped because preferDedupe=true', t => { t.test('dedupe example - nested because legacyBundling=true', t => { const path = resolve(fixtures, 'dedupe-tests') return t.resolveMatchSnapshot(printIdeal(path, { - legacyBundling: true, + installStrategy: 'nested', preferDedupe: true, })) }) @@ -2154,7 +2154,7 @@ t.test('properly assign fsParent when paths have .. in them', async t => { } }) -t.only('update global', async t => { +t.test('update global', async t => { // global root // ├─┬ @isaacs/testing-dev-optional-flags@1.0.0 // │ ├── own-or@1.0.0 diff --git a/workspaces/arborist/test/arborist/reify.js b/workspaces/arborist/test/arborist/reify.js index bae6280d57c5a..7fa32a250a389 100644 --- a/workspaces/arborist/test/arborist/reify.js +++ b/workspaces/arborist/test/arborist/reify.js @@ -509,7 +509,7 @@ t.test('update a child of a node with bundled deps', t => { const path = fixture(t, 'testing-bundledeps-legacy-bundling') return t.resolveMatchSnapshot(printReified(path, { update: ['@isaacs/testing-bundledeps-c'], - legacyBundling: true, + installStrategy: 'nested', })) }) @@ -598,7 +598,7 @@ t.test('warn on reifying deprecated dependency', t => { t.test('rollbacks', { buffered: false }, t => { t.test('fail retiring shallow nodes', t => { const path = fixture(t, 'testing-bundledeps-3') - const a = newArb({ path, legacyBundling: true }) + const a = newArb({ path, installStrategy: 'nested' }) const expect = new Error('rename fail') const kRenamePath = Symbol.for('renamePath') const renamePath = a[kRenamePath] @@ -625,7 +625,7 @@ t.test('rollbacks', { buffered: false }, t => { t.test('fail retiring nodes because rimraf fails after eexist', t => { const path = fixture(t, 'testing-bundledeps-3') - const a = newArb({ path, legacyBundling: true }) + const a = newArb({ path, installStrategy: 'nested' }) const eexist = new Error('rename fail') eexist.code = 'EEXIST' const kRenamePath = Symbol.for('renamePath') @@ -662,7 +662,7 @@ t.test('rollbacks', { buffered: false }, t => { t.test('fail retiring node, but then rimraf fixes it', t => { const path = fixture(t, 'testing-bundledeps-3') - const a = newArb({ path, legacyBundling: true }) + const a = newArb({ path, installStrategy: 'nested' }) const eexist = new Error('rename fail') eexist.code = 'EEXIST' const kRenamePath = Symbol.for('renamePath') @@ -689,7 +689,7 @@ t.test('rollbacks', { buffered: false }, t => { t.test('fail creating sparse tree', t => { t.teardown(() => failMkdir = null) const path = fixture(t, 'testing-bundledeps-3') - const a = newArb({ path, legacyBundling: true }) + const a = newArb({ path, installStrategy: 'nested' }) const kCreateST = Symbol.for('createSparseTree') const createSparseTree = a[kCreateST] a[kCreateST] = () => { @@ -714,7 +714,7 @@ t.test('rollbacks', { buffered: false }, t => { failMkdir = null failRimraf = null const path = fixture(t, 'testing-bundledeps-3') - const a = newArb({ path, legacyBundling: true }) + const a = newArb({ path, installStrategy: 'nested' }) const kCreateST = Symbol.for('createSparseTree') const kRetireShallowNodes = Symbol.for('retireShallowNodes') @@ -762,7 +762,7 @@ t.test('rollbacks', { buffered: false }, t => { t.test('fail loading shrinkwraps and updating trees', t => { const path = fixture(t, 'shrinkwrapped-dep-no-lock-empty') - const a = newArb({ path, legacyBundling: true }) + const a = newArb({ path, installStrategy: 'nested' }) const kLoadSW = Symbol.for('loadShrinkwrapsAndUpdateTrees') const loadShrinkwrapsAndUpdateTrees = a[kLoadSW] a[kLoadSW] = seen => { @@ -788,7 +788,7 @@ t.test('rollbacks', { buffered: false }, t => { t.test('fail loading bundles and updating trees', t => { const path = fixture(t, 'two-bundled-deps') - const a = newArb({ path, legacyBundling: true }) + const a = newArb({ path, installStrategy: 'nested' }) const kLoadBundles = Symbol.for('loadBundlesAndUpdateTrees') const loadBundlesAndUpdateTrees = a[kLoadBundles] a[kLoadBundles] = (depth, bundlesByDepth) => { @@ -806,7 +806,7 @@ t.test('rollbacks', { buffered: false }, t => { t.test('fail unpacking new modules', t => { const path = fixture(t, 'two-bundled-deps') - const a = newArb({ path, legacyBundling: true }) + const a = newArb({ path, installStrategy: 'nested' }) const kUnpack = Symbol.for('unpackNewModules') const unpackNewModules = a[kUnpack] a[kUnpack] = () => { @@ -824,7 +824,7 @@ t.test('rollbacks', { buffered: false }, t => { t.test('fail moving back retired unchanged', t => { const path = fixture(t, 'testing-bundledeps-3') - const a = newArb({ path, legacyBundling: true }) + const a = newArb({ path, installStrategy: 'nested' }) const kMoveback = Symbol.for('moveBackRetiredUnchanged') const moveBackRetiredUnchanged = a[kMoveback] @@ -852,7 +852,7 @@ t.test('rollbacks', { buffered: false }, t => { t.test('fail removing retired and deleted nodes', t => { const path = fixture(t, 'testing-bundledeps-3') - const a = newArb({ path, legacyBundling: true }) + const a = newArb({ path, installStrategy: 'nested' }) const kRemove = Symbol.for('removeTrash') const removeRetiredAndDeletedNodes = a[kRemove] a[kRemove] = () => { diff --git a/workspaces/arborist/test/place-dep.js b/workspaces/arborist/test/place-dep.js index cf222825e9d16..292a2c8e23907 100644 --- a/workspaces/arborist/test/place-dep.js +++ b/workspaces/arborist/test/place-dep.js @@ -39,8 +39,6 @@ t.test('placement tests', t => { updateNames = [], // an audit report, telling us which nodes are vulnerable auditReport = null, - // --legacy-bundling set? - legacyBundling = false, // --strict-peer-deps set? strictPeerDeps = false, // --legacy-peer-deps set? @@ -80,7 +78,6 @@ t.test('placement tests', t => { explicitRequest, updateNames, auditReport, - legacyBundling, strictPeerDeps, legacyPeerDeps, installStrategy, @@ -271,7 +268,7 @@ t.test('placement tests', t => { }), dep: new Node({ pkg: { name: 'bar', version: '1.0.0' } }), nodeLoc: 'node_modules/foo', - legacyBundling: true, + installStrategy: 'nested', test: (t, tree) => { const foobar = tree.children.get('foo').resolve('bar') t.equal(foobar.location, 'node_modules/foo/node_modules/bar') From 78396f18706d4b8229088f6a70c11038a9728b37 Mon Sep 17 00:00:00 2001 From: Nathan Fritz Date: Tue, 18 Oct 2022 14:40:10 -0700 Subject: [PATCH 3/3] chore: add --legacy-bundling and --global-style as deprecated remappings --- lib/commands/dedupe.js | 2 + lib/commands/find-dupes.js | 2 + lib/commands/install.js | 2 + lib/commands/link.js | 2 + lib/commands/update.js | 2 + lib/utils/config/definitions.js | 40 +++++++++++ .../tap-snapshots/test/index.js.test.cjs | 1 + .../test/lib/commands/config.js.test.cjs | 4 ++ tap-snapshots/test/lib/docs.js.test.cjs | 66 ++++++++++++++++--- test/lib/utils/config/definitions.js | 16 +++++ 10 files changed, 128 insertions(+), 9 deletions(-) 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/smoke-tests/tap-snapshots/test/index.js.test.cjs b/smoke-tests/tap-snapshots/test/index.js.test.cjs index e4b8fa53f14e0..98030692de8e4 100644 --- a/smoke-tests/tap-snapshots/test/index.js.test.cjs +++ b/smoke-tests/tap-snapshots/test/index.js.test.cjs @@ -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 ] +npm ERR! [--legacy-bundling] [--global-style] npm ERR! [--omit [--omit ...]] npm ERR! [--strict-peer-deps] [--no-package-lock] [--foreground-scripts] npm ERR! [--ignore-scripts] [--no-audit] [--no-bin-links] [--no-fund] [--dry-run] 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() +})