From 753968648368d2e3133d95c6929c08774c38e7cf Mon Sep 17 00:00:00 2001 From: Tony Kovanen Date: Sun, 17 Jul 2016 01:52:25 +0300 Subject: [PATCH] Keep reading lower .npmrc if no auth in project --- lib/index.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/index.js b/lib/index.js index 06cf1dd..896aacc 100644 --- a/lib/index.js +++ b/lib/index.js @@ -67,26 +67,27 @@ export default class Now extends EventEmitter { // Read .npmrc let npmrc = {}; + let authToken; if (nowProperties['forward-npm']) { try { npmrc = await readFile(resolvePath(path, '.npmrc'), 'utf8'); npmrc = parseIni(npmrc); + authToken = npmrc['//registry.npmjs.org/:_authToken']; } catch (err) { // Do nothing } - if (!npmrc) { + if (!authToken) { try { npmrc = await readFile(resolvePath(homedir(), '.npmrc'), 'utf8'); npmrc = parseIni(npmrc); + authToken = npmrc['//registry.npmjs.org/:_authToken']; } catch (err) { // Do nothing } } } - const authToken = npmrc['//registry.npmjs.org/:_authToken']; - if (this._debug) console.time('> [debug] Getting files'); const files = await getFiles(path, pkg, { debug: this._debug }); if (this._debug) console.timeEnd('> [debug] Getting files');