summaryrefslogtreecommitdiff
path: root/crates/wipfel
diff options
context:
space:
mode:
authorJohannes Hofmann <Johannes.Hofmann@gmx.de>2026-10-27 15:13:46 +0100
committerJohannes Hofmann <Johannes.Hofmann@gmx.de>2026-10-27 15:13:46 +0100
commitbeeba1a1da4e7abff0de2cc6420fb5bae580861c (patch)
tree380dd99c1190acc1e9b603c3368ba24d5c46dde3 /crates/wipfel
parent63b1f6fdadf6c99060f9794d100e46efe200a486 (diff)
web: release build script producing a deployable static site
build-release.sh assembles dist/wipfel/ with the loader page, style, wasm bundle and the gzipped hill database. All runtime fetches are relative to the page URL, so the directory works under any path on any static server (verified from a subdirectory).
Diffstat (limited to 'crates/wipfel')
-rwxr-xr-xcrates/wipfel/build-release.sh18
-rw-r--r--crates/wipfel/www/index.html15
2 files changed, 33 insertions, 0 deletions
diff --git a/crates/wipfel/build-release.sh b/crates/wipfel/build-release.sh
new file mode 100755
index 0000000..0bec70f
--- /dev/null
+++ b/crates/wipfel/build-release.sh
@@ -0,0 +1,18 @@
+#!/bin/sh
+# Build wipfel and assemble a deployable static site in dist/wipfel/.
+# Everything the app loads (wasm, hill database, stylesheet) is fetched
+# relative to the page URL, so the directory can be mounted under any
+# path on any static server.
+set -e
+cd "$(dirname "$0")/../.."
+cargo build -p wipfel --target wasm32-unknown-unknown --release
+DIST=dist/wipfel
+rm -rf "$DIST"
+mkdir -p "$DIST"
+wasm-bindgen --target web --out-dir "$DIST" target/wasm32-unknown-unknown/release/wipfel.wasm
+# the loader page (not the trunk entry point, which is dev-only)
+rm -f "$DIST"/wipfel.d.ts "$DIST"/wipfel_bg.wasm.d.ts
+cp crates/wipfel/www/index.html crates/wipfel/www/style.css "$DIST/"
+gzip -9 -n -c gipfel.dat > "$DIST/gipfel.dat.gz"
+echo "site assembled in $DIST ($(du -sh "$DIST" | cut -f1)):"
+ls "$DIST"
diff --git a/crates/wipfel/www/index.html b/crates/wipfel/www/index.html
new file mode 100644
index 0000000..5297a72
--- /dev/null
+++ b/crates/wipfel/www/index.html
@@ -0,0 +1,15 @@
+<!doctype html>
+<html lang="en">
+ <head>
+ <meta charset="utf-8" />
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+ <title>wipfel — web based gipfel photogrammetry</title>
+ <link rel="stylesheet" href="style.css" />
+ </head>
+ <body>
+ <script type="module">
+ import init from './wipfel.js';
+ init();
+ </script>
+ </body>
+</html>