Files
enviPy-bayer/Makefile
2025-10-13 21:07:20 +13:00

69 lines
2.3 KiB
Makefile

.PHONY: help setup db-up db-down migrate bootstrap build-css collect-static dev shell clean
help: ## Show this help message
@echo 'Usage: make [target]'
@echo ''
@echo 'Available targets:'
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-15s\033[0m %s\n", $$1, $$2}'
setup: db-up migrate bootstrap ## Complete setup: start database, run migrations, and bootstrap data
@echo "✓ Setup complete! You do not need to run this again; Run 'make dev' to start the development server."
db-up: ## Start PostgreSQL database using Docker Compose
@echo "Starting PostgreSQL database..."
@docker compose -f docker-compose.dev.yml up -d
@echo "Waiting for database to be ready..."
@sleep 3
@echo "✓ Database is running"
db-down: ## Stop PostgreSQL database
@echo "Stopping PostgreSQL database..."
@docker compose down
js-deps: ## Install frontend dependencies
@echo "Installing frontend dependencies..."
@pnpm install
build-css: js-deps ## Build Tailwind CSS for production (minified)
@echo "Building Tailwind CSS..."
@pnpm run build
@echo "✓ CSS built successfully"
migrate: ## Run database migrations
@echo "Running migrations..."
@uv run python manage.py migrate
@echo "✓ Migrations complete"
bootstrap: ## Bootstrap initial data (anonymous user, packages, models)
@echo "Bootstrapping initial data..."
@echo "This will take a bit ⏱️. Get yourself some coffe..."
@uv run python manage.py bootstrap
@echo "✓ Bootstrap complete"
@echo ""
@echo "Default admin credentials:"
@echo " Username: admin"
@echo " Email: admin@envipath.com"
@echo " Password: SuperSafe"
dev: db-up js-deps ## Start development server with auto CSS watcher
@uv run python manage.py runserver
collect-static: build-css ## Build CSS and collect all static files for production
@echo "Collecting static files..."
@uv run python manage.py collectstatic --noinput
@echo "✓ Static files collected successfully"
shell: ## Open Django shell
@uv run python manage.py shell
clean: ## Remove database and volumes (WARNING: destroys all data)
@echo "WARNING: This will delete all database data!"
@read -p "Are you sure? [y/N] " -n 1 -r; \
echo; \
if [[ $$REPLY =~ ^[Yy]$$ ]]; then \
docker compose down -v; \
echo "✓ Cleaned"; \
else \
echo "Cancelled"; \
fi