(cmd, args)
| 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 |
no test coverage detected