Search code examples
javascriptnode.jsreactjsgitmonorepo

What situations should should I use lerna or yarn workspace for monorepo?


Question 1: Sould I use monorepo in my situation?

I now have several react projects that developing in separate repos, they don't share codes each other but they all share a Components lib which is also an independent repo, I think that too much separation can lead to untraceable, and I'm wondering if my situation is suitable for using monorepo.

Question 2: If I use monorepo, how can I link different version for different Packages.

For example, I have packages/lib packages/b packages/c. And b using [email protected], c using [email protected]

How can I manage that without publish to npm.

Question 3: Back to the title, what situations would you choose to use monorepo?


Solution

  • Answer 1

    If you already had a separate repository with your library, it is already configurated and it works for you. I don't think you need a monorepo, further the projects doesn't have relation (except lib), didn't it? What kind of untraceable things you think is boring you? Maybe it's easier to solve that kind of problem, monorepo will bring new problems to you as well.

    Answer 2

    I don't think you can, not out of the box

    Answer 3

    You would choose monorepo to build a repository which has many projects that has dependencies, that means it's probably easier to control the version of each package during build time. When I do need to perform tests in all packages to invalidate some. Of course it is all achieved using multirepos, but it's all in one repository.


    This is just my opinion at the moment, maybe because it's easier for me right now.