Skip to content

Commit 8f88e9d

Browse files
committed
fix(auth): throw error if dry-run publish determines lack of auth
1 parent 841dc67 commit 8f88e9d

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

lib/verify-auth.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,13 @@ export default async function (npmrc, pkg, context) {
2828
// whoamiResult.stderr.pipe(stderr, { end: false });
2929
// await whoamiResult;
3030
publishDryRunResult.stdout.pipe(stdout, { end: false });
31-
publishDryRunResult.stderr.pipe(stderr, { end: false });
32-
await publishDryRunResult;
31+
publishDryRunResult.stderr.pipe(stderr, { end: false, lines: true });
32+
const {stdout} = await publishDryRunResult;
33+
stdout.forEach((line) => {
34+
if (line.includes("warn This command requires you to be logged in to https://registry.npmjs.org/")) {
35+
throw new Error('no auth context');
36+
}
37+
})
3338
// } catch {
3439
// throw new AggregateError([getError("EINVALIDNPMTOKEN", { registry })]);
3540
// }

0 commit comments

Comments
 (0)