fix(dev-infra): perform actual npm login verification for wombot proxy (#42871)

Previously the wombot proxy was not able to be queried for login state, now
that it is able to be checked via `npm whoami` a specific alternate flow
is no longer needed.

PR Close #42871
This commit is contained in:
Joey Perrott 2021-07-15 16:28:26 -07:00 committed by Alex Rickabaugh
parent 89509dffd2
commit fd92a3e87f
2 changed files with 2 additions and 25 deletions

View File

@ -7467,21 +7467,9 @@ class ReleaseTool {
* @returns a boolean indicating whether the user is logged into NPM. * @returns a boolean indicating whether the user is logged into NPM.
*/ */
_verifyNpmLoginState() { _verifyNpmLoginState() {
var _a, _b; var _a;
return tslib.__awaiter(this, void 0, void 0, function* () { return tslib.__awaiter(this, void 0, void 0, function* () {
const registry = `NPM at the ${(_a = this._config.publishRegistry) !== null && _a !== void 0 ? _a : 'default NPM'} registry`; const registry = `NPM at the ${(_a = this._config.publishRegistry) !== null && _a !== void 0 ? _a : 'default NPM'} registry`;
// TODO(josephperrott): remove wombat specific block once wombot allows `npm whoami` check to
// check the status of the local token in the .npmrc file.
if ((_b = this._config.publishRegistry) === null || _b === void 0 ? void 0 : _b.includes('wombat-dressing-room.appspot.com')) {
info('Unable to determine NPM login state for wombat proxy, requiring login now.');
try {
yield npmLogin(this._config.publishRegistry);
}
catch (_c) {
return false;
}
return true;
}
if (yield npmIsLoggedIn(this._config.publishRegistry)) { if (yield npmIsLoggedIn(this._config.publishRegistry)) {
debug(`Already logged into ${registry}.`); debug(`Already logged into ${registry}.`);
return true; return true;
@ -7493,7 +7481,7 @@ class ReleaseTool {
try { try {
yield npmLogin(this._config.publishRegistry); yield npmLogin(this._config.publishRegistry);
} }
catch (_d) { catch (_b) {
return false; return false;
} }
return true; return true;

View File

@ -184,17 +184,6 @@ export class ReleaseTool {
*/ */
private async _verifyNpmLoginState(): Promise<boolean> { private async _verifyNpmLoginState(): Promise<boolean> {
const registry = `NPM at the ${this._config.publishRegistry ?? 'default NPM'} registry`; const registry = `NPM at the ${this._config.publishRegistry ?? 'default NPM'} registry`;
// TODO(josephperrott): remove wombat specific block once wombot allows `npm whoami` check to
// check the status of the local token in the .npmrc file.
if (this._config.publishRegistry?.includes('wombat-dressing-room.appspot.com')) {
info('Unable to determine NPM login state for wombat proxy, requiring login now.');
try {
await npmLogin(this._config.publishRegistry);
} catch {
return false;
}
return true;
}
if (await npmIsLoggedIn(this._config.publishRegistry)) { if (await npmIsLoggedIn(this._config.publishRegistry)) {
debug(`Already logged into ${registry}.`); debug(`Already logged into ${registry}.`);
return true; return true;