From 05d875bd8a2b46d47e9fb250e5b2b6ab28d5b0de Mon Sep 17 00:00:00 2001 From: Kaizen Conroy <36202692+kaizencc@users.noreply.github.com> Date: Wed, 12 Jul 2023 13:17:43 -0400 Subject: [PATCH] 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* --- packages/aws-cdk-lib/aws-backupgateway/README.md | 2 +- packages/aws-cdk-lib/aws-cleanrooms/README.md | 2 +- packages/aws-cdk-lib/aws-proton/README.md | 2 +- tools/@aws-cdk/pkglint/lib/library-creation.ts | 2 +- tools/@aws-cdk/pkglint/test/libary-creation.test.ts | 8 ++++---- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/aws-cdk-lib/aws-backupgateway/README.md b/packages/aws-cdk-lib/aws-backupgateway/README.md index 71de5ac737451..1eb7cabfc3507 100644 --- a/packages/aws-cdk-lib/aws-backupgateway/README.md +++ b/packages/aws-cdk-lib/aws-backupgateway/README.md @@ -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'; ``` diff --git a/packages/aws-cdk-lib/aws-cleanrooms/README.md b/packages/aws-cdk-lib/aws-cleanrooms/README.md index 117249fc13e53..d5704db2b153e 100644 --- a/packages/aws-cdk-lib/aws-cleanrooms/README.md +++ b/packages/aws-cdk-lib/aws-cleanrooms/README.md @@ -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'; ``` diff --git a/packages/aws-cdk-lib/aws-proton/README.md b/packages/aws-cdk-lib/aws-proton/README.md index 557882eeb9b6e..6b751e418d18d 100644 --- a/packages/aws-cdk-lib/aws-proton/README.md +++ b/packages/aws-cdk-lib/aws-proton/README.md @@ -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'; ``` diff --git a/tools/@aws-cdk/pkglint/lib/library-creation.ts b/tools/@aws-cdk/pkglint/lib/library-creation.ts index c035ce168c7e0..4287f99d5f969 100644 --- a/tools/@aws-cdk/pkglint/lib/library-creation.ts +++ b/tools/@aws-cdk/pkglint/lib/library-creation.ts @@ -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}`; diff --git a/tools/@aws-cdk/pkglint/test/libary-creation.test.ts b/tools/@aws-cdk/pkglint/test/libary-creation.test.ts index bf7a2e03ed5ca..d2d76b2c3ce9e 100644 --- a/tools/@aws-cdk/pkglint/test/libary-creation.test.ts +++ b/tools/@aws-cdk/pkglint/test/libary-creation.test.ts @@ -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', @@ -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', @@ -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', @@ -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';"); }); });