From 632eef6424d8dc8d40c2906177892697679e7b85 Mon Sep 17 00:00:00 2001 From: Joris Date: Sat, 19 Apr 2025 12:36:38 +0200 Subject: Add ZIG server --- frontend/bin/compile-sass | 3 +++ frontend/bin/compile-ts | 6 ++++++ frontend/bin/dev-server | 23 +++++++++++++++++++++++ 3 files changed, 32 insertions(+) create mode 100755 frontend/bin/compile-sass create mode 100755 frontend/bin/compile-ts create mode 100755 frontend/bin/dev-server (limited to 'frontend/bin') diff --git a/frontend/bin/compile-sass b/frontend/bin/compile-sass new file mode 100755 index 0000000..79d5415 --- /dev/null +++ b/frontend/bin/compile-sass @@ -0,0 +1,3 @@ +#!/usr/bin/env bash +set -euo pipefail +sass --no-error-css styles/main.sass ../backend/public/main.css diff --git a/frontend/bin/compile-ts b/frontend/bin/compile-ts new file mode 100755 index 0000000..0e1d62a --- /dev/null +++ b/frontend/bin/compile-ts @@ -0,0 +1,6 @@ +#!/usr/bin/env bash +set -euo pipefail + +cd ts +tsc --noEmit +esbuild --bundle src/main.ts > ../../backend/public/main.js diff --git a/frontend/bin/dev-server b/frontend/bin/dev-server new file mode 100755 index 0000000..4819033 --- /dev/null +++ b/frontend/bin/dev-server @@ -0,0 +1,23 @@ +#!/usr/bin/env bash +set -euo pipefail + +# Killing watchexec ourselves, it may not be done otherwise. +function finish { + if [ -n "${LIVE_SERVER_PID:-}" ]; then + kill "$LIVE_SERVER_PID" > /dev/null 2>&1 + fi +} + +trap finish EXIT + +watchexec \ + --clear \ + --watch ts \ + --watch html \ + --watch images \ + --watch styles \ + --debounce 100ms \ + -- make & +LIVE_SERVER_PID="$!" + +while true; do sleep 1; done -- cgit v1.2.3