Add template option to changelog-github - #2059
Conversation
🦋 Changeset detectedLatest commit: 15d2c2d The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 #2059 +/- ##
==========================================
+ Coverage 86.04% 86.18% +0.14%
==========================================
Files 70 71 +1
Lines 2558 2585 +27
Branches 692 703 +11
==========================================
+ Hits 2201 2228 +27
Misses 330 330
Partials 27 27 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
It would be great to see this merged. I'd love to do less manual updating of my changelog entries for every release. |
bluwy
left a comment
There was a problem hiding this comment.
I prefer if we mark or document the template option as experimental, and recommend pinning the version if used.
Right now there's things like:
- If replacements like
{authors}is empty, is going to leave an awkwardThanks !rendered text. Similarly it doesn't handle conditional parenthesis and spaces. {ref}has builtin parenthesis right now so it's easier to be compatible with-compact. I don't think it should have parenthesis builtin but we can leave it as is for now if we mark as experimental.- Eventually we should use
renderTemplatefor the default behaviour too. But it's not possible to handle the above right now without better templating syntax. So I'm ok with not doing this as well as long as it's experimental.
bluwy
left a comment
There was a problem hiding this comment.
The base branch needs to be updated to main as well. Shouldn't have any big conflicts by directly switching.
Opt-in. Lets changelog-github reproduce @svitejs/changesets-changelog-github-compact via config; default output unchanged.
…nts} token
The linking choice now lives at the point of use in the template:
{summary} links every #n, {summaryHints} links only (fix #n) hints.
Drops the autolinkIssues option entirely.
|
Do we need a next-docs PR for this? |
|
Yeah we can do that after this is merged |
template option to changelog-github
# Conflicts: # docs/config-file-options.md
trueberryless
left a comment
There was a problem hiding this comment.
Sorry for the late review. I know you want to merge already. Just a small docs nitpick here:
Co-authored-by: Felix Schneider <99918022+trueberryless@users.noreply.github.com>
…ndefined-based links
|
@Andarist conflics fixed 👍 Maybe you will want to link later some issues properly (from PR description?) to notify them? |
trueberryless
left a comment
There was a problem hiding this comment.
Amazing 😍
Everything LGTM 🚀
Thanks @jycouet for your wonderful contribution. I'm looking forward to playing around with this option!
Reproduces
@svitejs/changesets-changelog-github-compact(unmaintained) without the dependency.Summary
Opt-in
templateoption for@changesets/changelog-github. It lets it render compact changelog lines straight from.changeset/config.json. Withtemplateunset, output is byte-for-byte unchanged.Reproduce the compact look:
Tokens render bare (you write the surrounding spaces; empties self-erase and trailing whitespace is trimmed):
{summary}- first line, links every#n{ref}- PR-xor-commit, parenthesized{pr},{commit}- the bare links{authors}- contributor links (honorsdisableThanks); write the prefix yourself, e.g.Thanks {authors}!Examples: template/output pairs live in the package README, each locked by a test so they can't drift.
Decisions
disableThanksstays. It is not deprecated and keeps working in template mode ({authors}honors it; you can also drop attribution by omitting{authors}). No back-compat break.@changesets/changelog-githubfor now. Lifting templating into core (so every generator just contributes variables like{pr}/{commit}/{authors}) is a follow-up, not this PR.buildReleaseLineTokensis already shaped for that role and can move up later.Potentially relevant issues / PRs
Refs are intentionally in backticks so this draft creates no cross-links.
Fully addressed
#538- clickable issue links in CHANGELOG.md ->{summary}#689- dropping the "Thanks X" noise for solo maintainers -> omit{authors}/disableThanks#1596- customizing the per-release-line message ->templatePartially addressed (done / not done)
#1821- templates: DONE = output changelog-line template; NOT = input changeset-file template (changeset add --template)#1178- modify the changelog format: DONE = per-line formatting; NOT = whole-file grouping / headers#1057- omit lines: DONE = per-line pieces (Thanks / PR / commit); NOT = removing section headers like "Patch Changes"#1635- shorter commit hash: DONE = changelog{commit}/{ref}(7-char); NOT = the snapshot prerelease version string#1959- override the default changelog formatter: DONE = per-line tokens; NOT = arbitrary PR tags / extra per-record metadata#1248- username links: DONE = drop attribution via{authors}/disableThanks; NOT = emitting plain unlinked@userfor GitHub's Contributors sectionAdjacent - not solved here
These need the headers/grouping or a deeper hook in
apply-release-plan, not the changelog functions:#1807- changelog section titles#995- agetChangelogEntryhook for custom generators#1204- a contributors-acknowledgement section#1332- customizinggenerateChangesForVersionTypeMarkdown#1127/#1123- agetVersionLinehook (version header line)Related context
#1850(merged) addedlinkifyIssueRefs;{summary}reuses it#1255(merged) addeddisableThanks;{authors}honors it (kept, see Decisions)#1236(merged) moved away from short commit IDs after a collision bug; this PR's{commit}/{ref}render 7-char hashes to match compact - flagging in case it needs revisiting#1830(open) adds achangelog-githubREADME; if it lands, document these options there too (currently inconfig-file-options.md)Verification
@changesets/changelog-githubsuite 56/56,types:check/lint/formatclean. Existing snapshots unchanged (the back-compat guarantee).