Skip to content
Latchkey

What Is Lerna? The Monorepo Versioning Tool Explained

Lerna is a tool for managing JavaScript monorepos, best known for versioning and publishing many packages from a single repository in a coordinated way.

Lerna pioneered the JavaScript monorepo workflow. While newer tools focus on build caching, Lerna's enduring strength is release management: deciding which packages changed, bumping their versions, and publishing them to npm together, with support for both fixed and independent versioning.

What Lerna is

Lerna is a monorepo management tool for JavaScript and TypeScript. It works with workspaces to run commands across packages, detect which packages changed, and handle versioning and publishing. Modern Lerna integrates with Nx under the hood for task caching and graph awareness.

Versioning and publishing

Lerna supports two modes: fixed, where all packages share one version, and independent, where each package versions on its own. "lerna version" bumps versions and creates git tags based on what changed, and "lerna publish" pushes the updated packages to a registry. This coordinated release flow is its signature feature.

A usage example

Version changed packages, then publish them.

Common Lerna commands
# bump versions for changed packages and tag
npx lerna version

# publish the updated packages to npm
npx lerna publish from-git

Role in CI/CD

In CI/CD, Lerna typically runs in the release pipeline: after a merge, it determines changed packages, bumps versions, tags the release, and publishes to the registry, all in a coordinated step. Combined with its Nx-powered task running, it can also build and test only affected packages, keeping release pipelines efficient.

Alternatives

Changesets is a popular alternative focused purely on versioning and changelogs. Nx and Turborepo handle build caching but lean on tools like Changesets for releases. pnpm and Yarn workspaces provide the underlying multi-package structure. Lerna remains a solid choice for coordinated monorepo publishing.

Key takeaways

  • Lerna manages versioning and publishing across a JS/TS monorepo.
  • It supports fixed or independent versioning and coordinated releases.
  • In CI it powers the release step: version, tag, and publish changed packages.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →