Repository navigation
Improve default changelog new lines handling - #2118
Merged
Merged
Conversation
🦋 Changeset detectedLatest commit: 569b806 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2118 +/- ##
==========================================
+ Coverage 85.52% 85.57% +0.05%
==========================================
Files 66 66
Lines 2535 2544 +9
Branches 700 700
==========================================
+ Hits 2168 2177 +9
Misses 337 337
Partials 30 30 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Andarist
approved these changes
Jun 24, 2026
| newLines += startNewLinesCount; | ||
|
|
||
| // Ensure a minimum of one new line and maximum of two new lines between release lines | ||
| const newLinesContent = "\n".repeat(Math.min(Math.max(newLines, 1), 2)); |
Member
There was a problem hiding this comment.
Math.clamp - where are you when we need you?! 😢
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fixes #748
Uses a slightly sophisticated handling when joining release lines to ensure there's a minimum of one new line and maximum of two new lines between the release lines.
One new line means there's only one
\n, so there's no spacing in between. Two new lines is\n\nso there's a spacing in between.Also ensure that headings such as
### Major changesand## 1.0.0are followed with\n\n. This should look more proper to how most formatters format it.Context and thought process
I did this change in the
getChangelogEntryside instead of the changelog generator side (e.g.changelog-github), because it's possible that some generators prefer lines to be followed together or with spacing in between. For example:changelog-git:changelog-github:But at the same time, we limit to a maximum of 2 new lines in between (one spacing) because there's not a lot of reason in practice to want more than that. So
getChangelogEntryhas a little opinion on that, but in return generators don't need to think too deeply on how new lines would be combined in the changelog. Maybe we want to discuss this magic a bit.