wasm: && clean-wasm-pack
    # build with wasm-pack
    wasm-pack build --target web

wasm-dev: && clean-wasm-pack
    wasm-pack build --dev --target web 

clean-wasm-pack:
    # delete cruft from wasm-pack
    rm pkg/.gitignore pkg/package.json pkg/README.md
    rm -rf pkg/snippets
    # fix imports of rudus.js
    cp pkg/rudus.js pkg/rudus.js.backup
    echo 'import { io } from "./worker.js"' > pkg/rudus.js
    cat pkg/rudus.js.backup | tail -n+2>> pkg/rudus.js
    rm pkg/rudus.js.backup


serve:
    open http://localhost:8080/index.html && miniserve pkg

default:
    @just --list
