Skip to content

Commit

Permalink
chore: copy fewer files in MonoCDK (aws#8626)
Browse files Browse the repository at this point in the history
Stop copying "output" files (`.d.ts` and `.js` files corresponding to a
`.ts` file) when preparing `monocdk-experiment` for build. This saves
some copy operations and avoids copying artifacts that include non
rewritten import statements.


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
RomainMuller authored Jun 18, 2020
1 parent d7bf724 commit daab8de
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/monocdk-experiment/build-tools/gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,13 @@ async function copyOrTransformFiles(from: string, to: string, libraries: readonl
const promises = (await fs.readdir(from)).map(async name => {
if (shouldIgnoreFile(name)) { return; }

if (name.endsWith(".d.ts") || name.endsWith(".js")) {
if (await fs.pathExists(path.join(from, name.replace(/\.(d\.ts|js)$/, ".ts")))) {
// We won't copy .d.ts and .js files with a corresponding .ts file
return;
}
}

const source = path.join(from, name);
const destination = path.join(to, name);

Expand Down

0 comments on commit daab8de

Please sign in to comment.