Skip to content

(cli): provide a pre-synth build command by cli arg #19667

@misterjoshua

Description

@misterjoshua

Description

I want the CDK CLI to allow setting the build option with a command-line argument.

Use Case

We have a multi-package TypeScript project in a monorepo. Our CDK app is in one of those packages, and it depends on other packages - we build our packages in order of dependency.

We have two build profiles: One of them is a super slow, complete, type-checked build ("nx build cdk") that we run from CI. After CI builds all dependencies, we start construct tests in the cdk package and then cdk synth an output. The other is a faster build that we want CDK to run ("nx fast-build cdk") when it detects filesystem changes.

If we put the faster build in our cdk.json to make watch mode more convenient during development, the slow build run in CI will necessarily run both build profiles one after the other. The faster build outputs slightly different artifacts (not minified, not tree shaken, etc.), and it splats these artifacts over the slow build's artifacts. So, putting our faster build profile in the cdk.json affects the correctness of the CI.

Proposed Solution

I want to exclude "build" from my cdk.json and run watch mode like this: cdk watch --build "nx fast-build cdk"

Other information

No response

Acknowledge

  • I may be able to implement this feature request
  • This feature might incur a breaking change

Metadata

Metadata

Assignees

Labels

feature-requestA feature should be added or improved.needs-triageThis issue or PR still needs to be triaged.package/toolsRelated to AWS CDK Tools or CLI

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions