codekingpro/portable-devtools
114k
1const reifyFinish = require('../utils/reify-finish.js')
2const ArboristWorkspaceCmd = require('../arborist-cmd.js')
3
4class Prune extends ArboristWorkspaceCmd {
5 static description = 'Remove extraneous packages'
6 static name = 'prune'
7 static params = [
8 'omit',
9 'include',
10 'dry-run',
11 'json',
12 'foreground-scripts',
13 'ignore-scripts',
14 ...super.params,
15 ]
16
17 static usage = ['[[<@scope>/]<pkg>...]']
18
19 async exec () {
20 const where = this.npm.prefix
21 const Arborist = require('@npmcli/arborist')
22 const opts = {
23 ...this.npm.flatOptions,
24 path: where,
25 workspaces: this.workspaceNames,
26 }
27 const arb = new Arborist(opts)
28 await arb.prune(opts)
29 await reifyFinish(this.npm, arb)
30 }
31}
32
33module.exports = Prune
34 