Skip to content

Conversation

bleepbloopsify
Copy link
Contributor

@bleepbloopsify bleepbloopsify commented Oct 13, 2025

closes: #2368, #2369

adds npm targets:

build:wasm
build:wasm:web
build:wasm:node
build:jsoo
build:jsoo:web
build:jsoo:node

changes output permissions of artifacts from 777 to 660 as a general hygiene check

updates relevant scripts to use these npm targets rather than building as they see fit
removed some javascript based "copy" files and replaced them with bash statements in relevant locations. These should be replaced with tsconfig edits with time.

notably: drops usage of _node_bindings in favor of using node_bindings. There is no need for an intermediate "build" directory.

ALSO: drops actual usage of _node_bindings as an import: it confuses the artifact generation process when there are two seemingly identical targets. this redirects imports to node_bindings, our actual usage.

_node_bindings no longer exists after this PR is merged.

PREBUILT_KIMCHI_BINDINGS_JS_WEB was already left up to dune to handle. We invoked dune build regardless of if this variable was set, and duplicated the functionality inside bash anyways.

I removed usage of it in bash in favor of keeping it in dune. This is to ensure that the nix builds in mina continue to work, regardless of our bash treatment of the variable.

@bleepbloopsify bleepbloopsify requested review from a team as code owners October 13, 2025 19:01
@bleepbloopsify bleepbloopsify changed the title chore: break out wasm build chore: break out wasm and JSOO builds Oct 13, 2025
@bleepbloopsify bleepbloopsify force-pushed the leon/separate-wasm-build branch from e29afde to 5eb6e2a Compare October 14, 2025 03:38
@bleepbloopsify
Copy link
Contributor Author

$ o1js-small [leon/separate-wasm-build] ♞  npm run build:bindings-all | pbcopy
> [email protected] build:bindings-all
> ./src/bindings/scripts/update-o1js-bindings.sh

