Is Lerna needed anymore with NPM 7.0.0 workspaces?
I dont really have experience with this new npm feature.
Npm/rfcs writes regarding this:
First and foremost there’s the alternative of leaving the problem set for userland to solve, there’s already the very popular project Lerna that provides some of these features.
Also available is the alternative of supporting only the install (or bootstrap as Lerna names it) aspect of this proposal, following a less feature-rich approach but one that would still enable the basic goal of improving the user experience of managing multiple child packages but from all the feedback collected during the research phase of this RFC, this alternative is much less desirable to the community of maintainers involved.
Glad for every answer and explanation :)
Why Should Developers Use Lerna? Lerna makes things easier for developers by managing tasks like versioning, deployment of code, dependency management between projects, and much more. It is mostly used in bigger projects, where it becomes hard to maintain all these tasks manually over time.
Its goal was to enhance and make it scalable helping build, orchestrate, and publish your packages. Lerna has been officially killed recently.
Lerna is a popular and widely used tool written in JavaScript for setting and managing multi-package repositories for Node. js projects with npm and Git.
Lerna is a fast modern build system for managing and publishing multiple JavaScript/TypeScript packages from the same repository.
NPM 7 is out and it supports workspaces. they will also continue to develop this domain in the upcoming releases,
With that said, lerna
comes with many more high level features than npm7
or yarn
workspaces, furthermore, yarn
declared that they will never try to replace tools like lerna
, rather they intend to implement the core logic of handling workspaces like installing children packages dependencies and packages symlink. I expect npm
to do the same.
One great example is the command: lerna changed
which gives you the list of packages that have changed since the last tagged release, this could be extremely helpful for CI/CD. you are welcome to explore the extra commands provided by lerna.
The only command as of today supported by npm7
related to workspaces is actually npm i
/ npm ci
which is not new, but it does take care of nested packages and symlink.
I've written an article that goes deeper into the configuration in case you want to move to a monorepo with npm7, so working without lerna is definitely an option, you will probably need to do more work on the CI/CD side compared to lerna and add some dev scripts by your self that will affect the nested packages. Also IMO lerna fits more to develop libs rather than apps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With