CodeVetter · Repo Unpack · System map
lerna/lerna
The product runtime is a Node CLI assembled from command libraries and shared core utilities. Nx supplies project graphs and the default task runner, while Lerna owns package metadata and release coordination. Persistent state consists primarily of workspace files, Git state, and registry artifacts. The npm package and documentation website have separate build and deployment paths.
- The published lerna package is ESM, exposes dist/cli.js as its binary, and exports the main API, command modules, selected helpers, migrations, and utilities.
- cli.ts first delegates through importLocal; otherwise it requires index.js and passes process.argv.slice(2) to main.
- main explicitly registers 15 command modules; shared CLI setup uses strict yargs parsing, requires a command, and maps failures to nonzero exit codes.
- Most command implementations resolve through @lerna aliases into libs/commands; published run wrappers re-export that implementation rather than duplicate it.
- Command orchestrates Project initialization, environment/options/properties setup, validation, graph detection, preparations, and subclass execution; composed publish/version calls can reuse graph data.
- Project owns root configuration and Package owns mutable manifests; serialization writes lerna configuration and package.json files rather than a database.
- Nx/esbuild compiles the published package for Node as split ESM with explicit additional entrypoints; root scripts route tests, lint, and integration through Nx.
- The website uses Docusaurus and React, deploys to the lerna/website repository, and has a PR build check; npm releases use a separately dispatched workflow with an npm-production environment.