�[1m[update-o1js-bindings.sh] Updating o1js bindings (node + Web)�[0m
�[1m[update-o1js-bindings.sh] Phase 1: Building node bindings�[0m
[update-o1js-bindings.sh] • Building node artifacts...
�[1m[build-o1js-node-artifacts.sh] Building bindings artifacts�[0m
[build-o1js-node-artifacts.sh] • Checking dependencies...
�[32m[build-o1js-node-artifacts.sh] ✔ Dependencies already installed�[0m
[build-o1js-node-artifacts.sh] • Setting up Mina configuration files...
�[32m[build-o1js-node-artifacts.sh] ✔ Mina config files copied�[0m

> [email protected] build:wasm:node
> ./scripts/build/wasm/build-node.sh

[wasm-node-build] • building Kimchi bindings for node...
[wasm-node-build] • copying artifacts into the right place...
[wasm-node-build] • moving some files to CommonJS format...
[wasm-node-build] • autofixing wasm bindings for Node.JS...
�[1;32m[wasm-node-build] WASM node build success!�[0m

> [email protected] build:jsoo:node
> ./scripts/build/jsoo/build-node.sh

[jsoo-build-node] • building JSOO artifacts for node...
�[32m[jsoo-build-node] ✔ JSOO artifacts built successfully�[0m
[jsoo-build-node] • copying artifacts into the right place...
[jsoo-build-node] • setting up TS declaration files...
�[32m[jsoo-build-node] ✔ TS declaration created�[0m
[jsoo-build-node] • moving some files to CommonJS format...
�[32m[jsoo-build-node] ✔ Node.js bindings copied�[0m
[jsoo-build-node] • Updating WASM references in bindings...
�[32m[jsoo-build-node] ✔ WASM references updated�[0m
[jsoo-build-node] • fixing JS bindings for better error handling...
�[32m[jsoo-build-node] ✔ JS bindings fixed�[0m
�[1;32m[jsoo-build-node] JSOO node build complete!�[0m
[build-o1js-node-artifacts.sh] • Building transaction layout TypeScript definitions...
�[32m[build-o1js-node-artifacts.sh] ✔ TypeScript definitions built�[0m
[build-o1js-node-artifacts.sh] • Formatting generated transaction layout definitions...
src/bindings/crypto/constants.ts 84ms
src/bindings/mina-transaction/gen/v1/js-layout.ts 58ms
src/bindings/mina-transaction/gen/v1/transaction-bigint.ts 34ms
src/bindings/mina-transaction/gen/v1/transaction-json.ts 21ms
src/bindings/mina-transaction/gen/v1/transaction.ts 23ms
src/bindings/mina-transaction/gen/v2/js-layout.ts 42ms
�[32m[build-o1js-node-artifacts.sh] ✔ TypeScript definitions formatted�[0m
[build-o1js-node-artifacts.sh] • Cleaning up Mina config files...
�[32m[build-o1js-node-artifacts.sh] ✔ Config files cleaned up�[0m
�[1;32m[build-o1js-node-artifacts.sh] Node bindings artifacts build complete�[0m
�[32m[update-o1js-bindings.sh] ✔ node artifacts built�[0m
[update-o1js-bindings.sh] • Copying build artifacts to dist...
src/bindings/compiled/node_bindings/o1js_node.bc.cjs -> dist/node/bindings/compiled/node_bindings/o1js_node.bc.cjs
src/bindings/compiled/node_bindings/o1js_node.bc.d.cts -> dist/node/bindings/compiled/node_bindings/o1js_node.bc.d.cts
src/bindings/compiled/node_bindings/o1js_node.bc.map -> dist/node/bindings/compiled/node_bindings/o1js_node.bc.map
src/bindings/compiled/node_bindings/plonk_wasm_bg.wasm -> dist/node/bindings/compiled/node_bindings/plonk_wasm_bg.wasm
src/bindings/compiled/node_bindings/plonk_wasm_bg.wasm.d.cts -> dist/node/bindings/compiled/node_bindings/plonk_wasm_bg.wasm.d.cts
src/bindings/compiled/node_bindings/plonk_wasm_bg.wasm.d.ts -> dist/node/bindings/compiled/node_bindings/plonk_wasm_bg.wasm.d.ts
src/bindings/compiled/node_bindings/plonk_wasm.cjs -> dist/node/bindings/compiled/node_bindings/plonk_wasm.cjs
src/bindings/compiled/node_bindings/plonk_wasm.d.cts -> dist/node/bindings/compiled/node_bindings/plonk_wasm.d.cts
�[32m[update-o1js-bindings.sh] ✔ Build artifacts copied�[0m
[update-o1js-bindings.sh] • Running main build...

> [email protected] build
> ./src/build/build.sh

�[1m[build.sh] Starting build�[0m
�[1m[build.sh] [1/5] Ensuring compiled bindings�[0m
�[32m[build.sh] ✔ Found compiled bindings at: /Users/leon/github/o1js-small/src/bindings/compiled�[0m
�[1m[build.sh] [3/5] Cleaning dist/node�[0m
�[32m[build.sh] ✔ dist/node cleaned.�[0m
�[1m[build.sh] [4/5] Running npm run build:dev�[0m

> [email protected] build:dev
> ./scripts/build/build-dev.sh

�[1m[build-dev.sh] Building development version�[0m
[build-dev.sh] • Compiling TypeScript with test configuration...
�[32m[build-dev.sh] ✔ TypeScript compilation complete�[0m
[build-dev.sh] • Copying artifacts to dist...
src/bindings/compiled/node_bindings/o1js_node.bc.cjs -> dist/node/bindings/compiled/node_bindings/o1js_node.bc.cjs
src/bindings/compiled/node_bindings/o1js_node.bc.d.cts -> dist/node/bindings/compiled/node_bindings/o1js_node.bc.d.cts
src/bindings/compiled/node_bindings/o1js_node.bc.map -> dist/node/bindings/compiled/node_bindings/o1js_node.bc.map
src/bindings/compiled/node_bindings/plonk_wasm_bg.wasm -> dist/node/bindings/compiled/node_bindings/plonk_wasm_bg.wasm
src/bindings/compiled/node_bindings/plonk_wasm_bg.wasm.d.cts -> dist/node/bindings/compiled/node_bindings/plonk_wasm_bg.wasm.d.cts
src/bindings/compiled/node_bindings/plonk_wasm_bg.wasm.d.ts -> dist/node/bindings/compiled/node_bindings/plonk_wasm_bg.wasm.d.ts
src/bindings/compiled/node_bindings/plonk_wasm.cjs -> dist/node/bindings/compiled/node_bindings/plonk_wasm.cjs
src/bindings/compiled/node_bindings/plonk_wasm.d.cts -> dist/node/bindings/compiled/node_bindings/plonk_wasm.d.cts
�[32m[build-dev.sh] ✔ Artifacts copied�[0m
�[1;32m[build-dev.sh] Development build complete�[0m
�[32m[build.sh] ✔ build:dev completed.�[0m
�[1m[build.sh] [5/5] Building Node bundle�[0m
building cjs version of ./src/index.ts
using bindings from ./src/bindings/compiled/node_bindings/
finished build
�[32m[build.sh] ✔ Node build completed.�[0m
�[1;32m[build.sh] Build finished successfully.�[0m
�[32m[update-o1js-bindings.sh] ✔ Main build complete�[0m
�[1m[update-o1js-bindings.sh] Phase 2: Building web bindings�[0m

> [email protected] build:wasm:web
> ./scripts/build/wasm/build-web.sh

[wasm-web-build] • building Kimchi bindings for web...
[wasm-web-build] • copying artifacts into the right place...
[wasm-web-build] • optimizing wasm with wasm-opt...
�[32m[wasm-web-build] ✔ wasm optimized�[0m
�[1;32m[wasm-web-build] WASM web build success!�[0m

> [email protected] build:jsoo:web
> ./scripts/build/jsoo/build-web.sh

[jsoo-build-web] • building JSOO artifacts for web...
�[32m[jsoo-build-web] ✔ initial artifacts built successfully!�[0m
[jsoo-build-web] • copying artifacts into the right place...
[jsoo-build-web] • improving error messages in web bindings...
�[32m[jsoo-build-web] ✔ error messages improved�[0m
[jsoo-build-web] • minifying JS with esbuild...
�[32m[jsoo-build-web] ✔ JS minified�[0m
�[1;32m[jsoo-build-web] JSOO artifacts built for web�[0m
�[1m[update-o1js-bindings.sh] Phase 3: Building final project�[0m
[update-o1js-bindings.sh] • Running web build...

> [email protected] build:web
> ./scripts/build/build-web.sh

�[1m[build-web.sh] Building web distribution�[0m
[build-web.sh] • Cleaning previous web build...
�[32m[build-web.sh] ✔ Web directory cleaned�[0m
[build-web.sh] • Building web bundle...
building ./src/index.ts
finished build
�[32m[build-web.sh] ✔ Web bundle built�[0m
�[1;32m[build-web.sh] Web build complete�[0m
�[32m[update-o1js-bindings.sh] ✔ web build complete�[0m
�[1;32m[update-o1js-bindings.sh] Bindings update complete (node + web)�[0m

example output

@bleepbloopsify bleepbloopsify force-pushed the leon/separate-wasm-build branch from e01a3f7 to fffb149 Compare October 14, 2025 19:19
Copy link
Contributor

@Shigoto-dev19 Shigoto-dev19 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I run the scripts myself and I find it clearer and easier to follow than before. Well done 👏

Copy link
Member

@Trivo25 Trivo25 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks clean!

@bleepbloopsify bleepbloopsify force-pushed the leon/separate-wasm-build branch 3 times, most recently from 1da14f5 to 8ce138e Compare October 16, 2025 15:48
@bleepbloopsify bleepbloopsify force-pushed the leon/separate-wasm-build branch from 8ce138e to e8ab8fd Compare October 16, 2025 15:49
@bleepbloopsify bleepbloopsify merged commit 2b2dd3b into main Oct 16, 2025
52 of 53 checks passed
@bleepbloopsify bleepbloopsify deleted the leon/separate-wasm-build branch October 16, 2025 18:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Isolate WASM build

3 participants