(pkgDir: string)
| 695 | // --------------------------------------------------------------------------- |
| 696 | |
| 697 | const packageAlreadyPublished = async (pkgDir: string) => { |
| 698 | const pkg = (await Bun.file(join(pkgDir, "package.json")).json()) as { |
| 699 | name?: string; |
| 700 | version?: string; |
| 701 | }; |
| 702 | |
| 703 | if (!pkg.name || !pkg.version) { |
| 704 | throw new Error(`Missing name/version in ${join(pkgDir, "package.json")}`); |
| 705 | } |
| 706 | |
| 707 | const proc = Bun.spawn(["npm", "view", `${pkg.name}@${pkg.version}`, "version"], { |
| 708 | cwd: pkgDir, |
| 709 | stdio: ["ignore", "ignore", "ignore"], |
| 710 | }); |
| 711 | |
| 712 | return (await proc.exited) === 0; |
| 713 | }; |
| 714 | |
| 715 | /** Recognize npm error output for "this version already exists." Used to |
| 716 | * make publish retries idempotent — if a previous workflow run got partway |
no test coverage detected