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