A website written in Go using WebAssembly and Vugu that converts strings to and from various encodings.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
1.4 KiB

defaultName = "wasmconv"
defaultTarget = "serve_dev"
def wasmconv_serve_dev():
shell.Exec("go run . -dev")
def wasmconv_dist():
distDir = "dist"
if file.Exists(distDir):
log.Warn("Found existing dist dir, replacing")
shell.Exec("rm -r " + distDir)
log.Info("Finding wasm_exec.js")
GOROOT = shell.Exec("go env GOROOT", output='return')
GOROOT = strings.TrimSpace(GOROOT)
WasmExecPath = GOROOT + "/misc/wasm/wasm_exec.js"
if not file.Exists(WasmExecPath):
log.Fatal("File wasm_exec.js not found")
log.Info("Found wasm_exec.js at " + WasmExecPath)
shell.Exec("mkdir " + distDir)
shell.Exec(fmt.Sprintf("cp -v %s %s/wasm_exec.js", WasmExecPath, distDir))
if shell.LookPath("vugugen") == -1:
log.Info("Command `vugugen` not found, installing")
log.Info("Generating code and building wasm")
go generate .
env GOOS=js GOARCH=wasm go build -o %s/main.wasm
""", distDir))
log.Info("Copying static assets")
shell.Exec("cp -rv assets/* " + distDir)
log.Info("Building server executables")
env GOOS=linux GOARCH=amd64 go build -o %s/server-linux-x86_64
env GOOS=linux GOARCH=arm64 go build -o %s/server-linux-aarch64
""", distDir, distDir))
log.Info("Dist complete")