feat(cli): cross-platform binary build via @yao-pkg/pkg (node22)#229
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Ship
capyas a standalone cross-runtime binary so it runs on Python / PHP / Ruby / Go deploy targets without Node installed. Built against currentmain(v0.6.1).Supersedes #116, which had rotted: it referenced the deleted
@capy/sdkworkspace, predated the submodule split, and — the real blocker — targetednode20-*.@yao-pkg/pkg-fetch(3.6.3) dropped all Node 20 prebuilt bases after EOL; its current release ships only Node 22/24/26, sonode20targets 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— bundlessrc/index.ts→build/index.cjs(node22 target, CJS, deps inlined)scripts/build-binary.mjs— local-dev driver:bun run build:binaryproduces a host-platform binary inbin-pkg/package.json— addsesbuild+@yao-pkg/pkgdevDeps andbundle/build:binaryscripts.gitignore— ignoresbuild/andbin-pkg/.github/workflows/release-binaries.yml— on a published GitHub Release, cross-builds all 5 targets on a single Ubuntu runner (ldidpseudo-signs the macOS binaries, no Mac runner needed), uploads archives + SHA-256 checksums to that release, and smoke-tests the linux-x64 binary insidepython:3.12-slimwith no Node installed. Appends to the existing release — does not touch the npm / Homebrew flow.Platform matrix
Test plan
bun run typecheckpassesbun run bundleemitsbuild/index.cjs(~2.2 MB)./bin-pkg/capy --version→0.6.1,--helprenderschecksums-0.6.1.txtpackaged