From bb5ec8765455119be390accfef066971016454f9 Mon Sep 17 00:00:00 2001 From: mkelvers Date: Tue, 16 Jun 2026 13:41:22 +0200 Subject: [PATCH] feat: rewrite build-ts script in shell --- scripts/build-ts.sh | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100755 scripts/build-ts.sh diff --git a/scripts/build-ts.sh b/scripts/build-ts.sh new file mode 100755 index 0000000..27a7410 --- /dev/null +++ b/scripts/build-ts.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash +set -euo pipefail + +started_at=$(date +%s%N) + +steps=( + "player:bun build ./static/player/main.ts --outdir ./dist/static/player --target browser --splitting" + "app:bun build ./static/app.ts --outdir ./dist/static --target browser --root ./static --entry-naming [name].js" +) + +for step in "${steps[@]}"; do + name="${step%%:*}" + cmd="${step#*:}" + echo "building $name..." + if ! eval "$cmd"; then + echo "ts build failed at $name" >&2 + exit 1 + fi +done + +mkdir -p ./dist/static +cp ./node_modules/htmx.org/dist/htmx.min.js ./dist/static/htmx-lib.js + +total_entries=2 +elapsed_ms=$((($(date +%s%N) - started_at) / 1000000)) +echo "ts build ok ($total_entries entries, ${elapsed_ms}ms)" \ No newline at end of file