Skip to content

Commit

Permalink
fix: log the output of npm whoami command
Browse files Browse the repository at this point in the history
  • Loading branch information
pvdlg committed Nov 3, 2019
1 parent a0120d2 commit cd1ecaa
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion lib/verify-auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,25 @@ module.exports = async (npmrc, pkg, context) => {
const {
cwd,
env: {DEFAULT_NPM_REGISTRY = 'https://registry.npmjs.org/', ...env},
stdout,
stderr,
} = context;
const registry = getRegistry(pkg, context);

await setNpmrcAuth(npmrc, registry, context);

if (normalizeUrl(registry) === normalizeUrl(DEFAULT_NPM_REGISTRY)) {
try {
await execa('npm', ['whoami', '--userconfig', npmrc, '--registry', registry], {cwd, env});
const whoamiResult = execa('npm', ['whoami', '--userconfig', npmrc, '--registry', registry], {cwd, env});
whoamiResult.stdout.pipe(
stdout,
{end: false}
);
whoamiResult.stderr.pipe(
stderr,
{end: false}
);
await whoamiResult;
} catch (_) {
throw new AggregateError([getError('EINVALIDNPMTOKEN', {registry})]);
}
Expand Down

0 comments on commit cd1ecaa

Please sign in to comment.