From b68c99132aa10f9b43cfe01f47fd30e5018c15f3 Mon Sep 17 00:00:00 2001 From: Tommy Nguyen <4123478+tido64@users.noreply.github.com> Date: Wed, 29 Oct 2025 10:00:59 +0100 Subject: [PATCH] chore(release): skip empty categories in release notes --- CONTRIBUTING.md | 5 +++-- scripts/internal/release-notes.mts | 27 +++++---------------------- 2 files changed, 8 insertions(+), 24 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 9f8789f2f..5a98c2baf 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -359,8 +359,9 @@ the template we currently use: > - Fix #2 Make sure you're on latest `trunk`, then run -`yarn release-notes ` to get a list of user-facing -changes. You will likely need to prune and rewrite some of these entries. +`node --run release-notes -- ` to get a list of +user-facing changes. You will likely need to prune and rewrite some of these +entries. diff --git a/scripts/internal/release-notes.mts b/scripts/internal/release-notes.mts index 79b82cb8b..93c83dbce 100644 --- a/scripts/internal/release-notes.mts +++ b/scripts/internal/release-notes.mts @@ -19,7 +19,7 @@ type Group = | "visionos" | "windows"; -type Changes = Record>; +type Changes = Record>>; function assertCategory(category: string): asserts category is "feat" | "fix" { if (category !== "feat" && category !== "fix") { @@ -85,33 +85,16 @@ function sanitizeGroup(group: string): Group { } function parseCommits(commits: Commit[]): Changes { - const changes: Changes = { - feat: { - general: [], - android: [], - apple: [], - ios: [], - macos: [], - visionos: [], - windows: [], - }, - fix: { - general: [], - android: [], - apple: [], - ios: [], - macos: [], - visionos: [], - windows: [], - }, - }; + const changes: Changes = { feat: {}, fix: {} }; for (const { message } of commits) { const m = message.match(/^(feat|fix)(?:\((.*?)\))?: (.*)$/); if (m) { const [, cat, group, message] = m; assertCategory(cat); - changes[cat][sanitizeGroup(group)].push(message); + const g = sanitizeGroup(group); + changes[cat][g] ||= []; + changes[cat][g].push(message); } }