feat: Enhance Makefile with frontend commands, database seeding, and improved serve and clean targets.

This commit is contained in:
2025-12-19 17:51:36 +05:30
parent 0f6ef74f6c
commit f2f2d1dec7

View File

@@ -1,29 +1,32 @@
# zhealth Makefile # zhealth Makefile
# Run `make help` to see available commands # Run `make help` to see available commands
.PHONY: help dev build release lint typecheck test clean serve .PHONY: help build release lint typecheck test clean serve
# Default target # Default target
help: help:
@echo "Available commands:" @echo "Available commands:"
@echo " make dev - Start development servers" @echo " make serve - Start both backend and frontend servers"
@echo " make build - Build for development" @echo " make build - Build for development"
@echo " make release - Build optimized production bundle" @echo " make release - Build optimized production bundle"
@echo " make migrate - Run database migrations" @echo " make migrate - Run database migrations"
@echo " make seed - Seed database with initial data"
@echo " make lint - Run linters (Clippy + ESLint)" @echo " make lint - Run linters (Clippy + ESLint)"
@echo " make typecheck - Type checking (Rust + TypeScript)" @echo " make typecheck - Type checking (Rust + TypeScript)"
@echo " make test - Run all tests" @echo " make test - Run all tests"
@echo " make serve - Serve production build locally"
@echo " make clean - Clean build artifacts" @echo " make clean - Clean build artifacts"
# Backend commands # Backend commands
.PHONY: backend-dev backend-build backend-release backend-lint backend-test migrate .PHONY: backend-dev backend-build backend-release backend-lint backend-test migrate seed
migrate: migrate:
cd backend && ./target/debug/zhealth migrate cd backend && cargo run -- migrate
seed:
cd backend && cargo run -- seed
backend-dev: backend-dev:
cd backend && ./target/debug/zhealth serve cd backend && cargo run -- serve
backend-build: backend-build:
cd backend && cargo build cd backend && cargo build
@@ -37,26 +40,28 @@ backend-lint:
backend-test: backend-test:
cd backend && cargo test cd backend && cargo test
# Frontend commands (placeholder for when frontend is set up) # Frontend commands
.PHONY: frontend-dev frontend-build frontend-release frontend-lint frontend-test .PHONY: frontend-dev frontend-build frontend-release frontend-lint frontend-test frontend-install
frontend-install:
cd frontend && npm install
frontend-dev: frontend-dev:
@echo "Frontend not yet configured" cd frontend && npm run dev
frontend-build: frontend-build:
@echo "Frontend not yet configured" cd frontend && npm run build
frontend-release: frontend-release:
@echo "Frontend not yet configured" cd frontend && npm run build
frontend-lint: frontend-lint:
@echo "Frontend not yet configured" cd frontend && npm run lint
frontend-test: frontend-test:
@echo "Frontend not yet configured" @echo "Frontend tests not yet configured"
# Combined commands # Combined commands
dev: backend-dev
build: backend-build frontend-build build: backend-build frontend-build
@@ -69,8 +74,11 @@ typecheck: backend-lint frontend-lint
test: backend-test frontend-test test: backend-test frontend-test
serve: serve:
cd backend && cargo run --release @echo "Starting backend (port 3000) and frontend (port 5173)..."
@cd backend && cargo run -- serve & cd frontend && npm run dev
clean: clean:
cd backend && cargo clean cd backend && cargo clean
@echo "Cleaned backend artifacts" cd frontend && rm -rf node_modules dist
@echo "Cleaned build artifacts"