Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib/utils
diff options
context:
space:
mode:
Diffstat (limited to 'lib/utils')
-rw-r--r--lib/utils/completion/installed-deep.js6
-rw-r--r--lib/utils/completion/installed-shallow.js5
-rw-r--r--lib/utils/completion/none.js2
-rw-r--r--lib/utils/lifecycle-cmd.js3
4 files changed, 4 insertions, 12 deletions
diff --git a/lib/utils/completion/installed-deep.js b/lib/utils/completion/installed-deep.js
index 793f3b3e9..f464bb9a9 100644
--- a/lib/utils/completion/installed-deep.js
+++ b/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/lib/utils/completion/installed-shallow.js b/lib/utils/completion/installed-shallow.js
index e2ff5a302..c9c680e7d 100644
--- a/lib/utils/completion/installed-shallow.js
+++ b/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/lib/utils/completion/none.js b/lib/utils/completion/none.js
deleted file mode 100644
index 752400da4..000000000
--- a/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/lib/utils/lifecycle-cmd.js b/lib/utils/lifecycle-cmd.js
index 83a712cf4..94b109942 100644
--- a/lib/utils/lifecycle-cmd.js
+++ b/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 })
}