justfile
⎇
Raw
1# filebrowser-ng developer tasks
2
3dev-root := '.dev/root'
4dev-db := '.dev/db.sqlite'
5
6default: dev
7
8# Create the dev root folder.
9dev-data:
10 mkdir -p {{dev-root}}
11
12# Backend (dev): serves the frontend from Trunk's output directory.
13# Frontend dev server: just dev-web (port 8080)
14# Backend dev server: just dev-server (port 8081, /api proxied by Trunk)
15dev: dev-data dev-server
16
17dev-server:
18 cargo run -p server -- --root {{dev-root}} --db {{dev-db}} --port 8081
19
20dev-web: build-cm
21 cd web && trunk serve --proxy-rewrite /api --proxy-backend http://127.0.0.1:8081
22
23# Build the frontend and stage it into server/dist for the embedded build.
24frontend: build-cm
25 cd web && trunk build --release
26 rm -rf server/dist
27 cp -r web/dist server/dist
28
29# Production single binary (frontend embedded).
30build: frontend
31 cargo build --release -p server --features embedded
32
33# Production end-to-end: build the real frontend, embed it, and run the full
34# server test suite against the embedded assets.
35e2e: frontend
36 cargo test -p server --features embedded
37
38# Build the vendored CodeMirror bundle (web/cm6.js) from web/cm/wrapper.js.
39# web/cm6.js is a gitignored build artifact; web/bun.lock pins the dependencies.
40# Runs automatically via `build`, `dev-web` and `e2e`. Requires bun (https://bun.sh).
41build-cm:
42 cd web && bun install --frozen-lockfile && bun run build
43
44# Run the production binary against the dev folders.
45run: build
46 ./target/release/filebrowser-ng --root {{dev-root}} --db {{dev-db}}
47
48# Server test suite (unit + API integration tests).
49test:
50 cargo test -p server
51
52# Lint: formatting check + clippy with warnings denied.
53lint:
54 cargo fmt --check
55 cargo clippy --workspace --all-targets -- -D warnings
56
57# Format the whole workspace.
58fmt:
59 cargo fmt
60
61# Coverage report (requires `cargo install cargo-llvm-cov` + `rustup component add llvm-tools`).
62cov:
63 cargo llvm-cov -p server
64
65# Remove the dev database (factory reset of users/shares/settings).
66reset-db:
67 rm -f {{dev-db}} {{dev-db}}-wal {{dev-db}}-shm
68