justfile
| 1 | # dovenest developer tasks |
| 2 | |
| 3 | dev-root := '.dev/root' |
| 4 | dev-db := '.dev/db.sqlite' |
| 5 | dev-cache := '.dev/cache' |
| 6 | |
| 7 | # Show the available recipes (runs when you type `just` without arguments). |
| 8 | default: |
| 9 | @just --list |
| 10 | |
| 11 | # Create the dev root folder. |
| 12 | dev-data: |
| 13 | mkdir -p {{dev-root}} |
| 14 | |
| 15 | # Also run `just dev-web` for the HMR frontend dev server on :8080. |
| 16 | # Start the dev backend on :8081 (creates the dev root folder first). |
| 17 | dev: dev-data dev-server |
| 18 | |
| 19 | # Dev backend on :8081 — the API plus static files from web/dist (no HMR). |
| 20 | dev-server: |
| 21 | cargo run -p server -- --root {{dev-root}} --db {{dev-db}} --cache {{dev-cache}} --port 8081 |
| 22 | |
| 23 | # Frontend dev server on :8080 (Trunk with HMR; proxies /api to :8081). |
| 24 | # Trunk strips the /api rewrite prefix, so the backend URL carries it back. |
| 25 | dev-web: build-cm |
| 26 | cd web && trunk serve --proxy-rewrite /api --proxy-backend http://127.0.0.1:8081/api |
| 27 | |
| 28 | # Build the frontend and stage it into server/dist for the embedded build. |
| 29 | frontend: build-cm |
| 30 | cd web && trunk build --release |
| 31 | rm -rf server/dist |
| 32 | cp -r web/dist server/dist |
| 33 | |
| 34 | # Production single binary (frontend embedded). |
| 35 | build: frontend |
| 36 | cargo build --locked --release -p server --features embedded |
| 37 | |
| 38 | # Production end-to-end: build the real frontend, embed it, and check the embedded assets. |
| 39 | e2e: frontend |
| 40 | cargo test -p server --features embedded --test api embedded |
| 41 | |
| 42 | # Requires bun (https://bun.sh); web/bun.lock pins the dependencies and |
| 43 | # web/cm6.js is a gitignored build artifact. Runs automatically via `build`, |
| 44 | # `dev-web` and `e2e`. |
| 45 | # Build the vendored CodeMirror bundle (web/cm6.js) from web/cm/wrapper.js. |
| 46 | build-cm: |
| 47 | cd web && bun install --frozen-lockfile && bun run build |
| 48 | |
| 49 | # Run the production binary against the dev folders. |
| 50 | run: dev-data build |
| 51 | ./target/release/dovenest --root {{dev-root}} --db {{dev-db}} --cache {{dev-cache}} |
| 52 | |
| 53 | # All workspace test suites (unit + integration tests). |
| 54 | test: |
| 55 | cargo test --workspace |
| 56 | |
| 57 | # Lint: formatting check + clippy with warnings denied. |
| 58 | lint: |
| 59 | cargo fmt --check |
| 60 | cargo clippy --workspace --all-targets -- -D warnings |
| 61 | |
| 62 | # Format the whole workspace. |
| 63 | fmt: |
| 64 | cargo fmt |
| 65 | |
| 66 | # Coverage report (requires `cargo install cargo-llvm-cov` + `rustup component add llvm-tools`). |
| 67 | cov: |
| 68 | cargo llvm-cov -p server |
| 69 | |
| 70 | # Remove the dev database (factory reset of users/shares/settings). |
| 71 | reset-db: |
| 72 | rm -f {{dev-db}} {{dev-db}}-wal {{dev-db}}-shm |
| 73 |