open-constructs / cdk-serverless

AWS CDK Serverless Toolsuite
Apache License 2.0
80 stars 4 forks source link

feat: Make cdk-serverless projects self-bootstrapping #277

Closed DerDackel closed 11 months ago

DerDackel commented 11 months ago

If there is no source schema/definition provided for any of the projen component types introduced by cdk-serverless, the framework should be able to bootstrap placeholders, so a working project can be generated and amended with proper definitions later.

cdk-serverless needs to be applied to an already-synthesized projen project and if any of the generator components are used, the schema or definition files (e.g. an openapi.yaml) must already exist at the correct locations, or projen will crash and fail to synthesize a project.

If the given definition file name can not be found, it will now be populated with a tiny placeholder so projen can synthesize a project and the user can place the correct file later.

This PR will make cdk-serverless succeed in several cases which would cause a projen synth failure before. This PR also revises code generation for cdk-serverless to take place during the projen synthesize step rather than on component construction. This PR also refactors several paths to be relative to the project directory rather than the cwd of the node process running projen.

Status: