Skip to content

Commit

Permalink
fix(pkglint): library creation generates incorrect package names (#26330
Browse files Browse the repository at this point in the history
)

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*
  • Loading branch information
kaizencc committed Jul 12, 2023
1 parent cc4ce12 commit 05d875b
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion packages/aws-cdk-lib/aws-backupgateway/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project.

```ts nofixture
import * as backupgateway from '@aws-cdk/aws-backupgateway';
import * as backupgateway from 'aws-cdk-lib/aws-backupgateway';
```

<!--BEGIN CFNONLY DISCLAIMER-->
Expand Down
2 changes: 1 addition & 1 deletion packages/aws-cdk-lib/aws-cleanrooms/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project.

```ts nofixture
import * as cleanrooms from '@aws-cdk/aws-cleanrooms';
import * as cleanrooms from 'aws-cdk-lib/aws-cleanrooms';
```

<!--BEGIN CFNONLY DISCLAIMER-->
Expand Down
2 changes: 1 addition & 1 deletion packages/aws-cdk-lib/aws-proton/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project.

```ts nofixture
import * as proton from '@aws-cdk/aws-proton';
import * as proton from 'aws-cdk-lib/aws-proton';
```

<!--BEGIN CFNONLY DISCLAIMER-->
Expand Down
2 changes: 1 addition & 1 deletion tools/@aws-cdk/pkglint/lib/library-creation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export function createModuleDefinitionFromCfnNamespace(namespace: string): Modul
const submoduleName = moduleName.replace('-', '_');

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

// dotnet names
const dotnetPackage = `Amazon.CDK.${moduleFamily}.${moduleBaseName}`;
Expand Down
8 changes: 4 additions & 4 deletions tools/@aws-cdk/pkglint/test/libary-creation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe('createModuleDefinitionFromCfnNamespace', () => {
moduleName: 'aws-ec2',
moduleFamily: 'AWS',
moduleBaseName: 'EC2',
packageName: '@aws-cdk/aws-ec2',
packageName: 'aws-cdk-lib/aws-ec2',
dotnetPackage: 'Amazon.CDK.AWS.EC2',
javaGroupId: 'software.amazon.awscdk',
javaPackage: 'services.ec2',
Expand All @@ -30,7 +30,7 @@ describe('createModuleDefinitionFromCfnNamespace', () => {
moduleName: 'aws-sam',
moduleFamily: 'AWS',
moduleBaseName: 'SAM',
packageName: '@aws-cdk/aws-sam',
packageName: 'aws-cdk-lib/aws-sam',
dotnetPackage: 'Amazon.CDK.AWS.SAM',
javaGroupId: 'software.amazon.awscdk',
javaPackage: 'services.sam',
Expand All @@ -49,7 +49,7 @@ describe('createModuleDefinitionFromCfnNamespace', () => {
moduleName: 'alexa-ask',
moduleFamily: 'Alexa',
moduleBaseName: 'ASK',
packageName: '@aws-cdk/alexa-ask',
packageName: 'aws-cdk-lib/alexa-ask',
dotnetPackage: 'Amazon.CDK.Alexa.ASK',
javaGroupId: 'software.amazon.awscdk',
javaPackage: 'alexa.ask',
Expand Down Expand Up @@ -81,6 +81,6 @@ describe('createLibraryReadme', () => {
await createLibraryReadme('Alexa::ASK', readmePath);

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

0 comments on commit 05d875b

Please sign in to comment.