LERNA Cheat Sheet

A list of Lerna commands I use infrequently and do not want to go googling for.

A list of Lerna commands I use infrequently and do not want to go googling for. The Lerna docs are useful, but sometimes lacking in detail, hence my small notes.

Add package to packages

lerna add @tiptap/starter-kit --scope "*-spa"Code language: Bash (bash)

This adds the “@tiptap/starter-kit” npm package to all of the packages in your lerna repo that end with “-spa”. Docs: add & filter-flags

lerna add yup --scope=user-spaCode language: Bash (bash)

This adds the “yup” npm package to just the “user-spa” package in your lerna repo.

Install, hoist, and create links

lerna bootstrapCode language: Bash (bash)

Installs all packages and hoists hoistable ones, and creates symlinks from local packages to packages that use them.

Publish packages

lerna publishCode language: Bash (bash)

Runs only once all changes have been committed, by default on the master branch only. Bumps all packages to next version, publishes non-private packages to their designated repo (not necessarily NPM).

Leave a Reply

Your email address will not be published. Required fields are marked *