( changelogContent: string = getStoredChangelogFromMemory(), )
| 272 | * @returns Array of [version, notes[]] arrays |
| 273 | */ |
| 274 | export function getAllReleaseNotes( |
| 275 | changelogContent: string = getStoredChangelogFromMemory(), |
| 276 | ): Array<[string, string[]]> { |
| 277 | try { |
| 278 | const releaseNotes = parseChangelog(changelogContent) |
| 279 | |
| 280 | // Sort versions with oldest first |
| 281 | const sortedVersions = Object.keys(releaseNotes).sort((a, b) => |
| 282 | gt(a, b) ? 1 : -1, |
| 283 | ) |
| 284 | |
| 285 | // Return array of [version, notes] arrays |
| 286 | return sortedVersions |
| 287 | .map(version => { |
| 288 | const versionNotes = releaseNotes[version] |
| 289 | if (!versionNotes || versionNotes.length === 0) return null |
| 290 | |
| 291 | const notes = versionNotes.filter(Boolean) |
| 292 | if (notes.length === 0) return null |
| 293 | |
| 294 | return [version, notes] as [string, string[]] |
| 295 | }) |
| 296 | .filter((item): item is [string, string[]] => item !== null) |
| 297 | } catch (error) { |
| 298 | logError(toError(error)) |
| 299 | return [] |
| 300 | } |
| 301 | } |
| 302 | |
| 303 | /** |
| 304 | * Checks if there are release notes to show based on the last seen version. |
no test coverage detected