Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -359,8 +359,9 @@ the template we currently use:
> - Fix #2

Make sure you're on latest `trunk`, then run
`yarn release-notes <last version> <this version>` to get a list of user-facing
changes. You will likely need to prune and rewrite some of these entries.
`node --run release-notes -- <last version> <this version>` to get a list of
user-facing changes. You will likely need to prune and rewrite some of these
entries.

<!-- References -->

Expand Down
27 changes: 5 additions & 22 deletions scripts/internal/release-notes.mts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ type Group =
| "visionos"
| "windows";

type Changes = Record<string, Record<Group, string[]>>;
type Changes = Record<string, Partial<Record<Group, string[]>>>;

function assertCategory(category: string): asserts category is "feat" | "fix" {
if (category !== "feat" && category !== "fix") {
Expand Down Expand Up @@ -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);
}
}

Expand Down