Context

As a maintainer for formatjs & react-intl, I use lerna to manage the monorepo, which includes several tasks:

  1. Manage npm dependencies installation
  2. Run npm scripts in a topologically-sorted order such as build or test
  3. Create new GitHub releases
  4. Generate CHANGELOGs
  5. Publish to npm

Lerna is pretty good at doing all of those 5 tasks but with the growth of the monorepo and the increasing amount of build time I figure we might need something that’s better suited for selective build. In the blog post I’ll walk you through my decision to drop lerna as a build system in favor of bazel.

First, the result

We now have a GitHub Action workflow with cache:

  • CI: we’re on par with the older system with more correctness & reproducibility (~14 minutes).
  • Selective Build (local): our build step went from 9 minutes to 50s — 10 minutes (depending on what changed).
  • Selective Test (local): our build step went from 4 minutes to 20s — 5 minutes (depending on what changed).
  • A lot less “works on my machine” issues.

#javascript #npm #bazel #lerna #node

Goodbye Lerna (sorta), hello Bazel
12.40 GEEK