#!/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 # 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