release: a staged npm publish is reported with what happened on 0.8.25 / 0.8.26 (published on its own ~10 min later, nothing to approve): check dist-tags first

This commit is contained in:
CRTkafa 2026-10-22 02:50:12 +08:00
parent d7e0a84596
commit 5bfbcefffa

View file

@ -466,7 +466,7 @@ async function npmRelease(version: string, token: string): Promise<void> {
const pub = npmRun(['publish'], token);
// npm stages a token publish for the maintainer's approval on npmjs.com (409 "previously staged version" on a retry):
// nothing to wait for here, the owner approves it once
if (/staged/i.test(pub.out)) { say(`npm: ${version} is staged and waits for the maintainer's approval: https://www.npmjs.com/package/storebound (approve it there; then deprecate runs with: bun tools/release.ts npm-publish)`); return; }
if (/staged/i.test(pub.out)) { say(`npm: ${version} is staged: npm published 0.8.25 and 0.8.26 on its own about 10 minutes later with nothing waiting at https://www.npmjs.com/settings/<user>/staged-packages; check "npm view storebound dist-tags.latest" before approving anything, then run bun tools/release.ts npm-publish for the deprecate`); return; }
if (pub.code !== 0 && !/previously published|cannot publish over/i.test(pub.out)) fail(`npm publish failed: ${pub.out.trim().split('\n').slice(-4).join(' ')}`);
// the registry lags a little after a publish; wait (timeout, heartbeat) until it serves the version as latest
const end = Date.now() + 5 * 60_000;
@ -482,7 +482,7 @@ async function npmRelease(version: string, token: string): Promise<void> {
say(`npm: ${version} is not on the registry yet: publishing once more`);
const p2 = npmRun(['publish'], token);
// 0.8.25: the first publish was staged silently; the retry's 409 "previously staged" says so (no 5-minute wait)
if (/staged/i.test(p2.out)) { say(`npm: ${version} is staged and waits for the maintainer's approval: https://www.npmjs.com/package/storebound (approve it there; then deprecate runs with: bun tools/release.ts npm-publish)`); return; }
if (/staged/i.test(p2.out)) { say(`npm: ${version} is staged: npm published 0.8.25 and 0.8.26 on its own about 10 minutes later with nothing waiting at https://www.npmjs.com/settings/<user>/staged-packages; check "npm view storebound dist-tags.latest" before approving anything, then run bun tools/release.ts npm-publish for the deprecate`); return; }
if (p2.code !== 0 && !/previously published|cannot publish over/i.test(p2.out)) fail(`npm publish (second try) failed: ${p2.out.trim().split('\n').slice(-4).join(' ')}`);
}
}