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