import { readFileSync } from "node:fs"; import type { Metadata } from "next"; import { getPaths } from "yt-dlp-transcript-common/lib/paths"; import { Changelog } from "yt-dlp-transcript-common/components/Changelog"; import { extractUnreleasedSection, getLatestChangelogDate, getLatestReleasedVersion, suggestNextVersion, } from "yt-dlp-transcript-common/lib/changelog"; import { MarkChangelogSeen } from "../components/MarkChangelogSeen"; import { CutReleaseForm } from "../sites/components/CutReleaseForm"; export const dynamic = "force-dynamic"; export const metadata: Metadata = { title: "Changelog" }; function loadChangelog(): string { // Must be the same file cutReleaseAction rewrites, or the page renders one // changelog while the form edits another. return readFileSync(getPaths().editorChangelogFile, "utf8"); } export default function ChangelogPage() { const source = loadChangelog(); const latestDate = getLatestChangelogDate(source); const lastVersion = getLatestReleasedVersion(source); const suggestedVersion = suggestNextVersion(lastVersion); const unreleased = extractUnreleasedSection(source); const hasUnreleased = unreleased.length > 0; return (
Turns the current ## [Unreleased] heading into a
dated semver heading.