fix: update database switching to modify schema file directly
This commit is contained in:
@@ -0,0 +1,129 @@
|
||||
# justfile for Euchre Camp
|
||||
# Automates development, testing, and deployment tasks.
|
||||
# Designed for CI/CD pipelines and local development.
|
||||
|
||||
# --- Configuration ---
|
||||
set dotenv-load
|
||||
set positional-arguments
|
||||
|
||||
# Project name
|
||||
PROJECT := "euchre-camp"
|
||||
|
||||
# Docker registry (CasaOS local registry)
|
||||
REGISTRY := "dhg.lol:5000" # Update IP to your CasaOS server IP
|
||||
IMAGE_TAG := "latest"
|
||||
|
||||
# --- Variables ---
|
||||
# Database
|
||||
DB_CONTAINER := "euchre-camp-postgres"
|
||||
|
||||
# --- Setup & Installation ---
|
||||
|
||||
# Install dependencies and setup environment
|
||||
setup:
|
||||
@echo "Installing dependencies..."
|
||||
npm install
|
||||
@echo "Setting up database..."
|
||||
npm run db:setup-postgres
|
||||
@echo "Generating Prisma client..."
|
||||
npx prisma generate
|
||||
|
||||
# --- Development ---
|
||||
|
||||
# Start the development server
|
||||
dev:
|
||||
npm run dev
|
||||
|
||||
# Lint the codebase
|
||||
lint:
|
||||
npm run lint
|
||||
|
||||
# Type check the codebase
|
||||
typecheck:
|
||||
npx tsc --noEmit
|
||||
|
||||
# Format code (if prettier is available, otherwise just lint)
|
||||
format:
|
||||
npx prettier --write .
|
||||
|
||||
# --- Testing ---
|
||||
|
||||
# Run all tests (unit + acceptance)
|
||||
test: test-unit test-acceptance
|
||||
|
||||
# Run unit tests (Vitest)
|
||||
test-unit:
|
||||
npm run test:run
|
||||
|
||||
# Run acceptance tests (Playwright)
|
||||
test-acceptance:
|
||||
@echo "Starting Docker containers for acceptance tests..."
|
||||
docker compose up -d
|
||||
@echo "Waiting for services to be ready..."
|
||||
sleep 10
|
||||
@echo "Running acceptance tests..."
|
||||
npm run test:acceptance
|
||||
@echo "Stopping Docker containers..."
|
||||
docker compose down
|
||||
|
||||
# Run database migrations (Prisma)
|
||||
migrate:
|
||||
npx prisma migrate dev
|
||||
|
||||
# Seed the database
|
||||
seed:
|
||||
npm run db:seed
|
||||
|
||||
# --- Docker ---
|
||||
|
||||
# Build the Docker image
|
||||
docker-build:
|
||||
@echo "Building Docker image {{PROJECT}}:{{IMAGE_TAG}}..."
|
||||
docker build -t {{PROJECT}}:{{IMAGE_TAG}} .
|
||||
|
||||
# Run the Docker container locally
|
||||
docker-run: docker-build
|
||||
@echo "Running Docker container {{PROJECT}}..."
|
||||
docker run -d -p 3000:3000 --name {{PROJECT}} {{PROJECT}}:{{IMAGE_TAG}}
|
||||
|
||||
# Stop and remove the Docker container
|
||||
docker-stop:
|
||||
@echo "Stopping Docker container {{PROJECT}}..."
|
||||
docker stop {{PROJECT}} || true
|
||||
docker rm {{PROJECT}} || true
|
||||
|
||||
# Clean up Docker images and containers
|
||||
docker-clean: docker-stop
|
||||
@echo "Removing Docker image {{PROJECT}}:{{IMAGE_TAG}}..."
|
||||
docker rmi {{PROJECT}}:{{IMAGE_TAG}} || true
|
||||
|
||||
# --- Deployment ---
|
||||
|
||||
# Tag image for local registry
|
||||
docker-tag:
|
||||
@echo "Tagging image for registry {{REGISTRY}}..."
|
||||
docker tag {{PROJECT}}:{{IMAGE_TAG}} {{REGISTRY}}/{{PROJECT}}:{{IMAGE_TAG}}
|
||||
|
||||
# Push image to local registry (CasaOS)
|
||||
docker-push: docker-build docker-tag
|
||||
@echo "Pushing image to {{REGISTRY}}..."
|
||||
docker push {{REGISTRY}}/{{PROJECT}}:{{IMAGE_TAG}}
|
||||
|
||||
# --- CI/CD Pipeline Simulation ---
|
||||
|
||||
# Run full CI pipeline locally (lint, test, build, push)
|
||||
ci: lint typecheck test-unit docker-build
|
||||
@echo "CI Pipeline completed successfully!"
|
||||
|
||||
# --- Utilities ---
|
||||
|
||||
# Show help information
|
||||
help:
|
||||
@just --list
|
||||
|
||||
# Clean up project (remove node_modules, build artifacts)
|
||||
clean:
|
||||
@echo "Cleaning project..."
|
||||
rm -rf node_modules .next dist
|
||||
@echo "Cleaning Docker artifacts..."
|
||||
docker system prune -f
|
||||
Reference in New Issue
Block a user