From 8c0104e064b3b4cea57dd443c52efb39cc18eba5 Mon Sep 17 00:00:00 2001 From: Xe Iaso Date: Mon, 8 Sep 2025 22:47:29 +0000 Subject: [PATCH] chore(web): fix TypeScript build logic Signed-off-by: Xe Iaso --- web/build.sh | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/web/build.sh b/web/build.sh index 84aa654b..d0818e0c 100755 --- a/web/build.sh +++ b/web/build.sh @@ -39,9 +39,18 @@ for the JavaScript code in this page. mkdir -p static/locales cp ../lib/localization/locales/*.json static/locales/ -for file in js/*.mjs js/worker/*.mjs; do - esbuild "${file}" --sourcemap --bundle --minify --outfile=static/"${file}" --banner:js="${LICENSE}" - gzip -f -k -n static/${file} - zstd -f -k --ultra -22 static/${file} - brotli -fZk static/${file} +shopt -s nullglob globstar + +for file in js/**/*.ts js/**/*.mjs; do + out="static/${file}" + if [[ "$file" == *.ts ]]; then + out="static/${file%.ts}.mjs" + fi + + mkdir -p "$(dirname "$out")" + + esbuild "$file" --sourcemap --bundle --minify --outfile="$out" --banner:js="$LICENSE" + gzip -f -k -n "$out" + zstd -f -k --ultra -22 "$out" + brotli -fZk "$out" done