MCPcopy Create free account
hub / github.com/Noumena-Network/code / checkForReleaseNotes

Function checkForReleaseNotes

src/utils/releaseNotes.ts:288–328  ·  view source on GitHub ↗
(
  lastSeenVersion: string | null | undefined,
  currentVersion: string = MACRO.VERSION,
)

Source from the content-addressed store, hash-verified

286 * @returns An object with hasReleaseNotes and the releaseNotes content
287 */
288export async function checkForReleaseNotes(
289 lastSeenVersion: string | null | undefined,
290 currentVersion: string = MACRO.VERSION,
291): Promise<{ hasReleaseNotes: boolean; releaseNotes: string[] }> {
292 // For Ant builds, use VERSION_CHANGELOG bundled at build time
293 if (isInternalBuild()) {
294 const changelog = MACRO.VERSION_CHANGELOG
295 if (changelog) {
296 const commits = changelog.trim().split('\n').filter(Boolean)
297 return {
298 hasReleaseNotes: commits.length > 0,
299 releaseNotes: commits,
300 }
301 }
302 return {
303 hasReleaseNotes: false,
304 releaseNotes: [],
305 }
306 }
307
308 // Ensure the in-memory cache is populated for subsequent sync reads
309 const cachedChangelog = await getStoredChangelog()
310
311 // If the version has changed or we don't have a cached changelog, fetch a new one
312 // This happens in the background and doesn't block the UI
313 if (lastSeenVersion !== currentVersion || !cachedChangelog) {
314 fetchAndStoreChangelog().catch(error => logError(toError(error)))
315 }
316
317 const releaseNotes = getRecentReleaseNotes(
318 currentVersion,
319 lastSeenVersion,
320 cachedChangelog,
321 )
322 const hasReleaseNotes = releaseNotes.length > 0
323
324 return {
325 hasReleaseNotes,
326 releaseNotes,
327 }
328}
329
330/**
331 * Synchronous variant of checkForReleaseNotes for React render paths.

Callers 1

setupFunction · 0.85

Calls 6

isInternalBuildFunction · 0.85
getStoredChangelogFunction · 0.85
fetchAndStoreChangelogFunction · 0.85
getRecentReleaseNotesFunction · 0.85
logErrorFunction · 0.70
toErrorFunction · 0.70

Tested by

no test coverage detected