diff options
author | isaacs <i@izs.me> | 2020-09-08 00:38:12 +0300 |
---|---|---|
committer | isaacs <i@izs.me> | 2020-09-08 19:52:39 +0300 |
commit | 5e49bdaa34e29dbd25c687f8e6881747a86b7435 (patch) | |
tree | 78eef0d61e34b49387369f3a41d4aeca1ccb7e2f /lib/utils | |
parent | 7418970f03229dd2bce7973b99b981779aee6916 (diff) |
Add 'npm explain' command
Pass a specifier or folder path, and it'll explain what that dependency
is doing there.
PR-URL: https://github.com/npm/cli/pull/1776
Credit: @isaacs
Close: #1776
Reviewed-by: @ruyadorno
Diffstat (limited to 'lib/utils')
-rw-r--r-- | lib/utils/cmd-list.js | 6 | ||||
-rw-r--r-- | lib/utils/explain-dep.js | 2 |
2 files changed, 5 insertions, 3 deletions
diff --git a/lib/utils/cmd-list.js b/lib/utils/cmd-list.js index 85e456a83..6328d80d5 100644 --- a/lib/utils/cmd-list.js +++ b/lib/utils/cmd-list.js @@ -20,7 +20,8 @@ const shorthands = { run: 'run-script', 'clean-install': 'ci', 'clean-install-test': 'cit', - x: 'exec' + x: 'exec', + why: 'explain' } const affordances = { @@ -128,7 +129,8 @@ const cmdList = [ 'run-script', 'completion', 'doctor', - 'exec' + 'exec', + 'explain' ] const plumbing = ['birthday', 'help-search'] diff --git a/lib/utils/explain-dep.js b/lib/utils/explain-dep.js index 773cc5942..facab373b 100644 --- a/lib/utils/explain-dep.js +++ b/lib/utils/explain-dep.js @@ -63,7 +63,7 @@ const explainDependents = ({ name, dependents }, depth, color) => { // show just the names of the first 5 deps that overflowed the list if (dependents.length > max) { let len = 0 - const maxLen = 30 + const maxLen = 50 const showNames = [] for (let i = max; i < dependents.length; i++) { const { from: { name } } = dependents[i] |