Visitar URL original
feat: add build variants by wemeetagain · Pull Request #94 · ChainSafe/zapi · GitHub
Skip to content

feat: add build variants - #94

Open
wemeetagain wants to merge 1 commit into
mainfrom
cayman/variants
Open

wemeetagain wants to merge 1 commit into
mainfrom
cayman/variants

Conversation

@wemeetagain

Copy link
Copy Markdown
Member

Lets one package ship several builds of the same addon. Motivation is Lodestar's native bindings, where the consensus preset is a compile-time option: we want mainnet, minimal and gnosis binaries in the same platform package, picked at load time.

  • zapi.variants in package.json maps a variant name to the extra zig build arguments that produce it, e.g. {"mainnet": ["-Dpreset=mainnet"], "minimal": ["-Dpreset=minimal"]}
  • The build step is unchanged and still installs <binaryName>.node. zapi runs it once per variant and stores the result as <binaryName>-<variant>.node
  • build-artifacts builds every variant of every target. Variants of a target build sequentially and share that target's cache
  • prepublish and publish put all variants in each target package. The target package has no main in that case
  • requireNapiLibrary(packageDir, {variant}) loads zig-out/lib/<binaryName>-<variant>.node, then <pkg>-<target>/<binaryName>-<variant>.node. The variant is required when the package declares variants and rejected when it does not
  • zapi build gains --variant, and --prefix so the renamed binary can land where the loader looks

Packages without variants behave as before.

This PR was written primarily by Claude Code.

🤖 Generated with Claude Code

https://claude.ai/code/session_01V21K4w9mTMmW75nFFxksTg

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01V21K4w9mTMmW75nFFxksTg
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-14T23:33:52.269381Z 68d731d Draft marked ready
🔒 Security Review ✅ Completed 2026-11-14T23:38:29.623440Z 68d731d Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

1 participant