What is @lerna/cli?
@lerna/cli is a tool for managing JavaScript projects with multiple packages. It optimizes the workflow around managing multi-package repositories with features like versioning, publishing, and dependency management.
What are @lerna/cli's main functionalities?
Bootstrap
Installs all dependencies and links any cross-dependencies between packages in the repo. This is useful for setting up a monorepo with multiple interdependent packages.
lerna bootstrap
Publish
Publishes packages in the monorepo to the npm registry. It handles versioning and tagging of the packages, making it easier to release new versions.
lerna publish
Run
Runs an npm script in each package that contains that script. This is useful for running tests, builds, or other scripts across all packages in the monorepo.
lerna run <script>
Version
Bumps the version of packages in the monorepo. It updates the version in package.json files and creates a git commit and tag for the new version.
lerna version
Add
Adds a dependency to matched packages. This is useful for adding new dependencies to specific packages within the monorepo.
lerna add <package> [--scope]
Other packages similar to @lerna/cli
nx
Nx is a smart, fast, and extensible build system with first-class monorepo support and powerful integrations. It offers more advanced features like distributed caching and task orchestration compared to Lerna.
rush
Rush is a scalable monorepo manager for the web, developed by Microsoft. It focuses on large-scale monorepos and offers features like incremental builds and a strong emphasis on consistent dependency management.
yarn
Yarn is a package manager that also supports monorepos through its workspaces feature. It is known for its speed and reliability, and it integrates well with other tools in the JavaScript ecosystem.
pnpm
pnpm is a fast, disk space-efficient package manager. It supports monorepos through its workspaces feature and is known for its efficient handling of node_modules, which can save disk space and improve performance.
@lerna/cli
Lerna's CLI
Usage
You probably shouldn't, at least directly.
Install lerna for access to the lerna
CLI.
4.0.0 (2021-02-10)
Bug Fixes
- version: Ensure --create-release environment variables are present during initialization (2d0a97a)
- Improve accuracy of JSDoc type annotations (1ec69f0)
- create: Use main as default Github branch (1a951e9)
- import: Better handling of "Patch is empty" (#2588) (0497bc7)
Code Refactoring
- describe-ref: Add JSDoc types, remove test-only export (e5cf30c)
- package: Move Package.lazy() to static method (e52108e)
Features
- child-process: Add JSDoc types (1840492)
- collect-uncommitted: Remove figgy-pudding (621b382)
- collect-updates: Add JSDoc type annotations to primary export (a4e7c78)
- conventional-commits: Add JSDoc types to named exports (81a591c)
- deps: @evocateur/libnpmaccess -> libnpmaccess@^4.0.1 (7974b35)
- deps: @evocateur/libnpmpublish -> libnpmpublish@^4.0.0 (341146e)
- deps: @evocateur/npm-registry-fetch -> npm-registry-fetch@^9.0.0 (6df42f2)
- deps: @evocateur/pacote -> pacote@^11.1.13 (99b4217)
- deps: @octokit/rest@^18.0.9 (f064a55)
- deps: @zkochan/cmd-shim -> cmd-shim@^4.0.2 (179e2c3)
- deps: Bump dependencies (affed1c)
- deps: byte-size@^7.0.0 (a1b2555)
- deps: camelcase -> yargs-parser/camelCase (d966e8b)
- deps: chalk@^4.1.0 (d2a9ed5)
- deps: conventional-changelog-core@^4.2.1 (54e2b98)
- deps: conventional-recommended-bump@^6.0.11 (4ff481c)
- deps: cosmiconfig@^7.0.0 (2958fe6)
- deps: dot-prop@^6.0.0 (5f31d3b)
- deps: execa@^4.1.0 (9051dca)
- deps: execa@^5.0.0 (d8100fd)
- deps: fs-extra@^9.0.1 (2f6f4e0)
- deps: get-port@^5.1.1 (b1b2275)
- deps: get-stream@^6.0.0 (ddf2ab5)
- deps: globby@^11.0.1 (6cb5bbe)
- deps: import-local@^3.0.2 (e0e74d4)
- deps: init-package-json@^2.0.1 (4042e8e)
- deps: inquirer@^7.3.3 (0b37795)
- deps: load-json-file@^6.2.0 (239f54b)
- deps: multimatch@^5.0.0 (0172526)
- deps: npm-package-arg@^8.1.0 (12c8923)
- deps: npm-packlist@^2.1.4 (c63fabd)
- deps: p-finally -> Promise.prototype.finally() (028db04)
- deps: p-finally@^2.0.1 (165e47e)
- deps: p-map-series@^2.1.0 (7f68076)
- deps: p-map@^4.0.0 (92b1364)
- deps: p-pipe@^3.1.0 (489f59e)
- deps: p-queue@^6.6.2 (ed76cdd)
- deps: p-reduce@^2.1.0 (fd4289a)
- deps: p-waterfall@^2.1.0 (7b7ea50)
- deps: path-exists@^4.0.0 (3fb6304)
- deps: pify@^5.0.0 (6b34452)
- deps: read-cmd-shim@^2.0.0 (9f78eee)
- deps: read-package-json@^3.0.0 (2a02865)
- deps: read-package-tree@^5.3.1 (3311780)
- deps: resolve-from@^5.0.0 (d414462)
- deps: rimraf@^3.0.2 (cda2e18)
- deps: semver@^7.3.2 (003ad66)
- deps: slash@^3.0.0 (5dec383)
- deps: ssri@^8.0.0 (41729b4)
- deps: tar@^6.0.5 (fce3e77)
- deps: temp-write@^4.0.0 (7bbfb70)
- deps: upath@^2.0.1 (28ecc48)
- deps: whatwg-url@^8.4.0 (5dfb7f0)
- deps: write-file-atomic@^3.0.3 (61f341b)
- deps: write-json-file@^4.3.0 (d552c53)
- deps: write-pkg@^4.0.0 (34db21c)
- deps: yargs@^16.1.1 (53d432b)
- filter-options: Remove figgy-pudding (7d90289)
- has-npm-version: Remove unused makePredicate() export (56cba2f)
- npm-dist-tag: Remove figgy-pudding (1158f8e)
- npm-publish: Remove figgy-pudding (bdc162d)
- otplease: Remove figgy-pudding (45ee52e)
- pack-directory: Remove figgy-pudding (640faa5)
- package: Improve JSDoc-inferred types, encapsulation (4d80c38)
- package-graph: Improve JSDoc-inferred types, encapsulation (fae9e8d)
- prerelease-id-from-version: Add JSDoc types (53cdad9)
- profiler: Remove figgy-pudding (69d4704)
- project: Add JSDoc type annotations to primary export (8443ad3)
- prompt: Add JSDoc types (0406568)
- prompt: Add unambiguous exports (46fa111)
- prompt: Remove ambiguous exports (42ab453)
- Consume named exports of sibling modules (63499e3)
- Expose named export (c1303f1)
- Remove default export (e2f1ec3)
- publish: Remove figgy-pudding (caf823e)
- query-graph: Remove figgy-pudding (3b0e2fe)
- run-lifecycle: Remove figgy-pudding (1093f87)
- run-topologically: Remove figgy-pudding (f3a73db)
- Drop support for Node v6.x & v8.x (ff4bb4d)
BREAKING CHANGES
- prompt: The ambiguous 'confirm', 'select', and 'input' exports have been removed. Please use the renamed exports 'promptConfirmation', 'promptSelectOne', and 'promptTextInput' (respectively).
- has-npm-version: The makePredicate() export has been removed, memoization is now the responsibility of the caller.
- The default export has been removed, please use a named export instead.
- describe-ref: The test-only 'parse()' export has been removed.
- package: The
lazy
named export is now a proper static method of Package
. - Node v6.x & v8.x are no longer supported. Please upgrade to the latest LTS release.
Here's the gnarly one-liner I used to make these changes:
npx lerna exec --concurrency 1 --stream -- 'json -I -f package.json -e '"'"'this.engines=this.engines||{};this.engines.node=">= 10.18.0"'"'"
(requires npm i -g json
beforehand)