question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

CHANGELOGS not generated correctly when using "--conventional-graduate"

See original GitHub issue

Expected Behavior

When versioning and publishing a prerelease version we do not want to generate the CHANGELOGS. This is done successfully with the “–no-changelog” for DTA environments.

But when we do “–conventional-graduate” for the production release to remove the “preid”, we want to generate a CHANGELOG for the production version. This is what we expect in the CHANGELOG for production.

## [0.0.7](git-tags) (2019-09-02)

### Bug Fixes

- commit 1
- commit 2

Current Behavior

This is what we are currently seeing in the CHANGELOG for production.

## [0.0.7](git-tags) (2019-09-02)

**Note:** Version bump only for package @package

Possible Solution

It probably has something to do with the git-tags for the prerelease versions that are already “released” with their changes. That is why the production publish does not see the changes anymore.

Steps to Reproduce (for bugs)

For prerelease:

  1. lerna version --conventional-prerelease --no-changelog
  2. lerna publish

Then for production:

  1. lerna version --conventional-graduate
  2. lerna publish
lerna.json

{
  "packages": ["packages/*"],
  "version": "independent",
  "command": {
    "publish": {
      "conventionalCommits": true,
      "ignoreChanges": ["**/*.md"],
      "yes": true
    },
    "version": {
      "conventionalCommits": true,
      "ignoreChanges": ["**/*.md"]
    }
  },
}

Context

Your Environment

Executable Version
lerna --version 3.16.4
npm --version 10
node --version 6

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:9
  • Comments:6

github_iconTop GitHub Comments

5reactions
kelvincycommented, Sep 4, 2019

Hey @thuringia, I tried with the commit messages fix and feat. Both of them will not generate CHANGELOGs when performing lerna version --conventional-graduate on production.

We have found a fix for this. Not sure if this is a preferred way, but it is currently working for us:

Prereleases:

  1. lerna version --conventional-prerelease --preid dev --no-changelog
  2. git tag -d $(git describe --abbrev=0) (This will remove the git tags from the commit so that lerna does not think it is released already)
  3. git push
  4. lerna publish from-package

Production:

  1. lerna version --conventional-graduate
  2. lerna publish from-git
0reactions
morewrycommented, Oct 20, 2021

I found that for 4.0.0, --no-git-tag-version skips all git interactions. No tag, no commit, no push. (--no-push appears superfluous and --push doesn’t change anything about the behavior.)

Using it prevents use of lerna publish from-git with the message:

lerna notice from-git No tagged release found

One has to add steps to make a commit and then lerna publish from-package or it fails with the message:

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

(This is in the above build script, but now it’s in plain text.)

Read more comments on GitHub >

github_iconTop Results From Across the Web

@lerna/version - npm
When using conventional-commits , do not generate any CHANGELOG.md files. NOTE: When using this option, you cannot pass --create-release . --no- ...
Read more >
Monorepo using Lerna, Conventional commits, and Github ...
We will create a monorepo that will contain two projects (packages). After making changes to any of the projects we will commit them...
Read more >
JS monorepos in prod 3: commit enforcement and changelog ...
We need to enforce good practices and not let invalid commits be created and pushed. commitlint validates messages based on Conventional Commits ...
Read more >
lerna conventional versioning with github actions
1-beta.0 while main is 1.0.1). There's also difference in the CHANGELOG.md content when graduating a beta version. This behavior ...
Read more >
@lerna/publish | Yarn - Package Manager
Now: lerna publish when there are no updates is a no-op, exiting successfully with a helpful log message; lerna updated when there are...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found