blob: e675df30d601ccfadb2cb2df61d47fbef02a2816 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
// prune extraneous packages
const npm = require('./npm.js')
const Arborist = require('@npmcli/arborist')
const usageUtil = require('./utils/usage.js')
const reifyOutput = require('./utils/reify-output.js')
const usage = usageUtil('prune',
'npm prune [[<@scope>/]<pkg>...] [--production]'
)
const completion = (cb) => cb(null, [])
const cmd = (args, cb) => prune().then(() => cb()).catch(cb)
const prune = async () => {
const where = npm.prefix
const arb = new Arborist({
...npm.flatOptions,
path: where
})
await arb.prune()
reifyOutput(arb)
}
module.exports = Object.assign(cmd, { usage, completion })
|