Skip to content

Instantly share code, notes, and snippets.

@ArunMichaelDsouza
Last active February 27, 2020 10:23
Show Gist options
  • Save ArunMichaelDsouza/03bd24bd1f236fa42f21e15724e4c6ea to your computer and use it in GitHub Desktop.
Save ArunMichaelDsouza/03bd24bd1f236fa42f21e15724e4c6ea to your computer and use it in GitHub Desktop.
Lerna basic usage
1) Initialise lerna
> lerna init
2) Create packages
> cd packages && mkdir package1 && cd package1 && yarn init -y
or
> lerna create package1 -y // This would scaffold a package directory
3) Add dependencies
> lerna add package2 // Installs dependency to all packages except package2
> lerna add package2 --scope=package1 // Installs package2 only to package1
> yarn add package2 // Installs global(top-level) dependency
4) Link all dependencies
> lerna bootstrap
5) Clean all dependencies
> lerna clean
6) Hoist all dependencies while linking
> lerna bootstrap --hoist
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment