(pkgDir: string)
| 717 | // --------------------------------------------------------------------------- |
| 718 | |
| 719 | const packageAlreadyPublished = async (pkgDir: string) => { |
| 720 | const pkg = (await Bun.file(join(pkgDir, "package.json")).json()) as { |
| 721 | name?: string; |
| 722 | version?: string; |
| 723 | }; |
| 724 | |
| 725 | if (!pkg.name || !pkg.version) { |
| 726 | throw new Error(`Missing name/version in ${join(pkgDir, "package.json")}`); |
| 727 | } |
| 728 | |
| 729 | const proc = Bun.spawn(["npm", "view", `${pkg.name}@${pkg.version}`, "version"], { |
| 730 | cwd: pkgDir, |
| 731 | stdio: ["ignore", "ignore", "ignore"], |
| 732 | }); |
| 733 | |
| 734 | return (await proc.exited) === 0; |
| 735 | }; |
| 736 | |
| 737 | /** Recognize npm error output for "this version already exists." Used to |
| 738 | * make publish retries idempotent — if a previous workflow run got partway |
no test coverage detected