File tree Expand file tree Collapse file tree 2 files changed +24
-4
lines changed
Expand file tree Collapse file tree 2 files changed +24
-4
lines changed Original file line number Diff line number Diff line change 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..."
29GOOS=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"
Original file line number Diff line number Diff line change 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 }
You can’t perform that action at this time.
0 commit comments