Wow, it’s been a fair while since I last blogged! Well: let’s get straight to it!
Yesterday I discovered that yarn
(the alternative npm
client from Facebook)
had introduced a new feature called yarn workspaces
which makes working with
monorepos a lot easier. I’m working on a couple of projects recently that use
the monorepo approach (one is a client project in which I introduced the
monorepo approach to share code between React, React-Native and Chrome
extension apps easily; the other is the Graphile OSS
project I’m currently working on). We’ve had a few
minor irritations working with lerna
, the most notable of which is that when
we want to install a new dependency we can’t just yarn install
it - instead
we have to add it to package.json and run lerna bootstrap
again. At first
this wasn’t so bad, but it quickly becomes a chore!
Upon reading the announcement it immediately sounded like yarn workspaces would solve this problem (and more!) so I decided to get on board!
This is awesome; I'm going to try this out with Graphile tomorrow! https://t.co/213mvRmGbX
— Benjie Gillam (@Benjie) August 3, 2017
So, without further ado, here’s how I switched graphile-build to yarn workspaces (still with lerna):