Skip to content

Commit b6faaba

Browse files
authored
fix(cli): notices for ranged alpha modules are not showing up correctly (#163)
Fixes an issue where notices don't show up when we define a range of pre-releases semver for alpha modules. --- By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license
1 parent 0d9912f commit b6faaba

File tree

3 files changed

+62
-1
lines changed

3 files changed

+62
-1
lines changed

packages/aws-cdk/lib/notices.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ export abstract class NoticesFilter {
142142
// component can match more than one actual component
143143
for (const ands of ors) {
144144
const matched = ands.map(affected => actualComponents.filter(actual =>
145-
NoticesFilter.componentNameMatches(affected, actual) && semver.satisfies(actual.version, affected.version)));
145+
NoticesFilter.componentNameMatches(affected, actual) && semver.satisfies(actual.version, affected.version, { includePrerelease: true })));
146146

147147
// For every clause in the filter we matched one or more components
148148
if (matched.every(xs => xs.length > 0)) {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
"version": "tree-0.1",
3+
"tree": {
4+
"id": "App",
5+
"path": "",
6+
"children": {
7+
"integ-idp": {
8+
"id": "integ-idp",
9+
"path": "integ-idp",
10+
"children": {
11+
"identitypool": {
12+
"id": "identitypool",
13+
"path": "integ-idp/identitypool",
14+
"constructInfo": {
15+
"fqn": "@aws-cdk/aws-cognito-identitypool-alpha.IdentityPool",
16+
"version": "2.175.0-alpha.0",
17+
"metadata": ["*", "*"]
18+
}
19+
}
20+
},
21+
"constructInfo": {
22+
"fqn": "@aws-cdk/integ-tests-alpha.IntegTest",
23+
"version": "0.0.0"
24+
}
25+
},
26+
"Tree": {
27+
"id": "Tree",
28+
"path": "Tree",
29+
"constructInfo": {
30+
"fqn": "constructs.Construct",
31+
"version": "10.4.2"
32+
}
33+
}
34+
},
35+
"constructInfo": {
36+
"fqn": "aws-cdk-lib.App",
37+
"version": "0.0.0"
38+
}
39+
}
40+
}

packages/aws-cdk/test/notices.test.ts

+21
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,19 @@ const NOTICE_FOR_APIGATEWAYV2 = {
131131
schemaVersion: '1',
132132
};
133133

134+
const NOTICES_FOR_IDENTITY_POOL = {
135+
title: 'Regression on module foobar',
136+
issueNumber: 1234,
137+
overview: 'Some bug description',
138+
components: [
139+
{
140+
name: "@aws-cdk/aws-cognito-identitypool-alpha.IdentityPool",
141+
version: ">=2.74.0-alpha.0 <2.179.0-alpha.0"
142+
}
143+
],
144+
schemaVersion: '1',
145+
}
146+
134147
const NOTICE_FOR_APIGATEWAY = {
135148
title: 'Regression on module foobar',
136149
issueNumber: 1234,
@@ -247,6 +260,14 @@ describe(NoticesFilter, () => {
247260
expect(NoticesFilter.filter({ data: [NOTICE_FOR_APIGATEWAYV2_CFN_STAGE], cliVersion, bootstrappedEnvironments: [], outDir: path.join(__dirname, 'cloud-assembly-trees', 'experimental-module') }).map(f => f.notice)).toEqual([NOTICE_FOR_APIGATEWAYV2_CFN_STAGE]);
248261
});
249262

263+
test('module with pre-release version', () => {
264+
// doesn't matter for this test because our data only has framework notices
265+
const cliVersion = '1.0.0';
266+
267+
// module-level match
268+
expect(NoticesFilter.filter({ data: [NOTICES_FOR_IDENTITY_POOL], cliVersion, bootstrappedEnvironments: [], outDir: path.join(__dirname, 'cloud-assembly-trees', 'experimental-module-pre-release-semver')}).map(f => f.notice)).toEqual([NOTICES_FOR_IDENTITY_POOL]);
269+
});
270+
250271
test('bootstrap', () => {
251272
// doesn't matter for this test because our data only has bootstrap notices
252273
const outDir = path.join(__dirname, 'cloud-assembly-trees', 'built-with-2_12_0');

0 commit comments

Comments
 (0)