Forrest logo
back to the lerna tool

lerna:tldr:b3050

lerna: Publish all packages that have changed since the last release.
$ lerna publish
try on your machine

The command "lerna publish" is used in the context of managing and publishing multiple packages within a monorepo using Lerna.

Lerna is a tool that enables the development and management of JavaScript projects with multiple packages, also known as a monorepo. It simplifies the workflow of maintaining interdependent packages by allowing you to operate on them as a cohesive unit.

When you run "lerna publish" command, it initiates the process of publishing packages that have been changed since their last release. It follows a series of steps, such as:

  1. It identifies packages that have been modified by comparing the current Git commit state with the previous release.
  2. Lerna then analyzes the changes made to each modified package, determining the appropriate version bump (patch, minor, or major) based on conventional commits or a custom configuration.
  3. It prompts you to confirm the new version numbers for modified packages.
  4. It executes a "npm publish" command for each modified package, releasing them to the appropriate package registry.
  5. Finally, it commits the updated version numbers and tags the Git repository with the new release.

This command simplifies the release process for multiple packages within your monorepo, ensuring that all modified packages are published with the correct version numbers and tagged properly.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the lerna tool