set shell := ["bash", "-cu"]
assets_dir := "assets"
tailwind := "./node_modules/.bin/tailwindcss"
esbuild := "./node_modules/.bin/esbuild"
css_in := "f/css/style.css"
css_out := "f/css/app.css"
js_in := "f/js/src.js"
js_out := "f/js/app.js"
# Default: list available recipes
default:
@just --list
# Install JS deps (run once after cloning)
deps:
cd {{assets_dir}} && npm install
# One-shot CSS + JS build + sync vendored webfonts
assets: webfonts js
cd {{assets_dir}} && {{tailwind}} -c tailwind.config.js -i {{css_in}} -o {{css_out}}
# Bundle + minify JS (src.js -> app.js)
js:
cd {{assets_dir}} && {{esbuild}} {{js_in}} --bundle --minify --outfile={{js_out}}
# Watch CSS for changes; webfonts/JS rebuild on dep/source change
watch: webfonts js
cd {{assets_dir}} && {{tailwind}} -c tailwind.config.js -i {{css_in}} -o {{css_out}} --watch
# Tailwind rescans templates/ so new utility classes appear automatically;
# minijinja hot-reloads templates, so edits show on a browser refresh (no
# restart). Restart only for Rust changes. Ctrl-C stops everything.
# Run `just db-up` first. Run this in a real terminal (watchers follow stdin).
# Frontend dev loop: watch+rebuild CSS/JS and run the server together
dev: assets
#!/usr/bin/env bash
set -euo pipefail
cd {{assets_dir}}
{{tailwind}} -c tailwind.config.js -i {{css_in}} -o {{css_out}} --watch &
tw=$!
{{esbuild}} {{js_in}} --bundle --outfile={{js_out}} --watch &
es=$!
cd ..
trap 'kill $tw $es 2>/dev/null' EXIT INT TERM
echo "▶ assets watching (tailwind+esbuild); starting server…"
cargo run
# Copy vendored fonts into the served /assets tree.
webfonts:
mkdir -p {{assets_dir}}/f/webfonts
cp -u {{assets_dir}}/node_modules/@fortawesome/fontawesome-free/webfonts/*.woff2 {{assets_dir}}/f/webfonts/
cp -u {{assets_dir}}/node_modules/@fortawesome/fontawesome-free/webfonts/*.ttf {{assets_dir}}/f/webfonts/
# Apply pending DB migrations
migrate:
cargo run -p migration -- up
# Run the webservice (auto-migrates by default)
serve:
cargo run
# Admin CLI passthrough. Usage: just manage user list
manage *args:
cargo run --bin manage -- {{args}}
# Generate an invite token. Usage: just invite [days]
invite days="7":
cargo run --bin manage -- invite create --days {{days}}
# Grant staff/admin. Usage: just staff <username> (add --revoke to remove)
staff username *flags:
cargo run --bin manage -- user set-staff {{username}} {{flags}}
# Set a user's trust level 0-4. Usage: just trust <username> <level>
trust username level:
cargo run --bin manage -- user set-trust {{username}} {{level}}
# Lint + test (unit only)
check:
cargo check --bins --lib
cargo test --lib
# Bring up just Postgres for local dev
db-up:
podman compose up -d postgres
# Build the runtime image
build-image:
podman compose build webservice
# Bring up the full stack (postgres + webservice)
up:
podman compose up -d
down:
podman compose down
# Tail webservice logs
logs:
podman compose logs -f webservice
neiam
/recourse
public · Issues · Pulls · Labels · Forks · Compare · Actions success · Badges · Packages
⭐
Log in to mark this repository.
3.0 KiB · text
History
2264215