Creating, Testing and Building a Monorepo With Lerna and Yarn

Cesar William Alvarenga
The Startup
Published in
4 min readAug 2, 2020

--

I showed you the best practices to create a JavaScript SDK in last article. One of the best practices that I described was the importance of controlling the package’s version and share the codebase between them.

In this article, I’ll show how monorepo can help you to achieve those principles.

What is Monorepo?

In a nutshell, monorepo is a strategy where you will have all the application’s code in the same repository.

There are some cases that a monorepo fits well. For example, when you have an application with a mobile app, backend, frontend, and so on. With monorepo, we will have a folder for each of these parts and share code between them.

Another suitable case for this strategy is when you are creating a lib. The Angular framework is a famous example of that and uses this project structure.

Angular repo on GitHub

The project has a well-done decoupling with a lean core separated from the other modules as animations, forms, router, etc. In this Angular project in specific, all the modules have the same version number.

--

--