Skip to content

Commit 1efb16b

Browse files
committed
scripts: update build to account for napi
1 parent 6124589 commit 1efb16b

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

src/bindings/scripts/build-o1js-node-artifacts.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ run_cmd cp "${MINA_PATH}"/src/config.mlh "src"
5151
run_cmd cp -r "${MINA_PATH}"/src/config "src/config"
5252
ok "Mina config files copied"
5353

54+
info "Building Kimchi native bindings for Node.js..."
55+
run_cmd dune b "${KIMCHI_BINDINGS}"/js/native
56+
ok "Kimchi native bindings built"
57+
5458
info "Building Kimchi bindings for Node.js..."
5559
run_cmd dune b "${KIMCHI_BINDINGS}"/js/node_js
5660
ok "Kimchi bindings built"
@@ -96,6 +100,14 @@ run_cmd mkdir -p "${BINDINGS_PATH}"
96100
run_cmd chmod -R 777 "${BINDINGS_PATH}"
97101
ok "Output directory prepared"
98102

103+
info "Preparing native bindings directory..."
104+
run_cmd mkdir -p src/bindings/compiled/native
105+
ok "Native bindings directory prepared"
106+
107+
info "Copying N-API bindings..."
108+
run_cmd cp _build/default/"${KIMCHI_BINDINGS}"/js/native/plonk_napi* "${BINDINGS_PATH}"
109+
ok "N-API bindings copied"
110+
99111
info "Copying WASM bindings..."
100112
run_cmd cp _build/default/"${KIMCHI_BINDINGS}"/js/node_js/plonk_wasm* "${BINDINGS_PATH}"
101113
run_cmd mv -f "${BINDINGS_PATH}"/plonk_wasm.js "${BINDINGS_PATH}"/plonk_wasm.cjs
@@ -114,6 +126,11 @@ fi
114126
run_cmd mv -f "${BINDINGS_PATH}"/o1js_node.bc.js "${BINDINGS_PATH}"/o1js_node.bc.cjs
115127
ok "Node.js bindings copied"
116128

129+
info "Copying native bindings..."
130+
run_cmd cp _build/default/"${KIMCHI_BINDINGS}"/js/native/plonk_napi.node src/bindings/compiled/native/
131+
run_cmd chmod 777 src/bindings/compiled/native/plonk_napi.node
132+
ok "Native bindings copied"
133+
117134
info "Updating WASM references in bindings..."
118135
run_cmd sed -i 's/plonk_wasm.js/plonk_wasm.cjs/' "${BINDINGS_PATH}"/o1js_node.bc.cjs
119136
ok "WASM references updated"

src/build/copy-to-dist.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ await copyFromTo(
55
[
66
'src/bindings.d.ts',
77
'src/bindings/compiled/_node_bindings',
8+
'src/bindings/compiled/native',
89
'src/bindings/compiled/node_bindings/plonk_wasm.d.cts',
910
],
1011
'src/',

0 commit comments

Comments
 (0)