diff --git a/scripts/ci-release-publish.test.ts b/scripts/ci-release-publish.test.ts index 20f9c845d..21a454534 100644 --- a/scripts/ci-release-publish.test.ts +++ b/scripts/ci-release-publish.test.ts @@ -31,11 +31,12 @@ describe("release publish", () => { }); }); - it("recognizes npm's existing-version machine codes without matching registry prose", () => { + it("recognizes npm's existing-version machine codes and registry-precheck prose", () => { expect(isVersionAlreadyPublished("npm error code E409\nnpm error Cannot publish over existing version")).toBe( true, ); expect(isVersionAlreadyPublished("npm error code EPUBLISHCONFLICT")).toBe(true); + expect(isVersionAlreadyPublished("You cannot publish over the previously published versions: 1.2.3.")).toBe(true); expect(isVersionAlreadyPublished("cannot publish over the previously published version")).toBe(false); }); }); diff --git a/scripts/ci-release-publish.ts b/scripts/ci-release-publish.ts index e227c34e5..147b0b0f1 100644 --- a/scripts/ci-release-publish.ts +++ b/scripts/ci-release-publish.ts @@ -287,11 +287,14 @@ async function packAndPublish(dir: string, name: string): Promise { } /** - * npm's stable machine codes for an existing exact version: - * `E409` from a registry conflict and `EPUBLISHCONFLICT` from npm. + * npm's stable machine codes for an existing exact version, plus npm 11's + * registry-precheck prose when it emits no machine code. */ export function isVersionAlreadyPublished(output: string): boolean { - return /npm error code (E409|EPUBLISHCONFLICT)\b/i.test(output); + return ( + /npm error code (E409|EPUBLISHCONFLICT)\b/i.test(output) || + /you cannot publish over (?:the )?previously published versions?\b/i.test(output) + ); } async function publishGeneratedLeafPackage(leaf: GeneratedLeafPackage): Promise {