Skip to content

feat(cli): cross-platform binary build via @yao-pkg/pkg (node22)#229

Merged
cvince merged 1 commit into
mainfrom
cvince/cross-platform-yao-build
Jun 8, 2026
Merged

feat(cli): cross-platform binary build via @yao-pkg/pkg (node22)#229
cvince merged 1 commit into
mainfrom
cvince/cross-platform-yao-build

Conversation

@cvince

@cvince cvince commented Jun 7, 2026

Copy link
Copy Markdown
Contributor

Summary

Ship capy as a standalone cross-runtime binary so it runs on Python / PHP / Ruby / Go deploy targets without Node installed. Built against current main (v0.6.1).

Supersedes #116, which had rotted: it referenced the deleted @capy/sdk workspace, predated the submodule split, and — the real blocker — targeted node20-*. @yao-pkg/pkg-fetch (3.6.3) dropped all Node 20 prebuilt bases after EOL; its current release ships only Node 22/24/26, so node20 targets 404 and fall back to a 30–40 min from-source Node compile (which on a Mac can't even produce Linux). This PR targets Node 22 (current LTS), which has prebuilts for all five platforms.

What's here

  • build.esbuild.mjs — bundles src/index.tsbuild/index.cjs (node22 target, CJS, deps inlined)
  • scripts/build-binary.mjs — local-dev driver: bun run build:binary produces a host-platform binary in bin-pkg/
  • package.json — adds esbuild + @yao-pkg/pkg devDeps and bundle / build:binary scripts
  • .gitignore — ignores build/ and bin-pkg/
  • .github/workflows/release-binaries.yml — on a published GitHub Release, cross-builds all 5 targets on a single Ubuntu runner (ldid pseudo-signs the macOS binaries, no Mac runner needed), uploads archives + SHA-256 checksums to that release, and smoke-tests the linux-x64 binary inside python:3.12-slim with no Node installed. Appends to the existing release — does not touch the npm / Homebrew flow.

Platform matrix

Target Output
node22-macos-x64 capy-darwin-x64-X.Y.Z.tar.gz
node22-macos-arm64 capy-darwin-arm64-X.Y.Z.tar.gz
node22-linuxstatic-x64 capy-linux-x64-X.Y.Z.tar.gz
node22-linuxstatic-arm64 capy-linux-arm64-X.Y.Z.tar.gz
node22-win-x64 capy-win-x64-X.Y.Z.zip

Test plan

  • bun run typecheck passes
  • bun run bundle emits build/index.cjs (~2.2 MB)
  • Full matrix built locally from a Mac — all 5 binaries produced with correct architectures (Mach-O arm64/x64, ELF static-pie x64/arm64, PE32+ win)
  • ./bin-pkg/capy --version0.6.1, --help renders
  • Archives + checksums-0.6.1.txt packaged
  • Publish a test release and confirm the workflow attaches artifacts (owner action)

Ship capy as a standalone cross-runtime binary so it runs on Python / PHP /
Ruby / Go deploy targets without Node installed.

- esbuild bundles src/index.ts -> build/index.cjs (node22 target, CJS, deps inlined)
- @yao-pkg/pkg wraps the bundle + Node 22 runtime into one binary per platform
- bun run build:binary produces a host-platform binary in bin-pkg/ for local dev
- .github/workflows/release-binaries.yml cross-builds 5 targets on a single
  Ubuntu runner (ldid pseudo-signs the macOS binaries, no Mac runner), uploads
  archives + SHA-256 checksums to the published GitHub Release, and smoke-tests
  the linux-x64 binary inside python:3.12-slim with no Node installed

Targets node22 (not node20): @yao-pkg/pkg-fetch dropped Node 20 prebuilt bases
after EOL, so node20 targets 404 and fall back to a from-source compile.

Platform matrix: darwin x64/arm64, linux x64/arm64 (static), win x64.
@cvince cvince merged commit 9eb4522 into main Jun 8, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant