MCPcopy Create free account
hub / github.com/nodejs/node / exec

Method exec

deps/npm/lib/commands/dedupe.js:29–54  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

27 ]
28
29 async exec () {
30 if (this.npm.global) {
31 const er = new Error('`npm dedupe` does not work in global mode.')
32 er.code = 'EDEDUPEGLOBAL'
33 throw er
34 }
35
36 const dryRun = this.npm.config.get('dry-run')
37 const where = this.npm.prefix
38 const Arborist = require('@npmcli/arborist')
39 const { policy: allowScriptsPolicy } = await resolveAllowScripts(this.npm)
40 const opts = {
41 ...this.npm.flatOptions,
42 path: where,
43 dryRun,
44 // Saving during dedupe would only update if one of your direct dependencies was also duplicated somewhere in your tree.
45 // It would be confusing if running this were to also update your package.json.
46 // In order to reduce potential confusion we set this to false.
47 save: false,
48 workspaces: this.workspaceNames,
49 allowScripts: allowScriptsPolicy,
50 }
51 const arb = new Arborist(opts)
52 await arb.dedupe(opts)
53 await reifyFinish(this.npm, arb)
54 }
55}
56
57module.exports = Dedupe

Callers

nothing calls this directly

Calls 4

resolveAllowScriptsFunction · 0.85
reifyFinishFunction · 0.85
getMethod · 0.65
requireFunction · 0.50

Tested by

no test coverage detected