aws-samples avatar

build-and-format

Verify builds pass and format code after implementation

提供方 aws-samples|开源

Build and Format Verification

Build Sequence

Run builds in dependency order (backend must build before CDK):

# 1. Backend (must be first - CDK depends on it)
cd backend
npm run build
npm run format

# 2. Frontend
cd ../frontend
npm run build
npm run format

# 3. CDK (depends on backend build)
cd ../cdk
npx cdk synth

Prisma-Specific Build

After modifying backend/prisma/schema.prisma:

cd backend
npm run prisma:generate
npm run build
npm run format

Common Errors

ErrorSolution
Module not found: @prisma/clientcd backend && npm run prisma:generate
Cannot find module '../backend/...' (CDK)Build backend first
Docker daemon not running (CDK synth)Start Docker Desktop

Quick Commands

TaskCommand
Backend build + formatcd backend && npm run build && npm run format
Frontend build + formatcd frontend && npm run build && npm run format
CDK synthcd cdk && npx cdk synth
Prisma generatecd backend && npm run prisma:generate

Success Criteria

  • Backend: TypeScript compiles without errors
  • Frontend: Vite builds without errors
  • CDK: CloudFormation template generates
  • All code formatted by Prettier

After successful build, consider running /test-database-feature if database changes were made.