Browse Source

Keep reading lower .npmrc if no auth in project

master
Tony Kovanen 9 years ago
parent
commit
7539686483
  1. 7
      lib/index.js

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

Loading…
Cancel
Save