Configure Lerna for a multi-package repo
Lerna manages versioning and publishing across many packages in one repository. The lerna.json file at the root decides how versions are bumped, which package manager runs installs, where packages live, and how publishing behaves. This builder writes a correct lerna.json for both fixed and independent release strategies.
How it works
The version field is the core choice. Set it to a literal version like 1.0.0 for fixed mode, where every package shares one number and bumps together. Set it to the string independent for independent mode, where Lerna versions each package separately based on what changed.
npmClient tells Lerna whether to shell out to npm, yarn, or pnpm. useWorkspaces: true makes Lerna inherit the package list from your package manager’s workspaces, while turning it off lets you list packages globs directly. The command object overrides behavior for version and publish: enabling conventionalCommits makes Lerna read commit messages to compute semver bumps and generate changelogs, and access controls whether published scoped packages are public or restricted.
Tips and notes
- Prefer
useWorkspaces: trueso your package list lives in one place. - Independent versioning is best for libraries that release on different schedules.
- Conventional commits remove guesswork:
featbumps minor,fixbumps patch. - Set
accesstopublicfor open-source scoped packages, or npm rejects the publish.