Skip to content

Commit 4670c0d

Browse files
committed
PR feedback from #2608
1 parent d0d2755 commit 4670c0d

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

.ado/scripts/prepublish-check.mjs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -160,14 +160,10 @@ function verifyNpmAuth(registry = NPM_DEFEAULT_REGISTRY) {
160160
const whoamiArgs = ["npm", "whoami", "--publish"];
161161
const whoami = spawnSync("yarn", whoamiArgs, spawnOptions);
162162
if (whoami.status !== 0) {
163-
const stderr = whoami.stderr.toString().trim();
164-
const stdout = whoami.stdout.toString().trim();
165-
const errorOutput = stderr || stdout || 'No error message available';
166-
167-
// Yarn uses different error format
168-
if (errorOutput.includes("Invalid authentication") || errorOutput.includes("Failed with errors")) {
169-
throw new Error(`Invalid or missing auth token for registry: ${registry}`);
170-
}
163+
const errorOutput =
164+
whoami.stderr.toString().trim() ||
165+
whoami.stdout.toString().trim() ||
166+
'No error message available';
171167

172168
// Provide more context about the yarn authentication failure
173169
throw new Error(`Yarn authentication failed (exit code ${whoami.status}): ${errorOutput}`);

0 commit comments

Comments
 (0)