Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions scripts/build-tplprev.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
#!/bin/bash

cd $(git rev-parse --show-toplevel)
# get the repo root directory safely
REPO_ROOT="$(git rev-parse --show-toplevel)"
cd "$REPO_ROOT" || { echo "Error: Failed to change directory"; exit 1; }

cp "$(go env GOROOT)/misc/wasm/wasm_exec.js" ./docs/assets/

GOARCH=wasm GOOS=js go build -o ./docs/assets/tplprev.wasm ./tplprev
# build webassembly binary
GOARCH=wasm GOOS=js go build -o ./docs/assets/tplprev.wasm ./tplprev
if [ $? -ne 0 ]; then
echo "Error: WASM build failed!"
exit 1
fi

echo "WASM build successful!"