Skip to content

Commit

Permalink
fix(conventional-commits): Avoid duplicate root changelog entries wit…
Browse files Browse the repository at this point in the history
…h custom `--tag-version-prefix`

Fixes #2197
  • Loading branch information
evocateur committed Jul 24, 2019
1 parent effa054 commit 8adeac1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Expand Up @@ -385,7 +385,7 @@ describe("conventional-commits", () => {
* A second commit for our CHANGELOG ([SHA](https://github.com/lerna/conventional-commits-fixed/commit/SHA))
`);
expect(rootChangelog.newEntry.trimRight()).toMatchInlineSnapshot(`
## 1.0.1 (YYYY-MM-DD)
## [1.0.1](/compare/dragons-are-awesome1.0.0...1.0.1) (YYYY-MM-DD)
### Bug Fixes
Expand All @@ -409,12 +409,11 @@ describe("conventional-commits", () => {

// second commit should not show up again
expect(lastRootChangelog.newEntry.trimRight()).toMatchInlineSnapshot(`
## 1.0.2 (YYYY-MM-DD)
## [1.0.2](/compare/dragons-are-awesome1.0.1...1.0.2) (YYYY-MM-DD)
### Bug Fixes
* A second commit for our CHANGELOG ([SHA](https://github.com/lerna/conventional-commits-fixed/commit/SHA))
* A third commit for our CHANGELOG ([SHA](https://github.com/lerna/conventional-commits-fixed/commit/SHA))
`);
});
Expand Down
3 changes: 3 additions & 0 deletions core/conventional-commits/lib/update-changelog.js
Expand Up @@ -32,6 +32,9 @@ function updateChangelog(pkg, type, { changelogPreset, rootPath, tagPrefix, vers

if (type === "root") {
context = { version };

// root changelogs are only enabled in fixed mode, and need the proper tag prefix
options.tagPrefix = tagPrefix;
} else {
// "fixed" or "independent"
gitRawCommitsOpts.path = pkg.location;
Expand Down

0 comments on commit 8adeac1

Please sign in to comment.