From 1df39d96174e095d1f055cac4d4acad2d37fe748 Mon Sep 17 00:00:00 2001 From: enricobuehler Date: Sat, 8 Aug 2026 12:55:37 +0200 Subject: [PATCH] =?UTF-8?q?fix(ci/sdk):=20the=20SDK=20could=20not=20be=20p?= =?UTF-8?q?ublished=20at=20all=20=E2=80=94=20`bun=20publish`=20runs=20`pre?= =?UTF-8?q?pare`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `sdk-v0.1.3` failed at the publish step with `bun2nix: command not found`, exit 127. Nothing was published, so 0.1.3 is still free. `bun publish` runs the `prepare` lifecycle script, and sdk's `prepare` is `bun2nix -o bun.nix` — regenerating the nix dependency file. That tool is a devDependency of the repo, not something the `oven/bun:1` publish container has, and the workflow's own install is `--ignore-scripts`, so nothing put it on PATH either. This was latent, not new. `prepare` gained the bun2nix call on 2026-07-27 (1db8f763, "move the bun packages to bun2nix"), while the last SDK publish was 0.1.2, bumped 2026-07-20. So the hook has been broken for every SDK release since it landed, and 0.1.3 is simply the first one to try. `@punktfunk/plugin-kit` has no `prepare` and was never affected, which is why kit 0.3.2 published fine in that window and hid this. The fix is NOT to copy `web/package.json`, which does the same job from `postinstall`. That is right for web — it is never published — and would be worse here: a published package's `postinstall` runs in every CONSUMER's install, so every plugin depending on `@punktfunk/host` would try to run bun2nix and fail. `prepare` is the correct hook for a published package (it does not run for consumers); it just must not assume a repo-maintenance tool exists wherever a publish happens. So the script skips when bun2nix is absent — and ONLY then. A present-but-failing bun2nix still fails the script, because swallowing that would publish with a silently stale bun.nix, which is the exact hand-maintained-hash problem 1db8f763 set out to end. Both directions measured against the same `sh -e` bun and the Gitea runner use: absent → exit 0, present-and-failing → exit 3. `bun publish --dry-run` now completes and reports `+ @punktfunk/host@0.1.3`. --- sdk/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/package.json b/sdk/package.json index 787c7a91..72a912a7 100644 --- a/sdk/package.json +++ b/sdk/package.json @@ -34,7 +34,7 @@ "registry": "https://git.unom.io/api/packages/unom/npm/" }, "scripts": { - "prepare": "bun2nix -o bun.nix", + "prepare": "if command -v bun2nix >/dev/null 2>&1; then bun2nix -o bun.nix; fi", "gen": "openapigen --spec ../api/openapi.json --name Punktfunk --format httpclient > src/gen/punktfunk.ts", "typecheck": "tsc --noEmit", "build": "tsc -p tsconfig.build.json",