From 69d4ebffa9ec0862b93b5b7e27ab4506e5c39a09 Mon Sep 17 00:00:00 2001 From: Joey Perrott Date: Wed, 21 Jul 2021 16:17:17 -0700 Subject: [PATCH] Revert "fix(dev-infra): perform actual npm login verification for wombot proxy (#42871)" (#42917) This reverts commit fd92a3e87f08253ac8d20d01bc726c7460bd9ec9. It turns out that wombot proxy will return who is logged in, but does so regardless of if the users token is currently active. Since we cannot rely on `npm whoami` to determine the login state, we revert to our previous state of assuming new login is needed. PR Close #42917 --- dev-infra/ng-dev.js | 16 ++++++++++++++-- dev-infra/release/publish/index.ts | 11 +++++++++++ 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/dev-infra/ng-dev.js b/dev-infra/ng-dev.js index cc6db24e76..a8e76a74a0 100755 --- a/dev-infra/ng-dev.js +++ b/dev-infra/ng-dev.js @@ -7513,9 +7513,21 @@ class ReleaseTool { * @returns a boolean indicating whether the user is logged into NPM. */ _verifyNpmLoginState() { - var _a; + var _a, _b; 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`; + // 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)) { debug(`Already logged into ${registry}.`); return true; @@ -7527,7 +7539,7 @@ class ReleaseTool { try { yield npmLogin(this._config.publishRegistry); } - catch (_b) { + catch (_d) { return false; } return true; diff --git a/dev-infra/release/publish/index.ts b/dev-infra/release/publish/index.ts index 830bd38f35..f5c551a2d0 100644 --- a/dev-infra/release/publish/index.ts +++ b/dev-infra/release/publish/index.ts @@ -183,6 +183,17 @@ export class ReleaseTool { */ private async _verifyNpmLoginState(): Promise { 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)) { debug(`Already logged into ${registry}.`); return true;