MCPcopy Index your code
hub / github.com/nodejs/node / exec

Method exec

deps/npm/lib/commands/update.js:44–74  ·  view source on GitHub ↗
(args)

Source from the content-addressed store, hash-verified

42 }
43
44 async exec (args) {
45 const update = args.length === 0 ? true : args
46 const global = path.resolve(this.npm.globalDir, '..')
47 const where = this.npm.global ? global : this.npm.prefix
48
49 // In the context of `npm update` the save config value should default to `false`
50 const save = this.npm.config.isDefault('save')
51 ? false
52 : this.npm.config.get('save')
53
54 if (this.npm.config.get('depth')) {
55 log.warn('update', 'The --depth option no longer has any effect. See RFC0019.\n' +
56 'https://github.com/npm/rfcs/blob/latest/implemented/0019-remove-update-depth-option.md')
57 }
58
59 const Arborist = require('@npmcli/arborist')
60 const { policy: allowScriptsPolicy } = await resolveAllowScripts(this.npm)
61 const opts = {
62 ...this.npm.flatOptions,
63 path: where,
64 save,
65 workspaces: this.workspaceNames,
66 allowScripts: allowScriptsPolicy,
67 }
68 const arb = new Arborist(opts)
69
70 const reifyOpts = { ...opts, update }
71 await strictAllowScriptsPreflight({ arb, npm: this.npm, idealTreeOpts: reifyOpts })
72 await arb.reify(reifyOpts)
73 await reifyFinish(this.npm, arb)
74 }
75}
76
77module.exports = Update

Callers

nothing calls this directly

Calls 8

reifyMethod · 0.95
resolveAllowScriptsFunction · 0.85
reifyFinishFunction · 0.85
warnMethod · 0.80
getMethod · 0.65
requireFunction · 0.50
resolveMethod · 0.45

Tested by

no test coverage detected