Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I keep yarn workspaces dependencies in sync

Let's say I have multiple packages in my yarn workspaces.

@mycompany/utils
@mycompany/app
@mycompany/serv

Let's say each of these packages has a dependency on lodash. I want to make sure that they all have the same lodash version.

Is there a way to do that in each of the package.json?

like image 305
Kenneth Truong Avatar asked Feb 02 '19 22:02

Kenneth Truong


1 Answers

Use syncpack to force all sub-packages in a monorepo uses the same version of each dependency.

Install in the root package.json:

yarn add --dev -W syncpack

Run (Recommnded: Run on every commit using husky):

syncpack list-mismatches

More info: https://github.com/JamieMason/syncpack

like image 102
Stav Alfi Avatar answered Sep 27 '22 23:09

Stav Alfi