chore(makefile): add parity targets and seeding
This commit is contained in:
55
Makefile
55
Makefile
@@ -14,7 +14,12 @@ DOCKER_IMAGE ?= $(APP_NAME):latest
|
||||
|
||||
export
|
||||
|
||||
.PHONY: help install clean dev build test docker-build docker-buildx docker-run docker-clean info couchdb-up couchdb-down
|
||||
.PHONY: help install clean \
|
||||
dev preview build \
|
||||
test test-watch test-coverage test-fast test-services test-integration \
|
||||
lint lint-fix format format-check type-check \
|
||||
docker-build docker-buildx docker-run docker-clean \
|
||||
seed couchdb-up couchdb-down info
|
||||
|
||||
# Default target
|
||||
.DEFAULT_GOAL := help
|
||||
@@ -53,6 +58,10 @@ dev: ## Start development server
|
||||
@echo "Starting $(APP_NAME) development server..."
|
||||
@bun run dev
|
||||
|
||||
preview: ## Serve production build locally
|
||||
@echo "Starting $(APP_NAME) preview server..."
|
||||
@bun run preview
|
||||
|
||||
build: ## Build the application
|
||||
@echo "Building $(APP_NAME) application..."
|
||||
@bun run build
|
||||
@@ -67,6 +76,44 @@ test-watch: ## Run unit tests in watch mode
|
||||
@echo "Running $(APP_NAME) tests in watch mode..."
|
||||
@bun run test:watch
|
||||
|
||||
test-coverage: ## Run tests with coverage report
|
||||
@echo "Running $(APP_NAME) tests with coverage..."
|
||||
@bun run test:coverage
|
||||
|
||||
test-fast: ## Run fast unit test subset
|
||||
@echo "Running fast unit test subset..."
|
||||
@bun run test:fast
|
||||
|
||||
test-services: ## Run service layer tests only
|
||||
@echo "Running service layer tests..."
|
||||
@bun run test:services
|
||||
|
||||
test-integration: ## Run integration tests
|
||||
@echo "Running integration tests..."
|
||||
@bun run test:integration
|
||||
|
||||
##@ Quality
|
||||
|
||||
lint: ## Run ESLint
|
||||
@echo "Linting $(APP_NAME)..."
|
||||
@bun run lint
|
||||
|
||||
lint-fix: ## Run ESLint with autofix
|
||||
@echo "Linting $(APP_NAME) with auto-fix..."
|
||||
@bun run lint:fix
|
||||
|
||||
format: ## Format code with Prettier
|
||||
@echo "Formatting $(APP_NAME) code..."
|
||||
@bun run format
|
||||
|
||||
format-check: ## Check code formatting without writing changes
|
||||
@echo "Checking $(APP_NAME) formatting..."
|
||||
@bun run format:check
|
||||
|
||||
type-check: ## Run TypeScript type checking
|
||||
@echo "Type-checking $(APP_NAME)..."
|
||||
@bun run type-check
|
||||
|
||||
##@ Docker
|
||||
|
||||
docker-build: ## Build Docker image for local development
|
||||
@@ -102,6 +149,12 @@ docker-clean: ## Clean Docker resources and containers
|
||||
@docker image prune -f 2>/dev/null || true
|
||||
@docker container prune -f 2>/dev/null || true
|
||||
|
||||
##@ Database
|
||||
|
||||
seed: ## Seed default admin user into CouchDB
|
||||
@echo "Seeding default admin account..."
|
||||
@bun run seed
|
||||
|
||||
##@ Test Services
|
||||
|
||||
couchdb-up: ## Start local CouchDB for integration tests
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
"test:unit": "jest --testPathPatterns='(utils|types).*test\\.(ts|js)$'",
|
||||
"test:services": "jest --testPathPatterns='services.*test\\.(ts|js)$'",
|
||||
"test:integration": "jest --testPathPatterns='(tests/integration/.*\\.test\\.(ts|js)|services/.*/__tests__/integration/.*\\.test\\.(ts|js))$'",
|
||||
"seed": "bun run scripts/seed.ts",
|
||||
"lint:markdown": "markdownlint-cli2 \"**/*.md\"",
|
||||
"lint:markdown:fix": "markdownlint-cli2 --fix \"**/*.md\"",
|
||||
"check:secrets": "secretlint \"**/*\"",
|
||||
|
||||
14
scripts/seed.ts
Normal file
14
scripts/seed.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { databaseSeeder } from '../services/database.seeder';
|
||||
|
||||
const run = async () => {
|
||||
try {
|
||||
await databaseSeeder.seedDatabase();
|
||||
console.log('✅ Database seeding complete');
|
||||
process.exit(0);
|
||||
} catch (error) {
|
||||
console.error('❌ Database seeding failed', error);
|
||||
process.exit(1);
|
||||
}
|
||||
};
|
||||
|
||||
run();
|
||||
Reference in New Issue
Block a user