Lerna
Lerna is an open-source build tool for managing JavaScript and TypeScript monorepos, coordinating versioning, dependency linking, and publishing across multiple packages in a single repository.
Definition
Lerna is an open-source build tool for managing JavaScript and TypeScript monorepos, coordinating versioning, dependency linking, and publishing across multiple packages in a single repository.
Overview
Lerna was originally created to help manage Babel's monorepo, which contained dozens of interdependent packages that needed to be versioned and published together. It became one of the earliest popular tools for monorepo management in the JavaScript ecosystem and is now maintained under the Nx organization. It works by scanning a repository for packages (commonly under a packages/ directory) and providing commands to bootstrap dependencies, run scripts across every package, and publish new versions—either independently per package or in lockstep with one shared version number. Many teams now pair Lerna with faster task runners like Turborepo for build caching, while still relying on Lerna specifically for its versioning and npm publish workflow. Lerna is most useful for open-source projects and internal platforms that ship many small, interrelated packages—such as a component library alongside its documentation site—where keeping versions and cross-package dependencies in sync by hand would be error-prone. It's commonly used alongside Yarn or npm workspaces, and teams managing CI pipelines for monorepos often pair it with GitHub Actions or Jenkins to automate the publish step.
Key Features
- Automatic version bumping and changelog generation across packages
- Independent or fixed/lockstep versioning modes
- Dependency graph awareness so only changed packages are rebuilt or republished
- Bootstrapping that links local packages together during development
- Integration with npm/Yarn workspaces for dependency hoisting
- Scripts to run a command across every package in the monorepo