Split justfiles

This commit is contained in:
Drew 2025-09-22 01:38:08 -07:00
parent c2c1d1c8ed
commit 3f805430fa
4 changed files with 102 additions and 52 deletions

View file

@ -1,53 +1,29 @@
# Temporary until we have a frontend.
set working-directory := 'backend'
export DATABASE_URL :="sqlite://local.db"
# Root justfile for Captain's Log - coordinates both backend and frontend
import 'backend/justfile'
import 'frontend/justfile'
# Combined commands - run both backend and frontend
dev:
cargo run
build:
cargo build
test-unit:
cargo test
fmt:
cargo fmt --check
lint:
cargo clippy
clean:
cargo clean
reset-db:
sqlx database drop
sqlx database create
sqlx migrate run
migrate:
sqlx migrate run
migrate-revert:
sqlx migrate revert
test-integration:
#!/usr/bin/env bash
set -e
echo "Starting backend and frontend servers..."
just dev-backend &
BACKEND_PID=$!
just dev-frontend &
FRONTEND_PID=$!
cargo run &
SERVER_PID=$!
trap 'echo "Stopping server..."; kill -TERM $SERVER_PID 2>/dev/null || true; wait $SERVER_PID 2>/dev/null || true' EXIT
echo "Waiting for server to start..."
printf 'GET http://localhost:3000/health\nHTTP 200' | hurl --retry 30 > /dev/null
echo "Running integration tests..."
hurl --test --error-format long --variable host=http://localhost:3000 tests/api/*.hurl
trap 'echo "Stopping servers..."; kill -TERM $BACKEND_PID $FRONTEND_PID 2>/dev/null || true; wait' EXIT
wait
test-coverage:
cargo tarpaulin --out Html --output-dir coverage
build: build-backend build-frontend
test: test-unit-backend test-integration test-frontend
fmt: fmt-backend fmt-frontend
fmt-check: fmt-check-backend fmt-check-frontend
lint: lint-backend lint-frontend
clean: clean-backend clean-frontend