2.3 KiB · text History 904aa0c
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"
# Swap for `podman compose` if you prefer.
compose := "docker compose"

# List available recipes
default:
    @just --list

# Install JS deps (run once after cloning)
deps:
    cd {{assets_dir}} && npm install

# One-shot build: CSS + JS + vendored webfonts
assets: webfonts js
    cd {{assets_dir}} && {{tailwind}} -c tailwind.config.js -i {{css_in}} -o {{css_out}}

# Bundle + minify JS (imports htmx)
js:
    cd {{assets_dir}} && {{esbuild}} {{js_in}} --bundle --minify --outfile={{js_out}}

# Copy FontAwesome webfonts 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/

# Rebuild CSS on change (build JS + webfonts once first)
watch: webfonts js
    cd {{assets_dir}} && {{tailwind}} -c tailwind.config.js -i {{css_in}} -o {{css_out}} --watch

# Apply pending DB migrations
migrate:
    cargo run -p migration -- up

# Run the webservice (auto-migrates by default)
serve:
    cargo run --bin webservice

# Mint an invite token. Usage: just invite [days]
invite days="7":
    cargo run --bin registration-token -- create --days {{days}}

# Lint + tests
check:
    cargo check --workspace --all-targets
    cargo test

# --- container stack (postgres + app) ---

# Bring up infrastructure only (for local `just serve`)
infra:
    {{compose}} up -d postgres

# Build + bring up the whole stack
up:
    {{compose}} up -d --build

down:
    {{compose}} down

logs:
    {{compose}} logs -f webservice

# Mint an invite inside the running webservice container
invite-in-pod days="7":
    {{compose}} exec webservice app-registration-token create --days {{days}}

# --- dev -> prod data (see scripts/db-transfer.sh) ---

# Dump the dev DB, minus test accounts and dev-only rows. Usage: just db-export [file]
db-export file="":
    scripts/db-transfer.sh export {{file}}

# Replace prod's DB with a dump (backs prod up first, asks to confirm)
db-import file:
    scripts/db-transfer.sh import {{file}}