Skip to content

add npm binary distribution#22

Open
iamalwaysuncomfortable wants to merge 1 commit into
mainfrom
add/npm-binary-distribution
Open

add npm binary distribution#22
iamalwaysuncomfortable wants to merge 1 commit into
mainfrom
add/npm-binary-distribution

Conversation

@iamalwaysuncomfortable

Copy link
Copy Markdown
Member

Motivation

Make aleo-devnode installable via npm (npm install -g @provablehq/aleo-devnode) so users don't have to grab the right binary from GitHub Releases and put it on their PATH manually. Rust binaries are compiled per platform, so this ships one prebuilt binary per platform and lets npm pick the matching one.

What this does

Uses the optionalDependencies pattern (same model as esbuild/biome/turbo):

  • npm/run.js — a thin launcher shim. Detects the host's platform/arch, resolves the matching platform package, and execs the real binary, forwarding argv, stdio, and the exit code.
  • scripts/build-npm.mjs — single source of truth for the platform matrix. Assembles the @provablehq/aleo-devnode launcher plus 5 platform packages (darwin-arm64, darwin-x64, linux-x64, linux-arm64, win32-x64) from the release build artifacts and stamps the version into each.
  • .github/workflows/release.yml — adds aarch64-unknown-linux-gnu to the build matrix (native ubuntu-24.04-arm runner; existing libclang-dev step covers it) and a new npm job that, on every v* tag, downloads the built binaries and publishes all 6 packages (platform packages first, launcher last so its exact-pinned optionalDependencies resolve).

On install, users get an aleo-devnode command on their PATH; npm downloads only the binary matching their os/cpu.

Test Plan

Verified locally with dummy binaries for all 5 targets:

  • Generator produces the correct layout and package.jsons (right os/cpu, exact-pinned optional deps).
  • Simulated an installed node_modules: the shim resolves the platform package, forwards args, and propagates the child exit code (77); a --no-optional install fails with a clear message and exit 1.
  • npm pack --dry-run ships only run.js, README.md, package.json.
  • Workflow validated as YAML with all jobs present.

Follow-ups required before the first release

  • Add an NPM_TOKEN repo secret (npm token with publish rights to the @provablehq scope); the npm job reads secrets.NPM_TOKEN.
  • Confirm the license — the repo declares none, so the generated packages default to Apache-2.0 (LICENSE const in scripts/build-npm.mjs); change if incorrect.

Related PRs

None

🤖 Generated with Claude Code

Publish aleo-devnode to npm as @provablehq/aleo-devnode using the
optionalDependencies pattern: a thin launcher package plus one prebuilt
binary package per platform, gated by npm os/cpu fields.

- npm/run.js: launcher shim that resolves the host's platform package and
  execs the binary, forwarding args and exit code
- scripts/build-npm.mjs: assembles the launcher + 5 platform packages from
  the release build artifacts and stamps versions
- release.yml: add aarch64-unknown-linux-gnu to the build matrix and a new
  npm job that publishes all packages on tag

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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