Skip to content

Commit

Permalink
chore(ubergen): combine all Rosetta fixtures (#13670)
Browse files Browse the repository at this point in the history
We need this to have `jsii-rosetta` runs that try to translate READMEs
from submodules not crash (because it can't find the referenced fixture
files).

This is not a correct final state yet, but it makes the build not crash.

Hopefully allows aws/jsii#2712 to be merged.


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
rix0rrr authored Mar 18, 2021
1 parent ca42461 commit e047bda
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/aws-cdk-lib/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ dist
# Ignore barrel import entry points
/*.ts

junit.xml
junit.xml
rosetta
1 change: 1 addition & 0 deletions packages/aws-cdk-lib/.npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ tsconfig.json
# exclude cdk artifacts
**/cdk.out
junit.xml
rosetta
21 changes: 21 additions & 0 deletions tools/ubergen/bin/ubergen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ async function main() {
const libraries = await findLibrariesToPackage(uberPackageJson);
await verifyDependencies(uberPackageJson, libraries);
await prepareSourceFiles(libraries, uberPackageJson);
await combineRosettaFixtures(libraries);
}

main().then(
Expand Down Expand Up @@ -232,6 +233,25 @@ async function prepareSourceFiles(libraries: readonly LibraryReference[], packag
console.log('\t🍺 Success!');
}

async function combineRosettaFixtures(libraries: readonly LibraryReference[]) {
console.log('📝 Combining Rosetta fixtures...');

const uberRosettaDir = path.resolve(LIB_ROOT, '..', 'rosetta');
await fs.remove(uberRosettaDir);

for (const library of libraries) {
const packageRosettaDir = path.join(library.root, 'rosetta');
if (await fs.pathExists(packageRosettaDir)) {
await fs.copy(packageRosettaDir, uberRosettaDir, {
overwrite: true,
recursive: true,
});
}
}

console.log('\t🍺 Success!');
}

async function transformPackage(
library: LibraryReference,
uberPackageJson: PackageJson,
Expand Down Expand Up @@ -424,6 +444,7 @@ const IGNORED_FILE_NAMES = new Set([
'.gitignore',
'.jest.config.js',
'.jsii',
'.npmignore',
'node_modules',
'package.json',
'test',
Expand Down

0 comments on commit e047bda

Please sign in to comment.