Create directory structure for frontend with requisite justfile changes. #6
4 changed files with 102 additions and 52 deletions
65
backend/justfile
Normal file
65
backend/justfile
Normal 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
|
||||
|
|
@ -1,61 +1,70 @@
|
|||
# Frontend development commands for Captain's Log
|
||||
set working-directory := '.'
|
||||
|
||||
# Show available commands
|
||||
default:
|
||||
@just --list
|
||||
|
||||
# Start development server with backend API proxy
|
||||
[working-directory: 'frontend']
|
||||
dev-frontend:
|
||||
npm run dev
|
||||
|
||||
# Build frontend for production (includes SSR build)
|
||||
[working-directory: 'frontend']
|
||||
build-frontend:
|
||||
npm run build
|
||||
|
||||
# Run all tests
|
||||
[working-directory: 'frontend']
|
||||
test-frontend:
|
||||
npm run test:run
|
||||
|
||||
# Run tests with coverage reporting
|
||||
[working-directory: 'frontend']
|
||||
test-coverage-frontend:
|
||||
npm run test:coverage
|
||||
|
||||
# Run tests in watch mode
|
||||
[working-directory: 'frontend']
|
||||
test-watch-frontend:
|
||||
npm run test
|
||||
|
||||
# Run TypeScript type checking
|
||||
[working-directory: 'frontend']
|
||||
typecheck-frontend:
|
||||
npm run typecheck
|
||||
|
||||
# Lint code with ESLint
|
||||
[working-directory: 'frontend']
|
||||
lint-frontend:
|
||||
npm run lint
|
||||
|
||||
# Fix linting issues automatically
|
||||
[working-directory: 'frontend']
|
||||
lint-fix-frontend:
|
||||
npm run lint:fix
|
||||
|
||||
# Format code with Prettier
|
||||
[working-directory: 'frontend']
|
||||
fmt-frontend:
|
||||
npm run format
|
||||
|
||||
# Check if code is properly formatted
|
||||
[working-directory: 'frontend']
|
||||
fmt-check-frontend:
|
||||
npm run format:check
|
||||
|
||||
# Install dependencies
|
||||
[working-directory: 'frontend']
|
||||
install-frontend:
|
||||
npm install
|
||||
|
||||
# Clean build artifacts and dependencies
|
||||
[working-directory: 'frontend']
|
||||
clean-frontend:
|
||||
rm -rf build .react-router node_modules
|
||||
|
||||
# Start production server
|
||||
[working-directory: 'frontend']
|
||||
start-frontend:
|
||||
npm run start
|
||||
|
||||
# Run full quality checks (lint + format + typecheck + test)
|
||||
[working-directory: 'frontend']
|
||||
check-frontend: lint-frontend fmt-check-frontend typecheck-frontend test-frontend
|
||||
68
justfile
68
justfile
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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