Browse Source

Forward registry auth token only if asked

master
Tony Kovanen 9 years ago
parent
commit
f4c55e2864
  1. 22
      lib/index.js

22
lib/index.js

@ -64,21 +64,23 @@ export default class Now extends EventEmitter {
} }
// Read .npmrc // Read .npmrc
let npmrc; let npmrc = {};
try { if (pkg['forward-npm']) {
npmrc = await readFile(resolvePath(path, '.npmrc'), 'utf8');
npmrc = parseIni(npmrc);
} catch (err) {
// Do nothing
}
if (!npmrc) {
try { try {
npmrc = await readFile(resolvePath(homedir(), '.npmrc'), 'utf8'); npmrc = await readFile(resolvePath(path, '.npmrc'), 'utf8');
npmrc = parseIni(npmrc); npmrc = parseIni(npmrc);
} catch (err) { } catch (err) {
// Do nothing // Do nothing
} }
if (!npmrc) {
try {
npmrc = await readFile(resolvePath(homedir(), '.npmrc'), 'utf8');
npmrc = parseIni(npmrc);
} catch (err) {
// Do nothing
}
}
} }
const authToken = npmrc['//registry.npmjs.org/:_authToken']; const authToken = npmrc['//registry.npmjs.org/:_authToken'];

Loading…
Cancel
Save