fix: add formatReleaseNotes helper for markdown changelog rendering (#1468)
- Add formatReleaseNotes() helper to convert releaseNotes to markdown - Handle string, ReleaseNoteInfo[], null, and undefined formats - Convert array format to markdown with version headers (## version) - Use helper in update-available, update-downloaded, and checkForUpdates - Properly format changelogs when releaseNotes is an array format Fixes #144 Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -62,8 +62,13 @@ function formatReleaseNotes(releaseNotes: UpdateInfo['releaseNotes']): string |
|
||||
// It's an array of ReleaseNoteInfo objects
|
||||
// Format: [{ version: "1.0.0", note: "changes..." }, ...]
|
||||
if (Array.isArray(releaseNotes)) {
|
||||
// Return undefined for empty arrays for consistency with null/undefined handling
|
||||
if (releaseNotes.length === 0) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const formattedNotes = releaseNotes
|
||||
.filter(item => item.note) // Only include entries with notes
|
||||
.filter(item => item.note) // Filter out entries with null/undefined notes
|
||||
.map(item => {
|
||||
// Each item has version and note properties
|
||||
const versionHeader = item.version ? `## ${item.version}\n` : '';
|
||||
|
||||
Reference in New Issue
Block a user