* Log out of NPM at a provided registry. * @returns Whether the user was logged out of NPM.
(registryUrl: string | undefined)
| 160 | return true; |
| 161 | } |
| 162 | |
| 163 | /** |
| 164 | * Log into NPM at a provided registry using an interactive invocation. |
| 165 | * @throws With the `npm login` status code if the login failed. |
| 166 | */ |
| 167 | static async startInteractiveLogin(registryUrl: string | undefined) { |
| 168 | const args = ['login', '--no-browser']; |
| 169 | // If a custom registry URL has been specified, add the `--registry` flag. The `--registry` flag |
| 170 | // must be spliced into the correct place in the command as npm expects it to be the flag |
| 171 | // immediately following the login subcommand. |
| 172 | if (registryUrl !== undefined) { |
| 173 | args.splice(1, 0, '--registry', registryUrl); |
| 174 | } |
| 175 | // The login command prompts for username, password and other profile information. Hence |
| 176 | // the process needs to be interactive (i.e. respecting current TTYs stdin). |
| 177 | await ChildProcess.spawnInteractive('npm', args); |
| 178 | } |
nothing calls this directly
no outgoing calls
no test coverage detected