fix(changelog): write CHANGELOG.md and backfill the history - #12
Merged
Conversation
release-it generated a changelog for every release body and then dropped it: the conventional-changelog plugin had no `infile`, so nine releases went out and the repo still has no CHANGELOG.md. Adds the infile, backfills the file from git, and moves the config out of package.json so the type list has one home. The preset renders what can reach the tarball. `files` publishes `src` and `lib` side by side, so `build`, `refactor`, `chore` and `docs` all change what a consumer installs and now show up; `ci`, `style` and `test` cannot and stay hidden. The four new ones are `effect: "changelog"`, so they render without entering the bump count and a pile of `build:` commits is still a patch. The backfill follows the commits, not the release bodies. 0.2.2 and 0.3.1 each shipped a `feat!:` and each published empty notes; those breaking changes are in the file now. No tag was moved, and 0.4.0 and 1.0.0 keep a pointer to their hand-written upgrade guides. The annotated tag gets the same section as the changelog and the GitHub release. git's default tag cleanup was eating every `#` heading out of it, so `tagArgs` pins `--cleanup=verbatim`. tools/changelog-check.mjs states the policy longhand and asserts the type list and the rendered output both match it, so hiding a section fails instead of quietly redefining what was expected. It also checks the bump: feat! is a major, feat a minor, fix a patch, and build/refactor/chore/docs together are no release at all. Three of its twelve synthetic commits are breaking, including a `ci!:` whose note has to surface off a hidden type. Wired into Branch Checkup.
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.
This repo has shipped 9 releases and has no CHANGELOG.md. release-it's conventional-changelog plugin had no
infile, so it generated a changelog for each release body and threw it away. Two of those bodies came out empty while the range under them contained a breaking change.Infile
infile: "CHANGELOG.md"plus a backfill of the 9 existing releases, generated from the commits. The plugin prepends, so once the file exists the history below the newest section is never rewritten.The config moves from the
release-itkey in package.json to.release-it.mjs, because the type list now lives intools/changelog-preset.mjsand JSON can't import it.tools/changelog-check.mjsreads the same list.Sections
filespublishessrcandlibside by side, so the split is whether a type can change what npm hands a consumer:lib/src/andlib/, both published.github/is not infilessrc/, whitespace only!**/__tests__is excluded fromfilesThe four new ones are
effect: "changelog". They render without entering the bump count, so a release of nothing butbuild:commits is still a patch. Onlyfeat,fix,perfandrevertcan raise a version.Backfill
Where the git history and a published release body disagree, the file follows the history.
0.2.2 and 0.3.1 each shipped a
feat!:and each published a body with no sections at all. 0.2.2 went out as a patch off a breaking change. Both now carry their⚠ BREAKING CHANGESheading. No tag was moved and no release body was edited.0.4.0 and 1.0.0 were written by hand and say more than the commits do (the peer version table, the new-architecture steps, the return-value change on
magicToast.show()). Their generated sections carry a link to the release notes.Check
pnpm run changelog:checkbuilds a throwaway repo with 12 commits, one per type, 3 of them breaking, renders it through the real preset and asserts on what comes back.ciis hidden and theci!:commit's breaking note still has to surface.The check carries its own copy of the policy, so the two disagreeing is a failure. Derived from the preset, every assertion would be a tautology: hide a section and the check quietly redefines what it expected. The negative control in the image is what that failure looks like.
The bump is asserted too:
feat!major,featminor,fixpatch, and build/refactor/chore/docs together no release at all.Wired into Branch Checkup as
extra-command.Release
npm
latestis 1.0.0 and the 16 commits since the tag are tooling. Verified by rehearsing on a throwaway clone with publish, push and the GitHub release all off: 1.0.0 -> 1.0.1, the new section prepends, andgit diffshows zero lines removed from everything below it.The annotated tag now carries the same section as the changelog and the release body. git's default tag cleanup strips every line starting with
#. That was eating all the headings.tagArgspins--cleanup=verbatim.