diff options
author | Joris | 2025-04-19 14:02:54 +0200 |
---|---|---|
committer | Joris | 2025-04-19 14:02:54 +0200 |
commit | d4b48491cfaafaee5e7c9c88227055fd884d60f4 (patch) | |
tree | 49be96db72e1cc8dcfcc128b3b7d5286e16180c7 | |
parent | 632eef6424d8dc8d40c2906177892697679e7b85 (diff) |
Add build command
-rw-r--r-- | README.md | 4 | ||||
-rwxr-xr-x | bin/build | 8 | ||||
-rwxr-xr-x | frontend/bin/compile-sass | 13 | ||||
-rwxr-xr-x | frontend/bin/compile-ts | 14 | ||||
-rwxr-xr-x | frontend/bin/dev-server | 2 |
5 files changed, 39 insertions, 2 deletions
@@ -21,6 +21,10 @@ Credentials are: - john@mail.com / password - lisa@mail.com / password +## Build + + nix develop --command bin/build + ## Improvements - mobile view diff --git a/bin/build b/bin/build new file mode 100755 index 0000000..907415a --- /dev/null +++ b/bin/build @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +set -euo pipefail + +# frontend +(cd frontend; make clean build) + +# backend +(cd backend; zig build --release=fast) diff --git a/frontend/bin/compile-sass b/frontend/bin/compile-sass index 79d5415..fc99767 100755 --- a/frontend/bin/compile-sass +++ b/frontend/bin/compile-sass @@ -1,3 +1,14 @@ #!/usr/bin/env bash set -euo pipefail -sass --no-error-css styles/main.sass ../backend/public/main.css + +if [ -n "${IS_DEV_SERVER:-}" ]; then + + # dev + sass --no-error-css styles/main.sass ../backend/public/main.css + +else + + # prod + sass --no-error-css --style=compressed styles/main.sass ../backend/public/main.css + +fi diff --git a/frontend/bin/compile-ts b/frontend/bin/compile-ts index 0e1d62a..019efd3 100755 --- a/frontend/bin/compile-ts +++ b/frontend/bin/compile-ts @@ -2,5 +2,17 @@ set -euo pipefail cd ts + tsc --noEmit -esbuild --bundle src/main.ts > ../../backend/public/main.js + +if [ -n "${IS_DEV_SERVER:-}" ]; then + + # dev + esbuild --bundle src/main.ts > ../../backend/public/main.js + +else + + # prod + esbuild --minify --bundle src/main.ts > ../../backend/public/main.js + +fi diff --git a/frontend/bin/dev-server b/frontend/bin/dev-server index 4819033..3601105 100755 --- a/frontend/bin/dev-server +++ b/frontend/bin/dev-server @@ -1,6 +1,8 @@ #!/usr/bin/env bash set -euo pipefail +export IS_DEV_SERVER=1 + # Killing watchexec ourselves, it may not be done otherwise. function finish { if [ -n "${LIVE_SERVER_PID:-}" ]; then |