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

prune.js « lib « npm « deps - github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 228fd3eebb17867d32b0e0319a62610c38ad006b (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
// prune extraneous packages
const npm = require('./npm.js')
const Arborist = require('@npmcli/arborist')
const usageUtil = require('./utils/usage.js')

const reifyFinish = require('./utils/reify-finish.js')

const usage = usageUtil('prune',
  'npm prune [[<@scope>/]<pkg>...] [--production]'
)

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(npm.flatOptions)
  await reifyFinish(arb)
}

module.exports = Object.assign(cmd, { usage })