I'm exploring Rush/PNPM and Typescript with project references and incremental builds but I'm a little confused about which of the two will be the best at managing incremental builds.
If I use the built-in command to rush build
an incremental build, I think Rush rightly recognizes the dependencies from among all the known projects' package.json declarations and runs the build
script of each of them in dependency order. If each typescript project's build
script is ./node_modules/.bin/tsc -b .
then each dependency up the tree will be built in dependency order.
Therein, tsc
will also be evaluating the package.json dependencies against its references
path
s list. Ideally it will(?) recognize that earlier independent builds of its dependencies make them current and don't need rebuilding, and then only build the code for the immediate project as part of its rush build
invoked build. If this is even reliable and stable, it seems like an unnecessary number of dependency tree evaluations at best, right?
I experimented with overriding rush's build
bulk
command to ignoreMissingScript
in command-line.json and only define "build": "./node_modules/.bin/tsc -b ."
on the top-most application's package.json. (The idea is to use an alternative build-me
or whatever in the sub-projects in case I want to really just rebuild one of them and only its dependencies for some reason.) Because of the nature of bulk commands, Rush emits messages about skipped builds and missing scripts which could be misleading to the developer. Also, I'm not convinced that all the projects are being compiled - I'm not seeing the resulting js files, for example - perhaps that's an unrelated problem.
I don't see any easy Rush configuration for deferring to typescript - we aren't allowed to override build
command-line to be a global
-style shell command. I feel like I really only want Rush for package management and not for script-running (since it's too constrained). But also, I can't easily discourage rush build
in favor of some other way of running the main project's typescript incremental build. I'm surprised not to be finding any relevant search results, seeing as how these are both cutting-edge Microsoft projects. Am I missing something fundamental?