( changelogContent: string = getStoredChangelogFromMemory(), )
| 247 | * @returns Array of [version, notes[]] arrays |
| 248 | */ |
| 249 | export function getAllReleaseNotes( |
| 250 | changelogContent: string = getStoredChangelogFromMemory(), |
| 251 | ): Array<[string, string[]]> { |
| 252 | try { |
| 253 | const releaseNotes = parseChangelog(changelogContent) |
| 254 | |
| 255 | // Sort versions with oldest first |
| 256 | const sortedVersions = Object.keys(releaseNotes).sort((a, b) => |
| 257 | gt(a, b) ? 1 : -1, |
| 258 | ) |
| 259 | |
| 260 | // Return array of [version, notes] arrays |
| 261 | return sortedVersions |
| 262 | .map(version => { |
| 263 | const versionNotes = releaseNotes[version] |
| 264 | if (!versionNotes || versionNotes.length === 0) return null |
| 265 | |
| 266 | const notes = versionNotes.filter(Boolean) |
| 267 | if (notes.length === 0) return null |
| 268 | |
| 269 | return [version, notes] as [string, string[]] |
| 270 | }) |
| 271 | .filter((item): item is [string, string[]] => item !== null) |
| 272 | } catch (error) { |
| 273 | logError(toError(error)) |
| 274 | return [] |
| 275 | } |
| 276 | } |
| 277 | |
| 278 | /** |
| 279 | * Checks if there are release notes to show based on the last seen version. |
no test coverage detected