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
|
|
|
|
|
2024-03-13 19:14:10 +01:00
|
|
|
# svg sprite creation
|
|
|
|
svgstore:
|
2024-09-30 21:29:25 +02:00
|
|
|
npx svgstore -o templates/icons/sprite.svg src/svg/**.svg
|
2024-03-13 19:14:10 +01:00
|
|
|
|
2024-02-22 20:13:23 +01:00
|
|
|
server_dev:
|
|
|
|
cargo watch -x run
|
|
|
|
|
2024-05-09 23:26:06 +02:00
|
|
|
# CMS server for local dev
|
|
|
|
decap_server:
|
2024-09-30 21:29:25 +02:00
|
|
|
npx decap-server
|
2024-05-09 23:26:06 +02:00
|
|
|
|
2024-01-30 23:27:02 +01:00
|
|
|
# Run dev server in watch mode
|
|
|
|
dev:
|
2024-08-07 13:18:13 +02:00
|
|
|
#!/usr/bin/env -S parallel --shebang --ungroup --jobs {{ num_cpus() }}
|
|
|
|
just server_dev
|
|
|
|
just tailwind
|
|
|
|
just decap_server
|
2024-01-30 23:27:02 +01:00
|
|
|
|
2024-08-16 23:59:48 +02:00
|
|
|
# Run tests
|
2024-02-27 22:53:08 +01:00
|
|
|
test:
|
|
|
|
cargo test
|
|
|
|
|
2024-08-16 23:59:48 +02:00
|
|
|
test_watch:
|
|
|
|
cargo watch -x test
|
|
|
|
|
2024-01-30 23:27:02 +01:00
|
|
|
# Run server in production mode
|
2024-10-02 15:32:40 +02:00
|
|
|
prod $TARGET="PROD" $RUST_LOG="info":
|
2024-01-30 23:27:02 +01:00
|
|
|
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:
|
2024-09-27 11:52:25 +02:00
|
|
|
kill $(pidof axum_server)
|
2024-01-30 23:27:02 +01:00
|
|
|
|
|
|
|
# Clean the dist folder
|
|
|
|
clean:
|
|
|
|
rm -rf dist
|
|
|
|
|
2024-09-15 22:08:44 +02:00
|
|
|
# SSG
|
|
|
|
ssg:
|
|
|
|
- wget --no-convert-links -r -p -E -P dist --no-host-directories 127.0.0.1:{{port}}
|
2024-10-07 10:17:45 +02:00
|
|
|
- wget --no-convert-links --content-on-error -p -E -P dist --no-host-directories 127.0.0.1:{{port}}/not-found
|
2024-10-02 10:24:24 +02:00
|
|
|
find generated_images/ -name "*_og*" -exec cp --parents {} dist/ \;
|
2024-09-15 22:08:44 +02:00
|
|
|
|
|
|
|
# Preview server
|
|
|
|
preview:
|
2024-10-03 21:12:53 +02:00
|
|
|
caddy run --config Caddyfile-preview
|
2024-09-15 22:08:44 +02:00
|
|
|
|
2024-01-30 23:27:02 +01:00
|
|
|
# SSG export of production server
|
|
|
|
export: clean
|
|
|
|
just prod &
|
|
|
|
just wait_for_port
|
2024-09-15 22:08:44 +02:00
|
|
|
just ssg
|
2024-01-30 23:27:02 +01:00
|
|
|
just kill
|
2024-09-18 12:47:25 +02:00
|
|
|
|
|
|
|
deploy:
|
|
|
|
rsync -avz -e ssh ./dist/ michalvanko@katelyn:.config/containers/systemd/michalvankodev-site/dist/
|