# filebrowser-ng developer tasks dev-root := '.dev/root' dev-db := '.dev/db.sqlite' default: dev # Create the dev root folder. dev-data: mkdir -p {{dev-root}} # Backend (dev): serves the frontend from Trunk's output directory. # Frontend dev server: just dev-web (port 8080) # Backend dev server: just dev-server (port 8081, /api proxied by Trunk) dev: dev-data dev-server dev-server: cargo run -p server -- --root {{dev-root}} --db {{dev-db}} --port 8081 dev-web: build-cm cd web && trunk serve --proxy-rewrite /api --proxy-backend http://127.0.0.1:8081 # Build the frontend and stage it into server/dist for the embedded build. frontend: build-cm cd web && trunk build --release rm -rf server/dist cp -r web/dist server/dist # Production single binary (frontend embedded). build: frontend cargo build --release -p server --features embedded # Production end-to-end: build the real frontend, embed it, and run the full # server test suite against the embedded assets. e2e: frontend cargo test -p server --features embedded # Build the vendored CodeMirror bundle (web/cm6.js) from web/cm/wrapper.js. # web/cm6.js is a gitignored build artifact; web/bun.lock pins the dependencies. # Runs automatically via `build`, `dev-web` and `e2e`. Requires bun (https://bun.sh). build-cm: cd web && bun install --frozen-lockfile && bun run build # Run the production binary against the dev folders. run: build ./target/release/filebrowser-ng --root {{dev-root}} --db {{dev-db}} # Server test suite (unit + API integration tests). test: cargo test -p server # Lint: formatting check + clippy with warnings denied. lint: cargo fmt --check cargo clippy --workspace --all-targets -- -D warnings # Format the whole workspace. fmt: cargo fmt # Coverage report (requires `cargo install cargo-llvm-cov` + `rustup component add llvm-tools`). cov: cargo llvm-cov -p server # Remove the dev database (factory reset of users/shares/settings). reset-db: rm -f {{dev-db}} {{dev-db}}-wal {{dev-db}}-shm