diff options
author | claudiahdz <cghr1990@gmail.com> | 2020-06-06 01:46:23 +0300 |
---|---|---|
committer | claudiahdz <cghr1990@gmail.com> | 2020-06-06 01:46:23 +0300 |
commit | 3e422948df7cf3551477f1cf1b315dbc73bb4777 (patch) | |
tree | d6b9b528396dc2042276af93814cae39ac601b93 | |
parent | 56d458ebc47dc0e5b3e3b699ac7e939f00e0be50 (diff) |
feat: add dryRun to dedupe
-rw-r--r-- | docs/content/cli-commands/npm-dedupe.md | 2 | ||||
-rw-r--r-- | lib/dedupe.js | 2 | ||||
-rw-r--r-- | lib/npm.js | 2 |
3 files changed, 4 insertions, 2 deletions
diff --git a/docs/content/cli-commands/npm-dedupe.md b/docs/content/cli-commands/npm-dedupe.md index a146885a0..e0493f5e2 100644 --- a/docs/content/cli-commands/npm-dedupe.md +++ b/docs/content/cli-commands/npm-dedupe.md @@ -60,6 +60,8 @@ Modules Note that this operation transforms the dependency tree, but will never result in new modules being installed. +Using `npm find-dupes` will run the command in dryRun mode. + ### See Also * [npm ls](/cli-commands/ls) diff --git a/lib/dedupe.js b/lib/dedupe.js index 51947c792..b82792cbe 100644 --- a/lib/dedupe.js +++ b/lib/dedupe.js @@ -10,7 +10,7 @@ const completion = (cb) => cb(null, []) const cmd = (args, cb) => dedupe().then(() => cb()).catch(cb) const dedupe = async () => { - const { dryRun } = npm.flatOptions + const dryRun = npm.command.match(/^find/) || npm.flatOptions.dryRun const where = npm.prefix const arb = new Arborist({ ...npm.flatOptions, diff --git a/lib/npm.js b/lib/npm.js index dbba2f788..565ef9b4d 100644 --- a/lib/npm.js +++ b/lib/npm.js @@ -111,7 +111,7 @@ npm.config.set('long', true) } - npm.command = actualCommand + npm.command = c npm.flatOptions = require('./config/flat-options.js')(npm) require('./config/set-envs.js')(npm) |