Split justfiles
This commit is contained in:
parent
c2c1d1c8ed
commit
4e34c8d81b
4 changed files with 71 additions and 51 deletions
50
backend/justfile
Normal file
50
backend/justfile
Normal 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
|
||||
|
|
@ -1,9 +1,5 @@
|
|||
# Frontend development commands for Captain's Log
|
||||
set working-directory := '.'
|
||||
|
||||
# Show available commands
|
||||
default:
|
||||
@just --list
|
||||
|
||||
# Start development server with backend API proxy
|
||||
dev-frontend:
|
||||
|
|
|
|||
60
justfile
60
justfile
|
|
@ -1,53 +1,27 @@
|
|||
# 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..."
|
||||
(cd backend/ && just dev-backend) &
|
||||
BACKEND_PID=$!
|
||||
(cd frontend/ && just dev-frontend) &
|
||||
FRONTEND_PID=$!
|
||||
|
||||
cargo run &
|
||||
SERVER_PID=$!
|
||||
trap 'echo "Stopping servers..."; kill -TERM $BACKEND_PID $FRONTEND_PID 2>/dev/null || true; wait' EXIT
|
||||
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..."
|
||||
printf 'GET http://localhost:3000/health\nHTTP 200' | hurl --retry 30 > /dev/null
|
||||
test: test-unit-backend test-integration test-frontend
|
||||
|
||||
echo "Running integration tests..."
|
||||
hurl --test --error-format long --variable host=http://localhost:3000 tests/api/*.hurl
|
||||
fmt: fmt-backend fmt-frontend
|
||||
|
||||
test-coverage:
|
||||
cargo tarpaulin --out Html --output-dir coverage
|
||||
lint: lint-backend lint-frontend
|
||||
|
||||
clean: clean-backend clean-frontend
|
||||
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ captains-log/
|
|||
- **Expected outcome**: `just --list` in frontend directory shows all commands
|
||||
|
||||
### Task 1.4: Update Root Justfile Structure
|
||||
- [ ] **Files**: `justfile`, `backend/justfile`
|
||||
- [x] **Files**: `justfile`, `backend/justfile`
|
||||
- Move existing backend commands to `backend/justfile`
|
||||
- Create new root justfile with combined commands
|
||||
- Add concurrent execution for `dev` command (both backend + frontend)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue