Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run a single, top-level tsc --build #2923

Merged
merged 5 commits into from
Aug 25, 2021
Merged

Run a single, top-level tsc --build #2923

merged 5 commits into from
Aug 25, 2021

Conversation

jeffposnick
Copy link
Contributor

R: @tropicadri

TypeScript has support for project references, which work well for monorepos, like our own. We've been configuring our tsconfig.json files for use with project references, but we haven't actually been taking advantage of them from a compilation perspective. Instead, our build process would start a new tsc --build for each sub-package. This is partly because it was easier to migrate to TypeScript if we kept our old per-package build process in place, but now that we're almost all TypeScript, it can be improved.

This PR removes all of the per-package tsc --build invocations in favor of a single tsc --build run with our top-level tsconfig.json, which includes all of the project references.

This PR also stops cleaning up the TypeScript build artifacts from the previous build prior to starting a new build, as the composite setting means that they can be used to speed up subsequent builds. This is useful when running gulp build a few times in row while testing out some changes. I've moved the clean-up process to the gulp publish task flow, to ensure that nothing out of date ends up inadvertently published. (I haven't tested this flow yet, so this is something to keep an eye on the next time we cut a release.)

With these changes, I've seen gulp build drop from around 75 seconds to 30 seconds on my laptop.

gulp-tasks/transpile-typescript.js Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants