Skip to content

Commit 05d875b

Browse files
authoredJul 12, 2023
fix(pkglint): library creation generates incorrect package names (#26330)
Fairly certain that `options.packageName` is only used in the README example generation so there should be no other side-effects. The reason why this wasn't caught earlier is because we turned `rosetta:strict` off. I am working on a separate PR to fix those issues. These are not the only modules with faulty examples. The rest will be fixed in #26331 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent cc4ce12 commit 05d875b

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed
 

‎packages/aws-cdk-lib/aws-backupgateway/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project.
1717

1818
```ts nofixture
19-
import * as backupgateway from '@aws-cdk/aws-backupgateway';
19+
import * as backupgateway from 'aws-cdk-lib/aws-backupgateway';
2020
```
2121

2222
<!--BEGIN CFNONLY DISCLAIMER-->

‎packages/aws-cdk-lib/aws-cleanrooms/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project.
1717

1818
```ts nofixture
19-
import * as cleanrooms from '@aws-cdk/aws-cleanrooms';
19+
import * as cleanrooms from 'aws-cdk-lib/aws-cleanrooms';
2020
```
2121

2222
<!--BEGIN CFNONLY DISCLAIMER-->

‎packages/aws-cdk-lib/aws-proton/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project.
1717

1818
```ts nofixture
19-
import * as proton from '@aws-cdk/aws-proton';
19+
import * as proton from 'aws-cdk-lib/aws-proton';
2020
```
2121

2222
<!--BEGIN CFNONLY DISCLAIMER-->

‎tools/@aws-cdk/pkglint/lib/library-creation.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export function createModuleDefinitionFromCfnNamespace(namespace: string): Modul
2424
const submoduleName = moduleName.replace('-', '_');
2525

2626
const lowcaseModuleName = moduleBaseName.toLocaleLowerCase();
27-
const packageName = `@aws-cdk/${moduleName}`;
27+
const packageName = `aws-cdk-lib/${moduleName}`;
2828

2929
// dotnet names
3030
const dotnetPackage = `Amazon.CDK.${moduleFamily}.${moduleBaseName}`;

‎tools/@aws-cdk/pkglint/test/libary-creation.test.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ describe('createModuleDefinitionFromCfnNamespace', () => {
1111
moduleName: 'aws-ec2',
1212
moduleFamily: 'AWS',
1313
moduleBaseName: 'EC2',
14-
packageName: '@aws-cdk/aws-ec2',
14+
packageName: 'aws-cdk-lib/aws-ec2',
1515
dotnetPackage: 'Amazon.CDK.AWS.EC2',
1616
javaGroupId: 'software.amazon.awscdk',
1717
javaPackage: 'services.ec2',
@@ -30,7 +30,7 @@ describe('createModuleDefinitionFromCfnNamespace', () => {
3030
moduleName: 'aws-sam',
3131
moduleFamily: 'AWS',
3232
moduleBaseName: 'SAM',
33-
packageName: '@aws-cdk/aws-sam',
33+
packageName: 'aws-cdk-lib/aws-sam',
3434
dotnetPackage: 'Amazon.CDK.AWS.SAM',
3535
javaGroupId: 'software.amazon.awscdk',
3636
javaPackage: 'services.sam',
@@ -49,7 +49,7 @@ describe('createModuleDefinitionFromCfnNamespace', () => {
4949
moduleName: 'alexa-ask',
5050
moduleFamily: 'Alexa',
5151
moduleBaseName: 'ASK',
52-
packageName: '@aws-cdk/alexa-ask',
52+
packageName: 'aws-cdk-lib/alexa-ask',
5353
dotnetPackage: 'Amazon.CDK.Alexa.ASK',
5454
javaGroupId: 'software.amazon.awscdk',
5555
javaPackage: 'alexa.ask',
@@ -81,6 +81,6 @@ describe('createLibraryReadme', () => {
8181
await createLibraryReadme('Alexa::ASK', readmePath);
8282

8383
const readme = fs.readFileSync(readmePath, { encoding: 'utf8' });
84-
expect(readme).toContain("import * as alexa_ask from '@aws-cdk/alexa-ask';");
84+
expect(readme).toContain("import * as alexa_ask from 'aws-cdk-lib/alexa-ask';");
8585
});
8686
});

0 commit comments

Comments
 (0)
Please sign in to comment.