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

Method #exec

deps/npm/lib/npm.js:204–225  ·  view source on GitHub ↗
(cmd, args)

Source from the content-addressed store, hash-verified

202
203 // Call an npm command
204 async #exec (cmd, args) {
205 const Command = this.constructor.cmd(cmd)
206 const command = new Command(this)
207
208 // since 'test', 'start', 'stop', etc. commands re-enter this function to call the run command, we need to only set it one time.
209 if (!this.#command) {
210 this.#command = command
211 process.env.npm_command = this.command
212 }
213
214 // Only log warnings for legacy commands without definitions or subcommands
215 // Commands with definitions will handle warnings in base-cmd flags()
216 // Commands with subcommands will delegate to the subcommand to handle warnings
217 if (!Command.definitions && !Command.subcommands) {
218 this.config.logWarnings()
219 }
220
221 // this needs to be rest after because some commands run this.npm.config.checkUnknown('publishConfig', key)
222 this.config.warn = true
223
224 return this.execCommandClass(command, args, [cmd])
225 }
226
227 // Unified command execution for both top-level commands and subcommands
228 // Supports n-depth subcommands, workspaces, and definitions

Callers 1

execMethod · 0.95

Calls 2

execCommandClassMethod · 0.95
cmdMethod · 0.80

Tested by

no test coverage detected