2023-06-27 18:03:52 +00:00
|
|
|
#!/usr/bin/env just --justfile
|
|
|
|
|
2023-06-28 05:20:04 +00:00
|
|
|
build: build-frontend
|
|
|
|
cargo build --release
|
|
|
|
|
|
|
|
install-frontend:
|
|
|
|
bun install --cwd frontend
|
|
|
|
|
|
|
|
clean-frontend:
|
2023-09-02 18:01:18 +00:00
|
|
|
rm -rf ./static/js/* ./static/css/* ./static/img/*
|
2023-06-28 05:20:04 +00:00
|
|
|
|
2023-06-29 04:00:26 +00:00
|
|
|
build-frontend: clean-frontend
|
2023-06-29 04:34:09 +00:00
|
|
|
bun build frontend/js/index.ts \
|
|
|
|
--outdir ./static \
|
|
|
|
--root ./frontend \
|
|
|
|
--entry-naming [dir]/[name]-[hash].[ext] \
|
2023-09-02 18:01:18 +00:00
|
|
|
--chunk-naming [dir]/[name]-[hash].[ext] \
|
2023-06-29 04:34:09 +00:00
|
|
|
--asset-naming [dir]/[name]-[hash].[ext] \
|
2023-06-29 04:00:26 +00:00
|
|
|
--minify
|
2023-09-02 18:01:18 +00:00
|
|
|
mkdir -p static/img
|
|
|
|
cp frontend/img/* static/img/
|
2023-07-06 00:05:03 +00:00
|
|
|
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
|
2023-06-29 04:00:26 +00:00
|
|
|
|
|
|
|
build-dev-frontend: clean-frontend
|
2023-06-29 04:34:09 +00:00
|
|
|
bun build frontend/js/index.ts \
|
|
|
|
--outdir ./static \
|
|
|
|
--root ./frontend \
|
|
|
|
--entry-naming [dir]/[name]-[hash].[ext] \
|
2023-09-02 18:01:18 +00:00
|
|
|
--chunk-naming [dir]/[name]-[hash].[ext] \
|
2023-06-29 04:34:09 +00:00
|
|
|
--asset-naming [dir]/[name]-[hash].[ext]
|
2023-09-02 18:01:18 +00:00
|
|
|
mkdir -p static/img
|
|
|
|
cp frontend/img/* static/img/
|
2023-07-06 01:14:31 +00:00
|
|
|
touch ./static/js/manifest.txt # create empty manifest needed so binary compiles
|
|
|
|
touch ./static/css/manifest.txt # create empty manifest needed so binary compiles
|
2023-07-06 00:05:03 +00:00
|
|
|
# in development mode, frontend changes do not trigger a rebuild of the backend
|
2023-06-28 05:20:04 +00:00
|
|
|
|
|
|
|
watch-frontend: install-frontend
|
|
|
|
cargo watch -w frontend \
|
2023-06-29 04:00:26 +00:00
|
|
|
-s 'just build-dev-frontend'
|
2023-06-28 05:20:04 +00:00
|
|
|
|
|
|
|
watch-backend:
|
2023-09-28 03:11:52 +00:00
|
|
|
cargo watch \
|
2023-06-28 05:20:04 +00:00
|
|
|
--ignore 'logs/*' \
|
|
|
|
--ignore 'static/*' \
|
|
|
|
--ignore 'frontend/*' \
|
2023-07-06 03:45:49 +00:00
|
|
|
--ignore 'content/*' \
|
2023-06-29 04:00:26 +00:00
|
|
|
--no-vcs-ignores \
|
2023-06-28 05:20:04 +00:00
|
|
|
-x run
|
|
|
|
|
2023-06-29 04:00:26 +00:00
|
|
|
# runs watch-frontend and watch-backend simultaneously
|
2023-06-28 05:20:04 +00:00
|
|
|
watch:
|
|
|
|
./watch.sh
|
|
|
|
|
|
|
|
migrate:
|
|
|
|
sqlx migrate run
|