Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged

Conversation

DerDackel
Copy link
Contributor

@DerDackel DerDackel commented Dec 15, 2023

  • Please check if the PR fulfills these requirements
  • The commit message describes your change
  • Tests for the changes have been added if possible (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)
  • Changes are mentioned in the changelog (for bug fixes / features)
  • What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)

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.

  • What is the current behavior? (You can also link to an open issue here)

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.

  • What is the new behavior (if this is a feature change)?

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.

  • Does this PR introduce a breaking change? (What changes might users need to make in their setup due to this PR?)

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.

  • Other information:

Status:

  • Basic support for RestApi
  • Basic support for GraphQlApi
  • Basic support for Datastore
  • Basic support for Sfn Workflows
  • Neater placeholders

@@ -10,9 +10,15 @@ export interface DatastoreOptions {

export class Datastore extends pj.Component {

protected readonly definitionFile: string;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this needed? You could use this.options.definitionFile couldn't you?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After a night's sleep I don't know why I did that in the first place. Gonna change it.

@hoegertn hoegertn added the enhancement New feature or request label Dec 15, 2023
@DerDackel DerDackel marked this pull request as ready for review December 16, 2023 18:43
@mergify mergify bot merged commit e6643fa into open-constructs:main Dec 25, 2023
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants