What
A single repository holding the code of multiple projects .
What
A tool that helps you manage multi-package Monorepos with Git and npm
Created by Babel contributors to help them manage 100+ babel packages.
Why
Teams collaborate more efficiently.
Why
React Web app A - website
React Web app B - chrome extension
React native Mobile app
Shared view components
Style guide app
Graphical assets library
Utilities ( validators / parsers / middleware… )
Microservices
Why
Who
How
npm install -g lernagit init my-mono-repo && cd my-mono-repolerna initHow
How
How
lerna init -iHow
{
"packages": [
"packages/*"
],
"version": "independent",
"npmClient": "yarn",
"useWorkspaces": true
}{
"name": "root",
"private": true,
"devDependencies": {
"lerna": "^3.13.4"
},
"workspaces": ["packages/*"]
}How
lerna bootstrapHow
lerna publishHow
lerna import <path-to-external-repository>How
lerna run <npm script> -- [...args]lerna run build
lerna run start --scope "foo-*"
lerna run watch --parallel --streamHow
lerna exec -- <shell command>lerna exec -- ls
lerna exec -- rm rf ./node_modulesHow
lerna clean [--yes] [--scope] [--ignore]# Equivalent to:
$ lerna exec -- rm -rf ./node_modules