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');