Skip to content

Commit b41a04f

Browse files
committed
chore(docs): Add a warning if the WASM binary hasn't been built yet
1 parent f362444 commit b41a04f

4 files changed

Lines changed: 17 additions & 9 deletions

File tree

docs/layouts/playground/playground.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ <h1>{{- .Title -}}</h1>
2828
{{- $wasm_path := resources.Get "/playground/DLiteScript-playground-wasm" -}}
2929
{{- $worker_path := resources.Match "playground/js/worker/*.js" | resources.Concat "js/playground-worker.js" | js.Build $worker_opts | fingerprint -}}
3030

31+
{{- if not $wasm_path -}}
32+
{{- errorf "WASM file not found: /playground/DLiteScript-playground-wasm. Please build it first by running `./scripts/build-wasm.sh`." -}}
33+
{{- end -}}
34+
3135
<script>
3236
globalThis.playgroundWasmPath = "{{- $wasm_path.RelPermalink -}}"
3337
globalThis.playgroundWorkerPath = "{{- $worker_path.RelPermalink -}}"

docs/scripts/build-wasm.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
cd "$(dirname "$0")/.."
5+
6+
cd assets/playground
7+
GOOS=js GOARCH=wasm go build
8+
9+
# Hugo takes care of this if the file doesn't exist,
10+
# but we want to update the file in case it changes.
11+
cp DLiteScript-playground-wasm ../../public/playground/DLiteScript-playground-wasm
12+
13+
echo "WASM binary built successfully"

scripts/bench.sh

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
#!/usr/bin/env bash
22

3-
# Exit on error.
43
set -e
5-
6-
# Navigate to the root of the project.
74
cd "$(dirname "$0")/.."
85

9-
# Run the tests.
106
go test -bench=. ./... -benchmem -run notest

scripts/compile-binaries.sh

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
11
#!/usr/bin/env bash
22

3-
# Exit on error.
43
set -e
5-
6-
# Navigate to the root of the project.
74
cd "$(dirname "$0")/.."
85

9-
# Create the output directory if it doesn't already exist.
106
mkdir -p output
117

12-
# Set the target platforms.
138
PLATFORMS=(
149
"darwin-x64:darwin:amd64"
1510
"darwin-arm64:darwin:arm64"

0 commit comments

Comments
 (0)