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
|
# 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:
|
||||||
|
|
|
||||||
66
justfile
66
justfile
|
|
@ -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
|
|
||||||
|
|
||||||
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:
|
build: build-backend build-frontend
|
||||||
cargo tarpaulin --out Html --output-dir coverage
|
|
||||||
|
test: test-unit-backend test-integration test-frontend
|
||||||
|
|
||||||
|
fmt: fmt-backend fmt-frontend
|
||||||
|
|
||||||
|
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
|
- **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)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue