VERSION := `git rev-parse --short HEAD` # Build the web version web GAME: # base directory mkdir -p dist/{{GAME}}/assets/{{GAME}} # wasm binary cargo build --bin {{GAME}} --profile wasm-release --target wasm32-unknown-unknown # wasm bindgen wasm-bindgen --no-typescript --target web \ --out-dir ./dist/{{GAME}} \ --out-name "bin" \ ${CARGO_TARGET_DIR}/wasm32-unknown-unknown/release/{{GAME}}.wasm # Size pass wasm-opt -Oz \ -o dist/{{GAME}}/bin_bg-tmp.wasm \ ./dist/{{GAME}}/bin_bg.wasm # Replace old bin with new (compressed) bin mv ./dist/{{GAME}}/bin_bg-tmp.wasm ./dist/{{GAME}}/bin_bg.wasm # index.html cp ./web/{{GAME}}.html ./dist/{{GAME}}/index.html # assest rm -rf dist/{{GAME}}/assets/{{GAME}} cp -r assets/{{GAME}} dist/{{GAME}}/assets/{{GAME}} # Helpful shorthand to serve files serve GAME: (web GAME) simple-http-server dist/{{GAME}} itchio-dry GAME: (web GAME) butler push --dry-run dist/{{GAME}} popgame/{{GAME}}:html5 --userversion={{VERSION}} itchio GAME: (web GAME) butler push dist/{{GAME}} popgame/{{GAME}}:html5 --userversion={{VERSION}} clean: rm -rf dist/*