3 ms·
I’ve tried several options for (typescript) monorepo maintenance, and in terms of feature coverage, I think Vercel’s “Turbo” system takes the cake compared to t
by raydiatian 4y ago
I’ve tried several options for (typescript) monorepo maintenance, and in terms of feature coverage, I think Vercel’s “Turbo” system takes the cake compared to the alternatives. Monorepo manager tools I’ve tried in the past: Raw workspaces (pnpm, yarn), lerna, rush, nx.
Features I was looking for (you’d be surprised how hard it is to get all of them)
1. pnpm support out of the box. WHY: pnpm just seems to be faster/smaller footprint than yarn, definitely npm.
2. Support for intramonorepo dependencies. WHY: our services can auto generate service-clients. It’s extremely helpful to be able to hack a couple of changes on one service and instantly see how your new API breaks other systems. No pushing packages to a private npm registry, waiting for devs to approve your request.
3. Global build system. Why: we have a bunch of micro services that are all frameworked out pretty much the same way, so for the sake of productivity it’s useful that we should be able to reuse the same Dockerfile to produce each, that way we can minify the container pretty efficiently.
4. topologically ordered build jobs. WHY: like I said, we have libraries & autogen service-clients in our monorepo. Building low level components first is a must.
5. Ability to add new projects at minimal overhead cost. WHY: it’s surprising how verbose most monorepo managers expect you to be just to add a new face to the group.
Turbo knocks it out of the park on almost all of these, a feat no other manager is capable of IME. It’s a little shaky on its pnpm support, and I wish that they’d expedite it, but we were able to separate build and development to use yarn & pnpm respectively (turbo has a Docker mode which is why this is relevant), so we can work around it.
Turbo then also brings its own “I didn’t know I wanted that” features to the table. Turbo’s caching functionality is crazy. You can configure it to be smart enough to detect when each of your libs/apps actually changes, otherwise the cached version of the build is bubbled up the chain.
If you want to monorepo in typescript, I’d recommend Turbo.