mirror of
https://github.com/Xevion/banner.git
synced 2025-12-05 23:14:20 -06:00
Switch to Bun for 2-5x faster frontend builds, implement cargo-chef for reliable Rust dependency caching, and add Biome for fast code formatting. Build system improvements: - Replace pnpm with Bun for frontend package management - Add cargo-chef to Dockerfile for better Rust build layer caching - Update all commands to use bun instead of pnpm Developer experience: - Add comprehensive Justfile commands (format, format-check, db) - Implement automated PostgreSQL Docker setup with random port allocation - Add stricter checks (--deny warnings on clippy, --all-features flag) Code quality: - Add Biome formatter for 10-100x faster TypeScript/JavaScript formatting - Add GitHub Actions CI/CD workflow for automated checks - Update .dockerignore with comprehensive exclusions - Format all code with cargo fmt (Rust) and Biome (TypeScript) All changes maintain backward compatibility and can be tested incrementally.
80 lines
2.0 KiB
Makefile
80 lines
2.0 KiB
Makefile
default_services := "bot,web,scraper"
|
|
|
|
default:
|
|
just --list
|
|
|
|
# Run all checks (format, clippy, tests, lint)
|
|
check:
|
|
cargo fmt --all -- --check
|
|
cargo clippy --all-features -- --deny warnings
|
|
cargo nextest run
|
|
bun run --cwd web typecheck
|
|
bun run --cwd web lint
|
|
|
|
# Format all Rust and TypeScript code
|
|
format:
|
|
cargo fmt --all
|
|
bun run --cwd web format
|
|
|
|
# Check formatting without modifying (CI-friendly)
|
|
format-check:
|
|
cargo fmt --all -- --check
|
|
bun run --cwd web format:check
|
|
|
|
# Start PostgreSQL in Docker and update .env with connection string
|
|
db:
|
|
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
# Find available port
|
|
PORT=$(shuf -i 49152-65535 -n 1)
|
|
while ss -tlnp 2>/dev/null | grep -q ":$PORT "; do
|
|
PORT=$(shuf -i 49152-65535 -n 1)
|
|
done
|
|
|
|
# Start PostgreSQL container
|
|
docker run -d \
|
|
--name banner-postgres \
|
|
-e POSTGRES_PASSWORD=banner \
|
|
-e POSTGRES_USER=banner \
|
|
-e POSTGRES_DB=banner \
|
|
-p "$PORT:5432" \
|
|
postgres:17-alpine
|
|
|
|
# Update .env file
|
|
DB_URL="postgresql://banner:banner@localhost:$PORT/banner"
|
|
if [ -f .env ]; then
|
|
sed -i.bak "s|^DATABASE_URL=.*|DATABASE_URL=$DB_URL|" .env
|
|
else
|
|
echo "DATABASE_URL=$DB_URL" > .env
|
|
fi
|
|
|
|
echo "PostgreSQL started on port $PORT"
|
|
echo "DATABASE_URL=$DB_URL"
|
|
echo "Run: sqlx migrate run"
|
|
|
|
# Auto-reloading frontend server
|
|
frontend:
|
|
bun run --cwd web dev
|
|
|
|
# Production build of frontend
|
|
build-frontend:
|
|
bun run --cwd web build
|
|
|
|
# Auto-reloading backend server
|
|
backend *ARGS:
|
|
bacon --headless run -- -- {{ARGS}}
|
|
|
|
# Production build
|
|
build:
|
|
bun run --cwd web build
|
|
cargo build --release --bin banner
|
|
|
|
# Run auto-reloading development build with release characteristics
|
|
dev-build *ARGS='--services web --tracing pretty': build-frontend
|
|
bacon --headless run -- --profile dev-release -- {{ARGS}}
|
|
|
|
# Auto-reloading development build for both frontend and backend
|
|
[parallel]
|
|
dev *ARGS='--services web,bot': frontend (backend ARGS)
|