You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
962 B
Plaintext

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
# Size pass
wasm-opt -Oz \
-o dist/{{GAME}}.wasm \
${CARGO_TARGET_DIR}/wasm32-unknown-unknown/release/{{GAME}}.wasm
# wasm bindgen
wasm-bindgen --no-typescript --target web \
--out-dir ./dist/{{GAME}} \
--out-name "bin" \
dist/{{GAME}}.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 GAME: (web GAME)
butler push --dry-run dist/{{GAME}} popgame/{{GAME}}:html5 --userversion={{VERSION}}
clean:
rm -rf dist/*