-
Notifications
You must be signed in to change notification settings - Fork 4.1k
chore: make all L2 Constructs property injectable during release #34328
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(This review is outdated)
✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some minor changes requested
if (parts.length < 2) { | ||
throw new Error(`Could not build PROPERTY_INJECTION_ID for ${filePath} ${className}`); | ||
} | ||
return `'aws-cdk-lib.${parts[0]}.${className}'`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about alpha modules?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I am not familiar with alpha modules. Can you give me some examples and I can add them to the unit tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Modules in packages/@aws-cdk/
are alpha modules (aka experimental modules). The constructs in these modules should also be property injectable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated the logic to handle /packages/@awsk-cdk/...
/** | ||
* This adds import of prop-injectable to the file. | ||
*/ | ||
private importPropertyInjectable(sourceFile: SourceFile, filePath: string) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we group this method and the below addImportAndMetadataStatement
's import part together into a function and make the function generic to handle different import statement input?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make sense. Let me combine them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addImportAndMetadataStatementn and makeConstructsPropInjectable both use importCoreLibFile
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you!
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
Comments on closed issues and PRs are hard for our team to see. |
Issue # (if applicable)
This is a followup to #33887.
DO NOT merge this PR until after 33887 is merged.
Reason for this change
In the original Property Injection PR, we enabled 122 Constructs for Property Injections, but we want to make this feature available for all L2 Constructs.
Description of changes
Add logic to Constructs ConstructsUpdater to if a Construct already have PROPERTY_INJECTION_ID property. If not, it will:
Describe any new or updated permissions being added
No permission change.
Description of how you validated changes
npm test
./bin/update-construct-metadata
locally and manually verified a few random files.Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license