Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

with lerna monorepo, how to reference different versions of a shared package?

New to lerna and monorepo, my understanding is with lerna, we put all shared packages and all consumer packages in a single repo. Then after 'lerna bootstrap', consumer1 and consumer2 will both have a local link to shared1 (symllink). So whenever I make changes in shared1, both consumer1 and consumer2 are affected.

Is there a way to make consumer1 and consumer2 point to different versions of shared1? so that when I make changes in shared1, only consumer1 is affected and consumer2 is not.

like image 823
Nan Li Avatar asked Apr 04 '18 16:04

Nan Li


People also ask

How does lerna detect changes?

Lerna detects by itself which packages have changed since the last release and publishes only the new versions. But this feature only works for publishing, not testing. While Lerna doesn't support change-based testing, Semaphore does. And it's pretty easy to configure.

Is lerna deprecated?

But surprisingly many still haven't heard that Lerna is back, far from obsolete or deprecated and is getting brand new features. We from Nrwl are the creators of Nx and given our long history in the monorepo space, we offered to take over stewardship of Lerna when it was declared “dead” in April 2022.


1 Answers

One of the big benefits of using lerna is the fact that your code within the monorepo is always building and testing with the latest versions of their child dependencies. If your consumers need to use different versions of shared code, then those consumers probably do not belong within this monorepo and should be installing the shared code independently. Here is a closed github thread covering this also.

like image 195
jjbskir Avatar answered Oct 13 '22 11:10

jjbskir