본문으로 건너뛰기

Build and Development Commands

This document provides a comprehensive reference for all build, development, and maintenance commands used in the DTA Wide monorepo project.

Core Commands

Dependency Management

# Install all dependencies
yarn

# Update dependencies
yarn upgrade

Build Commands

# Clean build artifacts
yarn clean

# Start local development (dta-wide-api)
yarn start:local

# Build specific applications
yarn build:dta-wide-api
yarn build:dta-wir-api-universal

# Clean build (full rebuild)
yarn clean-build

Testing Commands

# Run all feature tests
yarn test:features

# Run all tests
yarn test:all

# Run specific test suite
yarn test [test-pattern]

Database Commands

Prisma Client Generation

# Generate Prisma client for main database
npx nx run core-database:prisma-generate

# Generate Prisma client for WIR database
npx nx run core-database-wir:prisma-generate

Database Migrations

# Create new migration for main database
npx nx run core-database:prisma-migrate-dev

# Create new migration for WIR database
npx nx run core-database-wir:prisma-migrate-dev

# Apply migrations in production
npx nx run core-database:prisma-migrate-deploy
npx nx run core-database-wir:prisma-migrate-deploy

Database Management

# Open Prisma Studio for main database
npx nx run core-database:prisma-studio

# Reset database (development only)
npx nx run core-database:prisma-migrate-reset

# Seed database
npx nx run core-database:prisma-seed

NX Commands

Project Management

# Build specific project
npx nx build [project-name]

# Serve with hot reload
npx nx serve [project-name]

# Run tests for specific project
npx nx test [project-name]

# Run linting
npx nx lint [project-name]

# Reset NX cache
yarn nx:reset

Dependency Graph

# View project dependency graph
npx nx graph

# View affected projects
npx nx affected:graph

Performance

# Run affected projects only
npx nx affected:build
npx nx affected:test
npx nx affected:lint

Event System Commands

Event Analysis

# Analyze cross-domain events
yarn events:analyze

# Generate event visualization
yarn events:visualize

# Run complete event analysis
yarn events:all

AI Workflow Commands

AI-Assisted Development

# AI code review
yarn ai-review

# AI commit message generation
yarn ai-commit

# AI pull request creation
yarn ai-pr

Docker Commands

Local Development with Docker

# Start all services
docker-compose up

# Start specific service
docker-compose up [service-name]

# Stop all services
docker-compose down

# Rebuild containers
docker-compose up --build

Database Services

# Start PostgreSQL only
docker-compose up postgres

# Start Redis only
docker-compose up redis

# View service logs
docker-compose logs -f [service-name]

Cloud Deployment Commands

Google Cloud Platform

# Deploy to Cloud Run (staging)
./cloudrun-deploy staging

# Deploy to Cloud Run (production)
./cloudrun-deploy production

# View deployment status
gcloud run services list

# View service logs
gcloud logging read

Troubleshooting Commands

Cache and Build Issues

# Clear all caches
yarn clean && yarn nx:reset

# Reinstall dependencies
rm -rf node_modules && yarn

# Clear Docker volumes
docker-compose down -v

Database Issues

# Check database connection
psql -h localhost -U postgres -d dtawide

# View Prisma schema status
npx nx run core-database:prisma-validate

Performance Profiling

# Generate build performance report
npx nx run-many --target=build --all --profile

# Analyze bundle size
npx nx run [app-name]:analyze

Useful Aliases

Consider adding these to your .bashrc or .zshrc:

# NX shortcuts
alias nxb='npx nx build'
alias nxs='npx nx serve'
alias nxt='npx nx test'
alias nxl='npx nx lint'
alias nxg='npx nx graph'

# Prisma shortcuts
alias pg='npx nx run core-database:prisma-generate'
alias pm='npx nx run core-database:prisma-migrate-dev'
alias ps='npx nx run core-database:prisma-studio'

# Docker shortcuts
alias dcu='docker-compose up'
alias dcd='docker-compose down'
alias dcl='docker-compose logs -f'

Environment-Specific Commands

Development

# Start development environment
yarn start:local

# Run tests in watch mode
yarn test:watch

Staging

# Deploy to staging
./cloudrun-deploy staging

# Run smoke tests against staging
yarn test:e2e:staging

Production

# Deploy to production (requires approval)
./cloudrun-deploy production

# Run health checks
curl https://api.dtawide.com/health