justfile
⎇
Raw
1# filebrowser-ng developer tasks
2
3dev-root := '.dev/root'
4dev-db := '.dev/db.sqlite'
5dev-cache := '.dev/cache'
6
7# Show the available recipes (runs when you type `just` without arguments).
8default:
9 @just --list
10
11# Create the dev root folder.
12dev-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).
17dev: dev-data dev-server
18
19# Dev backend on :8081 — the API plus static files from web/dist (no HMR).
20dev-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.
25dev-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.
29frontend: 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).
35build: frontend
36 cargo build --locked --release -p server --features embedded
37
38# Production end-to-end: build the real frontend, embed it, and run the full server test suite.
39e2e: frontend
40 cargo test -p server --features 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.
46build-cm:
47 cd web && bun install --frozen-lockfile && bun run build
48
49# Run the production binary against the dev folders.
50run: dev-data build
51 ./target/release/filebrowser-ng --root {{dev-root}} --db {{dev-db}} --cache {{dev-cache}}
52
53# Server test suite (unit + API integration tests).
54test:
55 cargo test -p server -p api-types
56
57# Lint: formatting check + clippy with warnings denied.
58lint:
59 cargo fmt --check
60 cargo clippy --workspace --all-targets -- -D warnings
61
62# Format the whole workspace.
63fmt:
64 cargo fmt
65
66# Coverage report (requires `cargo install cargo-llvm-cov` + `rustup component add llvm-tools`).
67cov:
68 cargo llvm-cov -p server
69
70# Remove the dev database (factory reset of users/shares/settings).
71reset-db:
72 rm -f {{dev-db}} {{dev-db}}-wal {{dev-db}}-shm
73