fix(release): retain npm duplicate-version fallback
This commit is contained in:
@@ -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);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -287,11 +287,14 @@ async function packAndPublish(dir: string, name: string): Promise<void> {
|
||||
}
|
||||
|
||||
/**
|
||||
* 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<void> {
|
||||
|
||||
Reference in New Issue
Block a user