Skip to content

Commit

Permalink
chore(individual-pkg-gen): strip redundant 'aws' from go package names (
Browse files Browse the repository at this point in the history
#17097)

Currently, the published go alpha modules look like this:
`github.com/aws/aws-cdk-go/awscdkawsfoobaralpha/v2`

The redundant 'aws' in front of each service package name leads to a longer
package name than necessary, on an already long name. This change explicitly
sets the 'go' package name for each of the alpha modules, so they turn out like
this:
`github.com/aws/aws-cdk-go/awscdkfoobaralpha/v2`


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
njlynch authored Oct 21, 2021
1 parent 74066ca commit ee24046
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tools/@aws-cdk/individual-pkg-gen/transform-packages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,11 @@ function transformPackageJson(pkg: any, source: string, destination: string, alp
jsiiTargets.python.distName += '-alpha';
jsiiTargets.python.module += '_alpha';
// Typically, only our top-level packages have a Go target.
// moduleName is needed; packageName will be automatically derived by from the package name.
// packageName has unusable chars and redundant 'aws' stripped.
// This generates names like 'awscdkfoobaralpha' (rather than 'awscdkawsfoobaralpha').
jsiiTargets.go = {
moduleName: 'github.com/aws/aws-cdk-go',
packageName: packageJson.name.replace('/aws-', '').replace(/[^a-z0-9.]/gi, '').toLowerCase(),
};

const finalPackageJson = transformPackageJsonDependencies(packageJson, pkg, alphaPackages);
Expand Down

0 comments on commit ee24046

Please sign in to comment.