Changelog Generation
How Relizy writes the CHANGELOG.md files from the Conventional Commits - format, sections, breaking changes, commit bodies, contributors, files written per version mode and range of commits.
When It Is Written
relizy release writes the changelogs after the bump (see its steps), and relizy changelog writes them alone, without bump nor commit (see relizy changelog). --no-changelog skips the step of a release.
Each release adds a section at the top of the CHANGELOG.md of the package, under its # title (created when the file does not exist).
Format
## v1.1.0...v1.2.0
[compare changes](https://github.com/acme/my-lib/compare/v1.1.0...v1.2.0)
### 🚀 Enhancements
- **auth:** Add OAuth2 login ([a1b2c3d](https://github.com/acme/my-lib/commit/a1b2c3d))
- ⚠️ Drop the `legacy` option ([e4f5a6b](https://github.com/acme/my-lib/commit/e4f5a6b))
BREAKING CHANGE: use `modern` instead.
### 🩹 Fixes
- Resolve the memory leak of the event handlers ([#42](https://github.com/acme/my-lib/pull/42))
#### ⚠️ Breaking Changes
- ⚠️ Drop the `legacy` option ([e4f5a6b](https://github.com/acme/my-lib/commit/e4f5a6b))
BREAKING CHANGE: use `modern` instead.
### ❤️ Contributors
- Jane Doe ([@jane](https://github.com/jane))- Title: the previous and the new tag,
v0.0.0for a first release. Change it withtemplates.changelogTitle({{oldVersion}},{{newVersion}},{{date}}). - Compare link: to the compare page of GitHub, GitLab or Bitbucket, when the repository is known (set with
repo, else read from therepositoryfield of the closestpackage.json, else from theoriginremote). - Sections: one per commit type, in the order of
types, with the titles of the default types. A type withoutsemver(chore,test,ci...) is listed without bumping, a type set tofalseis left out. Thechore(release)commits are left out, and thechore(deps)ones unlessincludeDepsCommits, except the breaking ones. - Scope: shown in bold before the description.
- References: the pull requests and issues of the commit message (
#42), or else the commit hash, linked when the repository is known. - Breaking changes: a commit with
!or aBREAKING CHANGE:footer is prefixed with⚠️, and listed again, with its body, under#### ⚠️ Breaking Changes. - Contributors: see Contributors.
A release without relevant commit gets the text of templates.emptyChangelogContent (No relevant changes for this release).
Commit Bodies
With changelog.includeCommitBody (true by default), the body of each commit is shown under its line, indented. The git trailers are removed (Co-authored-by:, Signed-off-by:, Closes #12, the --- line GitHub adds before them in a squash merge) and so are the lines crediting an AI tool; a BREAKING CHANGE: footer is kept, as it tells how to migrate.
Write the body for the users of the package: it ends up in the changelog and in the provider release.
Contributors
The section lists the authors of the commits and their co-authors (Co-authored-by: trailers), so the contributors of a squash-merged pull request are credited. With a GitHub repository, each name is linked to its GitHub profile when it is found.
- the bots (a name containing
[bot]) and the AI tools are never listed; excludeAuthorsremoves more names from the list (a part of the name or of the email): it does not remove their commits from the changelog;noAuthors: trueremoves the section,hideAuthorEmail: truethe emails.
Files Written
| Mode | Package changelogs | Root CHANGELOG.md |
|---|---|---|
| Standalone | - | The changelog of the package |
unified / selective | One per released package, its own commits | The commits of the released packages, and the ones outside every package (CI, lockfile) |
independent | One per released package, its own commits | The sections of the released packages, under **Multiple Packages Updated** - <date> |
changelog.rootChangelog: false (or --no-root-changelog) skips the root CHANGELOG.md of a monorepo. With version groups, each group writes its changelogs, and changelog.rootChangelog: false on a group keeps it out of the root one.
The formatter of the project (Biome, Prettier, oxfmt, dprint or ESLint, from the root package.json) formats the changelogs written. Choose the command with changelog.formatCmd (or --format-cmd), {{files}} replaced by their paths, e.g. eslint --fix {{files}}, or turn it off with false.
Range of Commits
A changelog goes from the tag of the previous release to HEAD. The previous release is resolved from the versions, not from the creation date of the tags:
- In standalone,
unifiedandselectivemode, the release tags followtemplates.tagBody(v{{newVersion}}by default), plus thev1.2.3and1.2.3formats. The[email protected]tags of packages released independently in the same repository are never used. - In
independentmode, the release tags of a package are its[email protected]tags. - The previous release is the highest version strictly below the version released, and not above its major: a hotfix of an older version or a prerelease of the next one, tagged later on another branch, is never picked instead.
- A stable release starts at the previous stable release: a graduation from
2.0.0-beta.3to2.0.0starts atv1.x, not at the last beta.
Changing the tag template
After changing templates.tagBody, the v1.2.3 tags are still recognized. If the previous tags followed another custom template, Relizy warns about it: pass the tag of the previous release with --from for the first release with the new template.
Set the range by hand with --from and --to (a tag, a commit or a branch):
relizy changelog --from v1.0.0 --to v1.2.0A tag orphaned by a rebase gives a wrong range: see Rewritten Tags & Rebases. A package moved to another directory keeps its commits: see Moving & Renaming Packages.
Writing Good Entries
- One change per commit, with a description written for the users:
fix(auth): refresh the token before it expires, notfix: stuff. - The scope groups the entries of a package or a feature.
- A breaking change explains the migration in its
BREAKING CHANGE:footer. relizy commitlintchecks the messages and shows the changelog entry of a commit, see Commitlint.
To rewrite the release notes of the provider releases and of the social posts with AI, see AI Changelog.