2024-01-30 23:27:02 +01:00
|
|
|
port := env_var_or_default('PORT', '3080')
|
|
|
|
|
2024-02-22 20:13:23 +01:00
|
|
|
# Tailwind in watch mode
|
|
|
|
tailwind:
|
|
|
|
npx tailwindcss -i ./styles/input.css -o ./styles/output.css --watch
|
|
|
|
|
|
|
|
server_dev:
|
|
|
|
cargo watch -x run
|
|
|
|
|
2024-01-30 23:27:02 +01:00
|
|
|
# Run dev server in watch mode
|
|
|
|
dev:
|
2024-02-22 20:13:23 +01:00
|
|
|
(just server_dev; just tailwind) | parallel
|
2024-01-30 23:27:02 +01:00
|
|
|
|
2024-02-27 22:53:08 +01:00
|
|
|
# Run dev server in watch mode
|
|
|
|
test:
|
|
|
|
cargo test
|
|
|
|
|
2024-01-30 23:27:02 +01:00
|
|
|
# Run server in production mode
|
|
|
|
prod:
|
|
|
|
cargo run --release
|
|
|
|
|
|
|
|
# Wait for port to listen to connections
|
|
|
|
wait_for_port:
|
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -euxo pipefail
|
|
|
|
while ! nc -z localhost {{port}}; do
|
|
|
|
sleep 3
|
|
|
|
done
|
|
|
|
|
|
|
|
# Kill the application running on port
|
|
|
|
kill:
|
|
|
|
kill $(lsof -t -i:{{port}})
|
|
|
|
|
|
|
|
# Clean the dist folder
|
|
|
|
clean:
|
|
|
|
rm -rf dist
|
|
|
|
|
|
|
|
# SSG export of production server
|
|
|
|
export: clean
|
|
|
|
just prod &
|
|
|
|
just wait_for_port
|
|
|
|
- wget --convert-links -r -p --level 1 -E -P dist --no-host-directories localhost:{{port}}
|
|
|
|
just kill
|