Skip to content

feat: cross-platform binary build via @yao-pkg/pkg#116

Closed
cvince wants to merge 1 commit into
mainfrom
cvince/yao-pkg-binary
Closed

feat: cross-platform binary build via @yao-pkg/pkg#116
cvince wants to merge 1 commit into
mainfrom
cvince/yao-pkg-binary

Conversation

@cvince

@cvince cvince commented Apr 17, 2026

Copy link
Copy Markdown
Contributor

Summary

Phase B of shipping `capy` as a cross-runtime binary so it can run on
Python / PHP / Ruby / Go deploy targets without Node installed.

This is the CLI subtree of the monorepo PR
capysc/capy#181. The release
workflow itself lives in the monorepo (`.github/workflows/release-cli.yml`)
and is not mirrored here.

  • esbuild bundles `src/index.ts` → `build/index.cjs` (Node 20, CJS,
    all deps inlined)
  • `@yao-pkg/pkg` (maintained vercel/pkg fork) wraps the bundle + Node
    runtime into single-file binaries for 5 targets: macos x64/arm64,
    linux x64/arm64, win x64
  • Local `bun run build:binary` produces a host-platform binary in
    `bin-pkg/`
  • Bundle ~1.6 MB; wrapped binary ~50 MB (gzip ~17–20 MB) — Node runtime
    dominates

Reference: dotenvx's release pipeline.

Test plan

  • `bun run typecheck` passes
  • `bun run build:binary` builds a host-platform binary locally
  • `./bin-pkg/capy --help` lists the full command set
  • No bytecode / loader warnings from pkg
  • Asset audit: no `pkg.assets` declarations needed (all
    `readFileSync` calls hit user files; `open` falls back to system
    `xdg-open`)
  • Tag-pushed release workflow build verified (needs the monorepo
    PR to land first)

- esbuild bundles src/index.ts → build/index.cjs (Node 20, CJS)
- @yao-pkg/pkg wraps bundle + Node 20 runtime into single-file binaries
- .github/workflows/release-cli.yml builds 5 targets (macos x64/arm64,
  linux x64/arm64, win x64) on cli-v* tag push and attaches archives +
  checksums to a GitHub Release. Smoke-tests linux-x64 in
  python:3.12-slim with no Node installed.
- macOS cross-built on Ubuntu via MOZGIII/install-ldid-action; no Mac
  runner needed.
- scripts/release.sh now also pushes a cli-v$VERSION tag to the
  monorepo, which fires the release workflow.
- Local 'bun run build:binary' produces a host-platform binary in
  packages/cli/bin-pkg/ for development.
- docs/cli-binary-distribution.md spec.

Closes Phase B of the cross-runtime binary plan.
@cvince

cvince commented Jun 7, 2026

Copy link
Copy Markdown
Contributor Author

Superseded by #229, which rebuilds this against current main (v0.6.1) and fixes the node20 → node22 prebuilt-base breakage (@yao-pkg dropped Node 20 bases after EOL). This branch also still references the deleted @capy/sdk workspace and predates the submodule split.

@cvince cvince closed this Jun 7, 2026
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