What's New With Lerna 6.5?
Tags: javascript, monorepos, lerna
Published: 2023-02-22 17:01:23


---
title: What's New With Lerna 6.5?
published: true
description: The latest Lerna news and features.
tags: javascript, monorepos, lerna
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f62oc8fqo4jy6hw9f9sn.png
canonical_url: https://blog.nrwl.io/whats-new-with-lerna-6-5-4a4f69371504
## Use a ratio of 100:42 for best results.
## published_at: 2023-01-26 06:26 +0000
---

In case you missed it, Lerna version 6.5 recently launched. We'll catch you up on the latest Lerna news and newest features.

{%embed https://www.youtube.com/watch?v=ASCSTKX21jE&ab_channel=Nx-Smart%2CFast%2CExtensible %}

### Table of Contents
+ [Lerna: Brought to You by Nx](#by-nx)
+ [Still On Lerna 4?](#still-on-lerna-4)
+ [Idempotency Added to the `lerna publish from-git` Command](#idempotency)
+ [`lerna run` Can Run Multiple Scripts In a Single Command](#lerna-run)
+ [New `--include-private` Option Added To `lerna publish`](#include-private)
+ [Massive Refactor](#refactor)
+ [Getting Started With Lerna From The Lerna Team](#livestream)
+ [The Future of Lerna](#future)



## Lerna: Brought to You by Nx <a name="by-nx"/>

In case you missed it, Lerna, the OG JavaScript monorepo tool, went largely unmaintained for a while, starting around 2020. Then, it officially declared itself to be unmaintained in April of 2022, only for Nx to step in to take over maintenance of the project in May of 2022!

You can find a more detailed account of Lerna's "Maintainance Odyssey" in [this article](https://blog.nrwl.io/lerna-is-dead-long-live-lerna-61259f97dbd9).

Since Nx took over in Lerna 4, we've added a brand new site to refresh the Lerna Docs:

[![https://lerna.js.org](https://hackmd.io/_uploads/HkbKxDjTj.png)](https://lerna.js.org/)

The top of our priorities for Lerna 5 was to resolve all vulnerabilities and outdated dependencies facing Lerna. We went on to make Lerna faster by allowing users to [opt into Nx's task caching inside of Lerna with the new `lerna add-caching` command](https://github.com/lerna/lerna/tree/main/packages/lerna/src/commands/add-caching#readme), and [add support for distributed caching to share task results amongst your organization in Lerna with Nx Cloud](https://lerna.js.org/docs/features/share-your-cache).

We were proud to go on to launch [Lerna 6](https://blog.nrwl.io/lerna-reborn-whats-new-in-v6-10aec6e9091c) last October, where we began focusing on further improving Lerna's feature set - focusing specifically on its unique strengths: versioning and publishing.

## Still on Lerna 4? <a name="still-on-lerna-4" />

[Here's how to upgrade to the latest and greatest](https://lerna.js.org/upgrade).

We've also started an initiative to assist Open Source projects in getting the most out of Lerna. Projects that use Lerna can now request free consulting to learn how to take advantage of Lerna's newest features.

We've just started this initiative and have already been able to help [Sentry](https://github.com/getsentry/sentry-javascript) get optimized with task caching and task pipeline optimizations for their workspace!

![Nx Cloud](https://hackmd.io/_uploads/B1jBEkfRo.png)

This initiative complements [our free tier of unlimited Nx Cloud](https://nx.app/pricing/#open-source) for any Open Source project.

If you're interested in optimizing your Open Source project to take advantage of the latest Lerna features, [reach out to us on Twitter!](https://twitter.com/lernajs)

Now let's jump into the newest Lerna 6.5  features!

## Idempotency Added to the `lerna publish from-git` Command <a name="idempotency" />

{%embed https://www.youtube.com/watch?v=kh4TaiKbC8c&ab_channel=Nx-Smart%2CFast%2CExtensible %}

"Idempotent" is a word used to describe an operation you can perform any number of times, and the resulting state is the same as if you had only run the operation once.

The [`lerna publish` command](https://github.com/lerna/lerna/tree/main/libs/commands/publish#readme) is a beneficial tool for quickly publishing multiple packages from your workspace:

+ Running `lerna publish` by itself will version and publish all packages in the workspace since your latest release
+ Running `lerna publish from-git` will publish all projects tagged in the latest commit
+ Running `lerna publish from-package` will publish all projects whose version does not yet exist in the target registry based on the version listed in their `package.json` file.

As we can see, `lerna publish from-package` is already idempotent (since it only publishes packages whose version doesn't exist, any run past the first will not adjust the state of the registry).

With 6.5, we've added the same idempotency to `lerna publish from-git`. This update is handy for recovering from a situation where some of your packages failed to publish initially (maybe due to a networking issue).

[For more information, check out the PR](https://github.com/lerna/lerna/pull/3513)

### `lerna run` Can Run Multiple Scripts In a Single Command <a name="lerna-run" />

For 6.5, we've added the ability to run multiple scripts in a single `lerna run` command! Checkout this quick video demonstrating this below:

{%embed https://www.youtube.com/watch?v=Ey73CEGcVKw&ab_channel=Nx-Smart%2CFast%2CExtensible %}

Learn more [here](https://github.com/lerna/lerna/pull/3527).

## New `--include-private` Option Added To `lerna publish` <a name="include-private" />

[Npm supports a `"private": true` configuration](https://docs.npmjs.com/cli/v9/configuring-npm/package-json#private) as a way of preventing the publication of a library that is private.

```bash
> lerna publish from-git --include-private my-private-package
```

Running `lerna publish` with this new [`--include-private`](https://github.com/lerna/lerna/tree/main/libs/commands/publish#--include-private) option (as above) will strip this `"private": true` configuration from the `package.json` of the packages listed in the command.

This new option is beneficial for the use case where you'd like to run e2e for a package that will eventually be public but is currently private to prevent getting published too soon.

{%embed https://www.youtube.com/watch?v=7TgjCk7Diks&ab_channel=Nx-Smart%2CFast%2CExtensible %}

You can find more information on this change [here]((https://github.com/lerna/lerna/pull/3503).

## Massive Refactor <a name="refactor" />

Unlike the other updates mentioned for 6.5, this update does not affect Lerna's public API, but as you can see from the numbers, this was quite an undertaking: 

![1,875 files changed](https://hackmd.io/_uploads/S1p7-q_ao.png)
![+62,345 lines, -69,303 lines](https://hackmd.io/_uploads/HJ8Nb5_Tj.png)

The result is a significant improvement to the Typescript support for Lerna's internals and a substantial simplification of the codebase. This investment will make Lerna significantly more approachable to other would-be contributors!

Find more on this change [here](https://github.com/lerna/lerna/pull/3517).

## Getting Started With Lerna From The Lerna Team <a name="livestream" />

We recently ran a live stream with [James Henry](https://twitter.com/MrJamesHenry) and [Austin Fahsl](https://twitter.com/AustinFahsl) from our Lerna team to show how to get started with Lerna, all the way through to versioning and publishing our packages to npm!

{%youtube HqPOoU35xzA %}

Check out the recap of this session above, and check out [the repo from our session on GitHub](https://github.com/ZackDeRose/for-the-lulz).

## The Future of Lerna <a name="future">

Looking to the future, we are targeting Q2 of 2023 for Lerna v7 (including a `--dry-run` option for both `lerna version` and `lerna publish` commands - you can catch a sneak-peak of this in James' talk from Nx Conf 2022 below!)

{%youtube CNdDv2MsBuw %}

You can find [a roadmap for all the features we plan to add in Lerna 7](https://github.com/lerna/lerna/discussions/3410) on Github!

## Lerna More!

+ [🧠 Lerna Docs](https://lerna.js.org/)
+ [👩‍💻 Lerna GitHub](https://github.com/lerna/lerna)
+ [💬 Nrwl Community Slack (join the #lerna channel)](https://go.nrwl.io/join-slack)
+ [📹 Nrwl Youtube Channel](https://www.youtube.com/nrwl_io)
+ [🧐 Need help with Angular, React, Monorepos, Lerna, or Nx? Talk to us!](https://nrwl.io/contact-us)

If you liked this, click the 👏 and make sure to follow [Lerna](https://twitter.com/lernajs) and [Zack](https://twitter.com/ZackDeRose) on Twitter for more!