npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

semantic-release-lerna

v2.9.0

Published

semantic-release plugin to publish lerna monorepo packages to npm

Downloads

2,494

Readme

semantic-release-lerna

semantic-release plugin to publish lerna managed npm packages to npm.

This is WORK-IN-PROGRESS so there will most likely be bugs and it as only really been tested under the narrow use-cases I myself need it for.

It is intended to be a drop-in replacement of the @semantic-release/npm plugin.

The plugin works in the following way:

  • You manage a monorepo using lerna.
  • You use semantic-release to automate release handling.
  • The plugin will use lerna to check which packages has been updated.
  • Package versions are latched (default latching minor and greater), i.e. patches are only published for changed packages but minor and major bumps for all packages. Use latch option to configure this.
  • Changelog is generated in the project root by semantic-release.

As of now the following features from @semantic-release/npm is not supported/implemented:

  • addChannel.
  • tarball.
  • Only rudimentary support for configuration options.
  • Only rudimentary support for authentication verification.
  • Only rudimentary support for private packages.

| Step | Description | | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | generateNotes | If the plugin option generateNotes is true this plugin generate release notes with the commit scope set to a list of affected packages (unless otherwise specificed by the commit message). This option replaces @semantic-release/release-notes-generator, do not use both at the same time. | | prepare | Update the package.json version and create the npm package tarball. | | publish | Publish the npm package to the registry. |

Dependencies

If a package version is bumped all the packages depending (dependencies, devDependencies and peerDependencies) on it will also have the range updated if the range has one of the following formats:

  • 1.2.3
  • ^1.2.3
  • ^1.2
  • ^1

Install

$ npm install semantic-release-lerna -D

Usage

The plugin can be configured in the semantic-release configuration file:

{
  "plugins": [
    "@semantic-release/commit-analyzer",
    ["semantic-release-lerna", { "generateNotes": true }],
    "@semantic-release/changelog",
    [
      "@semantic-release/git",
      {
        "assets": [
          "CHANGELOG.md",
          "lerna.json",
          "package.json",
          "package-lock.json",
          "packages/*/package.json",
          "packages/*/package-lock.json"
        ]
      }
    ]
  ]
}

Options

| Option | Description | Default | | --------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------- | | generateNotes | Set to true to enable generating release notes. See generateNotes step for more details. | false | | npmVerifyAuth | Set to false to disable verifying NPM registry credentials. | true | | latch | Latches package versions together. If the version bump is at least the given version all packages will be bumped regardless if the package has been touched or not. "major", "minor", "patch", "prerelease", "none" | "minor" | | rootVersion | Allow to update version on root package.json. | true |

Troubleshooting

Working tree has uncommitted changes

lerna ERR! EUNCOMMIT Working tree has uncommitted changes, please commit or remove the following changes before continuing:

Configure @semantic-release/git to commit lerna.json and package.json from the package folders. See example configuration above.

Error: Cannot modify immutable object

The conventional changelog packages have mismatching versions. This plugin supports both conventional-changelog-writer v7 and v8 as long as the preset has a matching version.

Assuming you use conventional-changelog-conventionalcommits as preset you can verify this with:

npm ls conventional-changelog-writer conventional-changelog-commits

If the major version of the packages differs you need to explicitly install the correct versions:

npm install conventional-changelog-writer@8 conventional-changelog-commits@8

Substitute @8 with @7 if you need to stay on v7. Usually you can get away with removing the packages from package.json afterwards as long as the lockfile (e.g. package-lock.json) still retains the requested versions of the packages.

If you do not have a configured preset conventional-changelog-angular is used by default, same rule applies, the major version has to be the same.

Also note that semantic-release v24 requires v8 of thte conventional changelog packages.