#2143·lerna

Promoting an unchanged pre-release doesn't work

Author: SamVerschuerenCreated Jun 18, 2019Updated Mar 13, 2026
Labelstype: bug

Expected Behavior

I'm using pre-release versions to test things out before releasing the real deal. Between a pre-release and the regular release, I don't have any extra changes. So when I run lerna version, I'd expect to be able to re-release my prereleased packages but then with the release tag instead.

Current Behavior

The docs of @lerna/version describe the following

If you have any packages with a prerelease version number (e.g. 2.0.0-beta.3) and you run lerna version with and a non-prerelease bump (major, minor, or patch), it will publish those previously pre-released packages as well as the packages that have changed since the last release.

So it looks like running lerna version patch or something, should do the trick. But instead, it returns with the following message

Current HEAD is already released, skipping change detection.

Possible Solution

It would be nice if lerna could filter out the prereleased packages when detecting the changes.

lerna.json

json
{
  "packages": [
    "packages/*",
    "services/*"
  ],
  "version": "independent",
  "command": {
    "version": {
      "allowBranch": ["master", "staging"]
    }
  }
}

Context

In our setup we have a development, staging and master branch. Every PR gets merged into development which deploys our code in a development environment. When the feature is done it is merged to staging and versioned with as pre-release, the code is then deployed to a staging/test environment. When everything works as expected, we merge things to master, version the packages as release and it gets pushed to production.

We are looking at Lerna for our monorepo setup and see if we can manage our releases like I described above.

Your Environment

Executable Version
lerna --version 3.15.0
npm --version 6.8.0
node --version 10.15.1
OS Version
macOS High Sierra 10.13.6