Skip to content

feat(cli): can match notices against Node version#128

Merged
aws-cdk-automation merged 4 commits intomainfrom
huijbers/match-node-version
Feb 25, 2025
Merged

feat(cli): can match notices against Node version#128
aws-cdk-automation merged 4 commits intomainfrom
huijbers/match-node-version

Conversation

@rix0rrr
Copy link
Contributor

@rix0rrr rix0rrr commented Feb 25, 2025

This allows publishing notices that match against the version of Node we're executing on.

Implemented by generalizing the code that matches against CLI version and bootstrap versions: it can now match against arbitrary named components.

Also implement more complex matching rules: currently we match the pattern if one of them matches:

// Matches if one of A, B or C matches
components: [A, B, C]

Instead, generalize to Disjunctive Normal Form and treat the current case as a special case of DNF where every conjunction has one element:

// The above gets interpreted as
components: [[A], [B], [C]]

// More complex rules: A and B together, or C
components: [[A, B], [C]]

This way we can write rules to say that "component X on Node version Y" should get a notice.


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@rix0rrr rix0rrr requested a review from a team February 25, 2025 11:19
}

export class NoticesFilter {
export abstract class NoticesFilter {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

To make it very clear that this class doesn't have any instance methods on purpose.

@codecov-commenter
Copy link

codecov-commenter commented Feb 25, 2025

Codecov Report

Attention: Patch coverage is 95.85492% with 8 lines in your changes missing coverage. Please review.

Project coverage is 84.59%. Comparing base (321a46a) to head (9bf28e2).
Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
packages/aws-cdk/lib/notices.ts 97.32% 3 Missing and 2 partials ⚠️
packages/aws-cdk/lib/tree.ts 50.00% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #128      +/-   ##
==========================================
- Coverage   84.74%   84.59%   -0.16%     
==========================================
  Files         196      196              
  Lines       35089    35187      +98     
  Branches     4546     4537       -9     
==========================================
+ Hits        29736    29765      +29     
- Misses       5207     5271      +64     
- Partials      146      151       +5     
Flag Coverage Δ
suite.unit 84.59% <95.85%> (-0.16%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@aws-cdk-automation aws-cdk-automation added this pull request to the merge queue Feb 25, 2025
Merged via the queue into main with commit 757ae69 Feb 25, 2025
20 checks passed
@aws-cdk-automation aws-cdk-automation deleted the huijbers/match-node-version branch February 25, 2025 14:53
github-merge-queue bot pushed a commit to cdklabs/aws-cdk-notices that referenced this pull request Mar 3, 2025
Relies on Node matching support for notices:
aws/aws-cdk-cli#128

---------

Signed-off-by: github-actions <github-actions@github.com>
Co-authored-by: github-actions <github-actions@github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

Comments