Repository navigation
feat: add build variants - #94
Conversation
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01V21K4w9mTMmW75nFFxksTg
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
| binaryName: string; | ||
| targets: string[]; | ||
| step?: string; | ||
| variants?: Record<string, string[]>; |
There was a problem hiding this comment.
do we have anything else other than presets to be built under variants? otherwise why not name this presets rather than variants. probably better to overspecify than underspecify
There was a problem hiding this comment.
I think nazar and myself have a goal of keeping this as a reusable library. Preference towards keeping the variant or somesuch name.
|
|
||
| await build(buildOptions); | ||
|
|
||
| if (variant !== undefined) { |
There was a problem hiding this comment.
would we ever want variant to be undefined? Seems like bindings should always ship with a preset anyway. Might be easier to specify, for example, mainnet as a default
There was a problem hiding this comment.
I actually like the idea that if you define variants, you must specify a variant at load time, ie no default. (Consumer would obviously specify and enforce a default)
There was a problem hiding this comment.
this test should perhaps be under publishing instead?
There was a problem hiding this comment.
Moved to examples/publishing/variants.test.ts in 95151c4.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01V21K4w9mTMmW75nFFxksTg
🤖 I have created a release *beep* *boop* --- ## [4.5.0](zapi-v4.4.0...zapi-v4.5.0) (2026-11-16) ### Features * add build variants ([#94](#94)) ([05659c6](05659c6)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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.variantsinpackage.jsonmaps a variant name to the extrazig buildarguments that produce it, e.g.{"mainnet": ["-Dpreset=mainnet"], "minimal": ["-Dpreset=minimal"]}<binaryName>.node. zapi runs it once per variant and stores the result as<binaryName>-<variant>.nodebuild-artifactsbuilds every variant of every target. Variants of a target build sequentially and share that target's cacheprepublishandpublishput all variants in each target package. The target package has nomainin that caserequireNapiLibrary(packageDir, {variant})loadszig-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 notzapi buildgains--variant, and--prefixso the renamed binary can land where the loader looksPackages without
variantsbehave as before.🤖 Generated with Claude Code
https://claude.ai/code/session_01V21K4w9mTMmW75nFFxksTg