Tyler Hallada
5169fac218
Now frontend changes appear as fast as Bun can bundle them instead of needing to wait for rust to compile too.
49 lines
1.2 KiB
Makefile
Executable File
49 lines
1.2 KiB
Makefile
Executable File
#!/usr/bin/env just --justfile
|
|
|
|
build: build-frontend
|
|
cargo build --release
|
|
|
|
install-frontend:
|
|
bun install --cwd frontend
|
|
|
|
clean-frontend:
|
|
rm -rf ./static/js/* ./static/css/*
|
|
|
|
build-frontend: clean-frontend
|
|
bun build frontend/js/index.ts \
|
|
--outdir ./static \
|
|
--root ./frontend \
|
|
--entry-naming [dir]/[name]-[hash].[ext] \
|
|
--asset-naming [dir]/[name]-[hash].[ext] \
|
|
--minify
|
|
touch ./static/js/manifest.txt # create empty manifest to be overwritten by build.rs
|
|
touch ./static/css/manifest.txt # create empty manifest to be overwritten by build.rs
|
|
touch .frontend-built # trigger build.rs to run
|
|
|
|
build-dev-frontend: clean-frontend
|
|
bun build frontend/js/index.ts \
|
|
--outdir ./static \
|
|
--root ./frontend \
|
|
--entry-naming [dir]/[name]-[hash].[ext] \
|
|
--asset-naming [dir]/[name]-[hash].[ext]
|
|
# in development mode, frontend changes do not trigger a rebuild of the backend
|
|
|
|
watch-frontend: install-frontend
|
|
cargo watch -w frontend \
|
|
-s 'just build-dev-frontend'
|
|
|
|
watch-backend:
|
|
mold -run cargo watch \
|
|
--ignore 'logs/*' \
|
|
--ignore 'static/*' \
|
|
--ignore 'frontend/*' \
|
|
--no-vcs-ignores \
|
|
-x run
|
|
|
|
# runs watch-frontend and watch-backend simultaneously
|
|
watch:
|
|
./watch.sh
|
|
|
|
migrate:
|
|
sqlx migrate run
|