INNER CODE UNIT · TypeScript
extractDate
cyanheads/pubmed-mcp-server · scripts/build-changelog.ts:125
function extractDate(body: string, fileLabel: string): string {
const match = body.match(/^#\s+\S+\s+[—–-]\s+(\d{4}-\d{2}-\d{2})/m);
if (!match) {
throw new Error(
`${fileLabel}: H1 heading missing or malformed. Expected '# <version> — YYYY-MM-DD'.`,
);
}
return match[1] as string;
}
function renderEntry(entry: VersionEntry, fm: Frontmatter, date: string): string {
const link = `changelog/${entry.series}/${entry.version}.md`;
const badges = [fm.breaking ? '⚠️ Breaking' : null, fm.security ? '🛡️ Security' : null].filter(
(b): b is string => b !== null,
);
const badgeSuffix = badges.length > 0 ? ` · ${badges.join(' · ')}` : '';
const header = `## [${entry.version}](${link}) — ${date}${badgeSuffix}`;
if (fm.summary) {