16 lines
868 B
Bash
Executable file
16 lines
868 B
Bash
Executable file
#!/bin/sh
|
|
# Build minified bundles from the JSX sources (matches what's deployed).
|
|
set -e
|
|
cd "$(dirname "$0")"
|
|
for f in components tweaks-panel app; do
|
|
npx -y esbuild@0.24 "$f.jsx" --loader:.jsx=jsx --jsx=transform --minify --target=es2020 --outfile="$f.min.js" --log-level=warning
|
|
done
|
|
node build-pages.mjs
|
|
python3 scripts/snapshot-home.py # crawler snapshot of root from the fresh bundles
|
|
# Images too (Cloudflare keeps them ~14d and the purge token lacks cache perms); before the JS hash so it covers the stamped bundles.
|
|
python3 scripts/stamp-images.py
|
|
# Cache-bust: Cloudflare caches assets 4h; stamp content hashes into HTML refs.
|
|
for a in components.min.js tweaks-panel.min.js app.min.js styles.css; do
|
|
h=$(md5sum "$a" | cut -c1-8)
|
|
find . -name index.html -not -path './node_modules/*' -exec sed -i -E "s#(\"/$a)(\?v=[0-9a-f]+)?\"#\1?v=$h\"#g" {} +
|
|
done
|