Run a single, top-level tsc --build #2923
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 newtsc --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 singletsc --build
run with our top-leveltsconfig.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 runninggulp build
a few times in row while testing out some changes. I've moved the clean-up process to thegulp 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.