* Log into NPM at a provided registry using an interactive invocation. * @throws With the `npm login` status code if the login failed.
(registryUrl: string | undefined)
| 143 | } |
| 144 | |
| 145 | /** |
| 146 | * Checks whether the user is currently logged into NPM. |
| 147 | * @returns Whether the user is currently logged into NPM. |
| 148 | */ |
| 149 | static async checkIsLoggedIn(registryUrl: string | undefined): Promise<boolean> { |
| 150 | const args = ['whoami']; |
| 151 | // If a custom registry URL has been specified, add the `--registry` flag. |
| 152 | if (registryUrl !== undefined) { |
| 153 | args.push('--registry', registryUrl); |
| 154 | } |
| 155 | try { |
| 156 | await ChildProcess.spawn('npm', args, {mode: 'silent'}); |
| 157 | } catch (e) { |
| 158 | return false; |
| 159 | } |
nothing calls this directly
no outgoing calls
no test coverage detected