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(cli): support for matching notices with arbitrary module names #19088
Conversation
Type of main updated; Refresh doesn't force a cache update
# Conflicts: # packages/aws-cdk/README.md # packages/aws-cdk/lib/notices.ts # packages/aws-cdk/test/notices.test.ts
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.
Approved modulo small changes
packages/aws-cdk/lib/notices.ts
Outdated
@@ -206,8 +207,23 @@ export class NoticeFilter { | |||
if (this.acknowledgedIssueNumbers.has(notice.issueNumber)) { | |||
return false; | |||
} | |||
|
|||
const components = flatMap(notice.components, component => { |
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 could do with a comment
packages/aws-cdk/lib/notices.ts
Outdated
* A node in the construct tree. | ||
* @internal | ||
*/ | ||
interface Node { |
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.
Node
is very minimal, given that we could have a lot of trees going on. ConstructTreeInfoNode
or something?
packages/aws-cdk/lib/notices.ts
Outdated
function match(query: Component[], tree: Node): boolean { | ||
return some(tree, node => { | ||
return query.some(component => | ||
node.constructInfo?.fqn.startsWith(component.name) && |
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.
Yes, but we should also check that the component.name
is followed by either .
or the end of the string.
We don't want:
{ name: '@aws-cdk/aws-events' }
To match
@aws-cdk/aws-events-targets
Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
This change allows us to publish notices to match any arbitrary module or
construct. For example, a notice that targets the component
will be displayed to the user if they have in their cloud assembly a resource of
type
@aws-cdk/aws-apigatewayv2-alpha.HttpStage
or@aws-cdk/aws-apigatewayv2-alpha.HttpApi
or any other construct from theapigatewayv2
module, as long as it was built using some version of themodule above or equal to 2.10.0.
We can also target a specific construct, instead:
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license