Skip to content

Commit 841dc67

Browse files
committed
feat(auth): attempt a dry-run publish to determine auth status
1 parent fc30c21 commit 841dc67

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lib/verify-auth.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@ export default async function (npmrc, pkg, context) {
1616

1717
// await setNpmrcAuth(npmrc, registry, context);
1818

19-
// if (normalizeUrl(registry) === normalizeUrl(DEFAULT_NPM_REGISTRY)) {
19+
if (normalizeUrl(registry) === normalizeUrl(DEFAULT_NPM_REGISTRY)) {
2020
// try {
21+
const publishDryRunResult = execa("npm", ["publish", "--dry-run", "--tag=semantic-release-auth-check"], {cwd, env, preferLocal: true});
2122
// const whoamiResult = execa("npm", ["whoami", "--userconfig", npmrc, "--registry", registry], {
2223
// cwd,
2324
// env,
@@ -26,8 +27,11 @@ export default async function (npmrc, pkg, context) {
2627
// whoamiResult.stdout.pipe(stdout, { end: false });
2728
// whoamiResult.stderr.pipe(stderr, { end: false });
2829
// await whoamiResult;
30+
publishDryRunResult.stdout.pipe(stdout, { end: false });
31+
publishDryRunResult.stderr.pipe(stderr, { end: false });
32+
await publishDryRunResult;
2933
// } catch {
3034
// throw new AggregateError([getError("EINVALIDNPMTOKEN", { registry })]);
3135
// }
32-
// }
36+
}
3337
}

0 commit comments

Comments
 (0)