Split justfiles

This commit is contained in:
Drew 2025-09-22 01:38:08 -07:00
parent c2c1d1c8ed
commit 4e34c8d81b
4 changed files with 71 additions and 51 deletions

50
backend/justfile Normal file
View file

@ -0,0 +1,50 @@
# Backend development commands for Captain's Log
export DATABASE_URL :="sqlite://local.db"
dev-backend:
cargo run
build-backend:
cargo build
test-unit-backend:
cargo test
fmt-backend:
cargo fmt --check
lint-backend:
cargo clippy
clean-backend:
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
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
test-coverage:
cargo tarpaulin --out Html --output-dir coverage

View file

@ -1,9 +1,5 @@
# Frontend development commands for Captain's Log # Frontend development commands for Captain's Log
set working-directory := '.'
# Show available commands
default:
@just --list
# Start development server with backend API proxy # Start development server with backend API proxy
dev-frontend: dev-frontend:

View file

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

View file

@ -65,7 +65,7 @@ captains-log/
- **Expected outcome**: `just --list` in frontend directory shows all commands - **Expected outcome**: `just --list` in frontend directory shows all commands
### Task 1.4: Update Root Justfile Structure ### Task 1.4: Update Root Justfile Structure
- [ ] **Files**: `justfile`, `backend/justfile` - [x] **Files**: `justfile`, `backend/justfile`
- Move existing backend commands to `backend/justfile` - Move existing backend commands to `backend/justfile`
- Create new root justfile with combined commands - Create new root justfile with combined commands
- Add concurrent execution for `dev` command (both backend + frontend) - Add concurrent execution for `dev` command (both backend + frontend)