lerna / lerna/lerna

CHANGELOG genetared with all commits from the last release

Open
#2,991 2 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

type: bug
Dominant language
TypeScript
Stars
36.1k
Forks
2.3k
Avg merge
1d 4h
Merged PRs (30d)
50

Description

Hello,
I'm using lerna to automatically generate the CHANGELOG for my monorepo app, but when I'm making a new release it generates the whole CHANGELOG with all the commits from the last release, so this commits are printed twice.

How can I do the release without duplicating the previous commits.

Expected Behavior

When I use lerna version the CHANGELOG should only have the new commits and ignore the commits that are in the previuos release:

Make a new release
1.1.0 (2021-09-08)
Features
commit 1: New funcionality 
commit 2: Update an endpoint

1.0.0 (2021-06-24)

Features
commit 1: Create the project 
commit 2: Create an endpoint

Current Behavior

When I try to do a new release, the CHANGELOG always have all the commits from the old release. Never show me the new commits that belong to the new release.

Make a new release
1.1.0 (2021-09-08)
Features
commit 1: Create the project 
commit 2: Create an endpoint

1.0.0 (2021-06-24)

Features
commit 1: Create the project 
commit 2: Create an endpoint
lerna.json

{
  "npmClient": "yarn",
  "useWorkspaces": true,
  "packages": ["backend/*", "libraries/*", "frontend", "mobile/*"],
  "version": "independent",
  "command": {
    "version": {
      "allowBranch": ["release/*", "hotfix/*"],
      "changelog": true,
      "changelogPreset": {
        "name": "conventionalcommits",
        "commitUrlFormat": "{{host}}/{{owner}}/{{repository}}/commits/{{hash}}",
        "compareUrlFormat": "{{host}}/{{owner}}/{{repository}}/compare/{{currentTag}}%0D{{previousTag}}"
      },
      "conventionalCommits": true,
      "includeMergedTags": true,
      "message": "chore: release",
      "push": false
    }
  }
}

lerna-debug.log

Context

For the first release we want that the tag was started with the version 1.0.0 so we run the command lerna version 1.0.0 and all our packages have that version. The tags generated automatically for the second release are fine, the problem is the changelog that repeats all the commits again.

Your Environment

Executable Version
lerna --version 3.22.1
npm --version 6.14.8
yarn --version 1.21.1
node --version 12.19.0

| Ubuntu | 20.04 |

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the release settings in lerna.json, especially command.version, changelogPreset, conventionalCommits, and includeMergedTags. Reproduce the reported lerna version flow using the supplied environment details, then trace changelog generation until the previous release boundary is identified; done means the generated 1.1.0 section contains only commits after 1.0.0.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
release, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.