Skip to content

Commit 9e58aa5

Browse files
committed
fix: try to fix github pages
1 parent 32d5081 commit 9e58aa5

File tree

2 files changed

+24
-4
lines changed

2 files changed

+24
-4
lines changed

scripts/build_wasm.sh

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,23 @@
11
#!/bin/bash
2+
set -e # Exit on any error
3+
4+
# Ensure static directory exists
5+
mkdir -p static
6+
7+
# Build WASM binary
8+
echo "Building WASM binary..."
29
GOOS=js GOARCH=wasm go build -o static/analyzer.wasm wasm/analyzer.go
3-
cp "$(go env GOROOT)/misc/wasm/wasm_exec.js" static/
10+
if [ $? -ne 0 ]; then
11+
echo "Failed to build WASM binary"
12+
exit 1
13+
fi
14+
15+
# Copy wasm_exec.js
16+
echo "Copying wasm_exec.js..."
17+
cp "$(go env GOROOT)/misc/wasm/wasm_exec.js" static/
18+
if [ $? -ne 0 ]; then
19+
echo "Failed to copy wasm_exec.js"
20+
exit 1
21+
fi
22+
23+
echo "WASM build completed successfully"

templates/index.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<meta name="viewport" content="width=device-width, initial-scale=1.0">
66
<title>Code Complexity Visualizer</title>
77
<script src="https://d3js.org/d3.v7.min.js"></script>
8-
<script src="/static/wasm_exec.js"></script>
8+
<script src="static/wasm_exec.js"></script>
99
<style>
1010
:root {
1111
--primary-color: #4293c3;
@@ -477,7 +477,7 @@ <h4>Recommendations for Clean Code</h4>
477477
try {
478478
const go = new Go();
479479
const result = await WebAssembly.instantiateStreaming(
480-
fetch("/static/analyzer.wasm"),
480+
fetch("static/analyzer.wasm"),
481481
go.importObject
482482
);
483483
wasmInstance = result.instance;
@@ -574,7 +574,7 @@ <h4>Recommendations for Clean Code</h4>
574574

575575
async function fetchSampleCode(type) {
576576
try {
577-
const response = await fetch(`/static/samples/${type}.go`);
577+
const response = await fetch(`static/samples/${type}.go`);
578578
if (!response.ok) {
579579
throw new Error('Failed to load sample code');
580580
}

0 commit comments

Comments
 (0)