Create directory structure for frontend with requisite justfile changes. #6

Merged
drew merged 3 commits from frontend-impl into main 2025-09-22 08:58:26 +00:00
4 changed files with 102 additions and 52 deletions
Showing only changes of commit 3f805430fa - Show all commits

65
backend/justfile Normal file
View file

@ -0,0 +1,65 @@
# Backend development commands for Captain's Log
export DATABASE_URL :="sqlite://local.db"
[working-directory: 'backend']
dev-backend:
cargo run
[working-directory: 'backend']
build-backend:
cargo build
[working-directory: 'backend']
test-unit-backend:
cargo test
[working-directory: 'backend']
fmt-backend:
cargo fmt
[working-directory: 'backend']
fmt-check-backend:
cargo fmt --check
[working-directory: 'backend']
lint-backend:
cargo clippy
[working-directory: 'backend']
clean-backend:
cargo clean
[working-directory: 'backend']
reset-db:
sqlx database drop
sqlx database create
sqlx migrate run
[working-directory: 'backend']
migrate:
sqlx migrate run
[working-directory: 'backend']
migrate-revert:
sqlx migrate revert
[working-directory: 'backend']
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
[working-directory: 'backend']
test-coverage:
cargo tarpaulin --out Html --output-dir coverage

View file

@ -1,61 +1,70 @@
# 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
[working-directory: 'frontend']
dev-frontend: dev-frontend:
npm run dev npm run dev
# Build frontend for production (includes SSR build) # Build frontend for production (includes SSR build)
[working-directory: 'frontend']
build-frontend: build-frontend:
npm run build npm run build
# Run all tests # Run all tests
[working-directory: 'frontend']
test-frontend: test-frontend:
npm run test:run npm run test:run
# Run tests with coverage reporting # Run tests with coverage reporting
[working-directory: 'frontend']
test-coverage-frontend: test-coverage-frontend:
npm run test:coverage npm run test:coverage
# Run tests in watch mode # Run tests in watch mode
[working-directory: 'frontend']
test-watch-frontend: test-watch-frontend:
npm run test npm run test
# Run TypeScript type checking # Run TypeScript type checking
[working-directory: 'frontend']
typecheck-frontend: typecheck-frontend:
npm run typecheck npm run typecheck
# Lint code with ESLint # Lint code with ESLint
[working-directory: 'frontend']
lint-frontend: lint-frontend:
npm run lint npm run lint
# Fix linting issues automatically # Fix linting issues automatically
[working-directory: 'frontend']
lint-fix-frontend: lint-fix-frontend:
npm run lint:fix npm run lint:fix
# Format code with Prettier # Format code with Prettier
[working-directory: 'frontend']
fmt-frontend: fmt-frontend:
npm run format npm run format
# Check if code is properly formatted # Check if code is properly formatted
[working-directory: 'frontend']
fmt-check-frontend: fmt-check-frontend:
npm run format:check npm run format:check
# Install dependencies # Install dependencies
[working-directory: 'frontend']
install-frontend: install-frontend:
npm install npm install
# Clean build artifacts and dependencies # Clean build artifacts and dependencies
[working-directory: 'frontend']
clean-frontend: clean-frontend:
rm -rf build .react-router node_modules rm -rf build .react-router node_modules
# Start production server # Start production server
[working-directory: 'frontend']
start-frontend: start-frontend:
npm run start npm run start
# Run full quality checks (lint + format + typecheck + test) # Run full quality checks (lint + format + typecheck + test)
[working-directory: 'frontend']
check-frontend: lint-frontend fmt-check-frontend typecheck-frontend test-frontend check-frontend: lint-frontend fmt-check-frontend typecheck-frontend test-frontend

View file

@ -1,53 +1,29 @@
# 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..."
just dev-backend &
BACKEND_PID=$!
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: fmt-check: fmt-check-backend fmt-check-frontend
cargo tarpaulin --out Html --output-dir coverage
lint: lint-backend lint-frontend
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)