Build commands, build order, TypeScript configuration, and CDK deployment. Use when building packages, troubleshooting build issues, or deploying stacks.
Use make for deterministic, hermetic builds that work the same locally and in CI/CD:
# Show all available commands
make help
# Install dependencies
make install
# Clean build artifacts
make clean
# Build all packages in dependency order
make build-all
# Build root package only
make build
# Build CDK app only
make build-app
# Run linter
make lint
# Fix linting issues
make lint-fix
# Format code
make format
# Check formatting (CI)
make format-check
# Format and fix linting
make format-fix
# Run all quality checks (format + lint)
make check
# Synthesize CloudFormation templates
make synth
# Show CDK diff
make diff
# Deploy all stacks
make deploy
# Deploy specific stack
make deploy-stack STACK=StackName
# CI check (format-check + lint)
make ci-check
# CI build (checks + full build)
make ci-build
# CI deploy (checks + build + synth)
make ci-deploy
The Makefile wraps these npm commands:
npm install # Install dependencies
npm run clean # Clean build artifacts
npm run build # Build root package
npm run build:workspaces # Build all packages
npm run build:app # Build CDK app
npm run lint # Run linter
npm run lint:fix # Fix linting
npm run format # Format code
npm run format:check # Check formatting
npm run format:fix # Format and fix linting
npm run synth # Synthesize CDK
npm run diff # CDK diff
npm run deploy # Deploy CDK
The build process ensures packages are built in dependency order:
src/) - Built firstaws) - No internal dependenciescodeartifact) - Built after dependenciesbin/, lib/) - Built last, can import from all packagesThe build:workspaces script:
npm run build)node_modules/@cdk-constructs/cdk/ for workspace resolutionbin/, lib/)tsconfig.json)src/**/* onlybin/, lib/, and packages/tsconfig.app.json)bin/**/* and lib/**/*tsconfig.build.json)This project follows a strict multi-account deployment pattern for security, isolation, and supply chain integrity.
| Account | Purpose | Access Pattern |
|---|---|---|
| BUILD | CI/CD pipelines, artifact generation, supply chain security | Isolated account. Other accounts can access readonly/immutable. |
| DEV | Active development and testing | Can access BUILD artifacts (readonly). |
| STAGING | Pre-production testing and validation | Can access BUILD artifacts (readonly). |
| PROD | Production workloads | Can access BUILD artifacts (readonly). |
CRITICAL: The BUILD account MUST be its own isolated AWS account.
// BUILD environment - owns the artifact repository
{
...buildEnv,
codeArtifact: {
codeArtifactDomainName: 'cdk-constructs',
codeArtifactRepositoryName: 'cdk-constructs-library-build',
codeArtifactRepositoryDescription: 'Build Repository - Supply Chain Security',
// All accounts can access, but only BUILD can write
allowedAccounts: [Account.BUILD, Account.DEV, Account.STAGING, Account.PROD],
},
}
// Application environments - consume artifacts from BUILD
{
...devEnv,
codeArtifact: {
// DEV has its own repository but also accesses BUILD
allowedAccounts: [Account.DEV, Account.STAGING, Account.BUILD],
},
}
Environment configurations follow CDK conventions:
lib/types/project.ts - ProjectEnvironment typelib/config/environments.ts - buildEnv, devEnv, stagingEnv, prodEnvbin/environment.ts - Backwards compatibilityThis follows the pattern: bin/ → lib/ for CDK applications.
Solution:
make install to set up workspace linksmake build-all to build packages in ordertsconfig.build.jsonSolution:
package.jsontsconfig.build.json