Skip to content

Commit

Permalink
fix(ubergen): expose exports in core module for v2 (#20176)
Browse files Browse the repository at this point in the history
Due to an oversight, embedded exports from core were not exported in cdk v2. This is necessary for #19773 to work. The export logic added in that PR would not get executed for `core`, but it is supposed to.

----

### All Submissions:

* [x] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/master/CONTRIBUTING.md)

### Adding new Unconventional Dependencies:

* [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/master/CONTRIBUTING.md/#adding-new-unconventional-dependencies)

### New Features

* [ ] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/master/INTEGRATION_TESTS.md)?
	* [ ] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)?

*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 May 3, 2022
1 parent c58fa44 commit fc2cd48
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions tools/@aws-cdk/ubergen/bin/ubergen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -292,8 +292,8 @@ async function prepareSourceFiles(libraries: readonly LibraryReference[], packag
indexStatements.push(`export * from './${library.shortName}';`);
} else {
indexStatements.push(`export * as ${library.shortName.replace(/-/g, '_')} from './${library.shortName}';`);
copySubmoduleExports(packageJson.exports, library, library.shortName);
}
copySubmoduleExports(packageJson.exports, library, library.shortName);
}

await fs.writeFile(path.join(libRoot, 'index.ts'), indexStatements.join('\n'), { encoding: 'utf8' });
Expand All @@ -317,9 +317,11 @@ function copySubmoduleExports(targetExports: Record<string, string>, library: Li
}
}

// If there was an export for '.' in the original submodule, this assignment will overwrite it,
// which is exactly what we want.
targetExports[`./${unixPath(visibleName)}`] = `./${unixPath(subdirectory)}/index.js`;
if (visibleName !== 'core') {
// If there was an export for '.' in the original submodule, this assignment will overwrite it,
// which is exactly what we want.
targetExports[`./${unixPath(visibleName)}`] = `./${unixPath(subdirectory)}/index.js`;
}
}

async function combineRosettaFixtures(libraries: readonly LibraryReference[], uberPackageJson: PackageJson) {
Expand Down

0 comments on commit fc2cd48

Please sign in to comment.