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).
23# Trunk strips the /api rewrite prefix, so the backend URL carries it back.
24dev-web: build-cm
25 cd web && trunk serve --proxy-rewrite /api --proxy-backend http://127.0.0.1:8081/api
26
27# Build the frontend and stage it into server/dist for the embedded build.
28frontend: build-cm
29 cd web && trunk build --release
30 rm -rf server/dist
31 cp -r web/dist server/dist
32
33# Production single binary (frontend embedded).
34build: frontend
35 cargo build --locked --release -p server --features embedded
36
37# Production end-to-end: build the real frontend, embed it, and run the full server test suite.
38e2e: frontend
39 cargo test -p server --features embedded
40
41# Requires bun (https://bun.sh); web/bun.lock pins the dependencies and
42# web/cm6.js is a gitignored build artifact. Runs automatically via `build`,
43# `dev-web` and `e2e`.
44# Build the vendored CodeMirror bundle (web/cm6.js) from web/cm/wrapper.js.
45build-cm:
46 cd web && bun install --frozen-lockfile && bun run build
47
48# Run the production binary against the dev folders.
49run: dev-data build
50 ./target/release/filebrowser-ng --root {{dev-root}} --db {{dev-db}}
51
52# Server test suite (unit + API integration tests).
53test:
54 cargo test -p server -p api-types
55
56# Lint: formatting check + clippy with warnings denied.
57lint:
58 cargo fmt --check
59 cargo clippy --workspace --all-targets -- -D warnings
60
61# Format the whole workspace.
62fmt:
63 cargo fmt
64
65# Coverage report (requires `cargo install cargo-llvm-cov` + `rustup component add llvm-tools`).
66cov:
67 cargo llvm-cov -p server
68
69# Remove the dev database (factory reset of users/shares/settings).
70reset-db:
71 rm -f {{dev-db}} {{dev-db}}-wal {{dev-db}}-shm
72