This document is a work in progress.
For any packages that you add to your Lerna repository, instead of running
npm install
you should run lerna bootstrap
. This will take into
account the existing projects in the packages
folder as well as
external dependencies.
Create a directory for your package in the packages
folder, and run npm init
as normal to create the package.json
for your new package.
You can use lerna import <package>
to transfer an existing package
into your Lerna repository; this command will preserve the commit history.
lerna import <package>
takes a local path rather than a URL. In this
case you will need to have the repo you wish to link to on your file system.
Sometimes, lerna publish
does not work. Your network may have had a hiccup, you may have not been logged on to npm, etc.
If the lerna.json
has not yet been updated, simply try lerna publish
again.
If it has been updated, you can force re-publish. lerna publish --force-publish $(ls packages/)
Projects having many packages inside them could take a very long time to to bootstrap.
You can significantly reduce the time spent in lerna bootstrap
if you turn
on hoisting, see the hoisting docs for more information.
In combination with that you may increase the bootstrap performance even more by
using yarn as an npm client instead of npm
.