Skip to content

Commit 033f61f

Browse files
committed
Document "build/jsoo" scripts
1 parent 84bc0db commit 033f61f

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

scripts/build/jsoo/build-node.sh

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,21 @@
11
#!/usr/bin/env bash
2-
32
set -Eeuo pipefail
43

4+
# Description:
5+
# Builds the Js_of_OCaml (JSOO) Node bindings for o1js. This script:
6+
# - Compiles the OCaml `jsoo_exports` target using Dune to produce the
7+
# `o1js_node.bc.js` JavaScript output.
8+
# - Copies the generated artifact to `src/bindings/compiled/node_bindings/`
9+
# for use by the Node.js runtime (after getting copied again later to dist/node/).
10+
# - Creates a placeholder TypeScript declaration file (`.d.cts`) for type resolution.
11+
# - Renames the output to CommonJS format (`.cjs`) and fixes internal references:
12+
# - Updates WASM import paths.
13+
# - Adjusts error-handling functions for Node compatibility.
14+
#
15+
# Usage:
16+
# npm run build:jsoo:node
17+
18+
519
source ./scripts/lib/ux.sh
620

721
JSOO_PATH=./src/bindings/ocaml/jsoo_exports/

scripts/build/jsoo/build-web.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,20 @@
11
#!/usr/bin/env bash
22
set -Eeuo pipefail
33

4+
# Description:
5+
# Builds the Js_of_OCaml (JSOO) Web bindings for o1js. This script:
6+
# - Compiles the OCaml `jsoo_exports` target using Dune via Js_of_OCaml,
7+
# producing the `o1js_web.bc.js` JavaScript output for browser environments.
8+
# - Copies the generated artifact to `src/bindings/compiled/web_bindings/`
9+
# for inclusion in the o1js web distribution (after getting copied again later to dist/web/).
10+
# - Transforms OCaml-style exceptions into standard JavaScript `Error` objects
11+
# to improve debugging and runtime compatibility.
12+
# - Minifies the resulting JavaScript using `esbuild` for smaller bundle size.
13+
#
14+
# Usage:
15+
# npm run build:jsoo:web
16+
17+
418
source ./scripts/lib/ux.sh
519

620
JSOO_PATH=./src/bindings/ocaml/jsoo_exports/

0 commit comments

Comments
 (0)