Make the deploy_actdev script work again

This commit is contained in:
Dustin Carlino 2021-04-24 13:57:00 -07:00
parent a09bbd37c2
commit 97b41b9e19
2 changed files with 9 additions and 44 deletions

View File

@ -1,33 +0,0 @@
<!DOCTYPE html>
<!-- This is an example of having a "normal" page load A/B Street in the
background. When the user clicks a button on the page, swap the visible
layers and suddenly it's running! -->
<html>
<head>
<script type="module">
import { default as init } from './game.js';
async function run() {
await init('./game_bg.wasm');
}
run();
</script>
<script type="text/javascript">
function show_wasm() {
document.getElementById('widgetry-canvas').style.display = 'inline';
document.getElementById('normal_page').style.display = 'none';
}
</script>
</head>
<body>
<div id="normal_page">
<h1>This is the normal webpage. A/B Street is being loaded in the background.</h1>
<p>Can you feel the lag?</p>
<button type="button" onclick="show_wasm()">Switch to WASM app</button>
</div>
<div id="widgetry-canvas" style="display: none">
<h1>Loading...</h1>
</div>
</body>
<html>

View File

@ -1,18 +1,16 @@
#!/bin/bash
# This is like deploy_web.sh, but just creates a directory for https://github.com/cyipt/actdev
#
# IMPORTANT: First run deploy_web.sh to actually build everything. This script
# assumes web/build/dist is up-to-date.
set -x
set -e
mkdir -p abst_actdev
cd game
wasm-pack build --release --target web -- --no-default-features --features wasm
# Temporarily remove the symlink to the data directory
rm -f pkg/system
# Expand symlinks
cp -Hv pkg/* ../abst_actdev
# Restore the symlink
git checkout pkg/system
cd ..
mkdir abst_actdev
cp -Rv web/build/dist/abstreet* abst_actdev
# We're not packaging multiple apps, so set the index.html
mv abst_actdev/abstreet.html abst_actdev/index.html
# Copy just what's needed from data
mkdir -p abst_actdev/system/gb
@ -22,7 +20,7 @@ for dir in allerton_bywater ashton_park aylesbury aylesham bailrigg bath_riversi
cp -Rv data/system/gb/$dir abst_actdev/system/gb
done
cp -Rv data/system/study_areas abst_actdev/system
gzip `find abst_actdev/ | grep bin | xargs`
gzip -v `find abst_actdev/ | grep bin | xargs`
zip -r abst_actdev abst_actdev
rm -rf abst_actdev