diff options
Diffstat (limited to 'deps/npm/lib/utils')
-rw-r--r-- | deps/npm/lib/utils/completion/installed-deep.js | 6 | ||||
-rw-r--r-- | deps/npm/lib/utils/completion/installed-shallow.js | 5 | ||||
-rw-r--r-- | deps/npm/lib/utils/completion/none.js | 2 | ||||
-rw-r--r-- | deps/npm/lib/utils/explain-dep.js | 8 | ||||
-rw-r--r-- | deps/npm/lib/utils/lifecycle-cmd.js | 3 |
5 files changed, 11 insertions, 13 deletions
diff --git a/deps/npm/lib/utils/completion/installed-deep.js b/deps/npm/lib/utils/completion/installed-deep.js index 793f3b3e9a6..f464bb9a9d7 100644 --- a/deps/npm/lib/utils/completion/installed-deep.js +++ b/deps/npm/lib/utils/completion/installed-deep.js @@ -2,7 +2,7 @@ const { resolve } = require('path') const Arborist = require('@npmcli/arborist') const npm = require('../../npm.js') -const readNames = async () => { +const installedDeep = async () => { const { depth, global, @@ -36,8 +36,4 @@ const readNames = async () => { return [...res] } -function installedDeep (opts, cb) { - return readNames().then(res => cb(null, res)).catch(cb) -} - module.exports = installedDeep diff --git a/deps/npm/lib/utils/completion/installed-shallow.js b/deps/npm/lib/utils/completion/installed-shallow.js index e2ff5a30255..c9c680e7dd2 100644 --- a/deps/npm/lib/utils/completion/installed-shallow.js +++ b/deps/npm/lib/utils/completion/installed-shallow.js @@ -4,7 +4,7 @@ const readdir = promisify(require('readdir-scoped-modules')) const names = global => readdir(global ? npm.globalDir : npm.localDir) -const installedShallow = async opts => { +const installedShallow = async (opts) => { const { conf: { argv: { remain } } } = opts if (remain.length > 3) return null @@ -15,5 +15,4 @@ const installedShallow = async opts => { return [...locals, ...globals] } -module.exports = (opts, cb) => - installedShallow(opts).then(list => cb(null, list)).catch(cb) +module.exports = installedShallow diff --git a/deps/npm/lib/utils/completion/none.js b/deps/npm/lib/utils/completion/none.js deleted file mode 100644 index 752400da46f..00000000000 --- a/deps/npm/lib/utils/completion/none.js +++ /dev/null @@ -1,2 +0,0 @@ -// used for commands where no completion is relevant/possible -module.exports = (opts, cb) => cb(null, []) diff --git a/deps/npm/lib/utils/explain-dep.js b/deps/npm/lib/utils/explain-dep.js index ed69a02c143..213493c654b 100644 --- a/deps/npm/lib/utils/explain-dep.js +++ b/deps/npm/lib/utils/explain-dep.js @@ -6,6 +6,7 @@ const nocolor = { yellow: s => s, cyan: s => s, magenta: s => s, + blue: s => s, } const explainNode = (node, depth, color) => @@ -13,11 +14,12 @@ const explainNode = (node, depth, color) => explainDependents(node, depth, color) const colorType = (type, color) => { - const { red, yellow, cyan, magenta } = color ? chalk : nocolor + const { red, yellow, cyan, magenta, blue } = color ? chalk : nocolor const style = type === 'extraneous' ? red : type === 'dev' ? yellow : type === 'optional' ? cyan : type === 'peer' ? magenta + : type === 'bundled' ? blue : /* istanbul ignore next */ s => s return style(type) } @@ -31,6 +33,7 @@ const printNode = (node, color) => { dev, optional, peer, + bundled, } = node const { bold, dim } = color ? chalk : nocolor const extra = [] @@ -46,6 +49,9 @@ const printNode = (node, color) => { if (peer) extra.push(' ' + bold(colorType('peer', color))) + if (bundled) + extra.push(' ' + bold(colorType('bundled', color))) + return `${bold(name)}@${bold(version)}${extra.join('')}` + (location ? dim(`\n${location}`) : '') } diff --git a/deps/npm/lib/utils/lifecycle-cmd.js b/deps/npm/lib/utils/lifecycle-cmd.js index 83a712cf409..94b109942aa 100644 --- a/deps/npm/lib/utils/lifecycle-cmd.js +++ b/deps/npm/lib/utils/lifecycle-cmd.js @@ -2,10 +2,9 @@ // test, start, stop, restart const usageUtil = require('./usage.js') -const completion = require('./completion/none.js') module.exports = (npm, stage) => { const cmd = (args, cb) => npm.commands['run-script']([stage, ...args], cb) const usage = usageUtil(stage, `npm ${stage} [-- <args>]`) - return Object.assign(cmd, { usage, completion }) + return Object.assign(cmd, { usage }) } |