-
Notifications
You must be signed in to change notification settings - Fork 614
chore(web): add changelog pages to footer #5239
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| import { processContent } from "@hypr/changelog"; | ||
|
|
||
| const rawEntries = import.meta.glob( | ||
| "../../../../packages/changelog/content/*.md", | ||
| { | ||
| eager: true, | ||
| import: "default", | ||
| query: "?raw", | ||
| }, | ||
| ) as Record<string, string>; | ||
|
|
||
| export const changelogEntries = Object.entries(rawEntries) | ||
| .map(([filePath, raw]) => { | ||
| const version = filePath.split("/").pop()?.replace(/\.md$/, "") ?? ""; | ||
| const { content, date } = processContent(raw); | ||
|
|
||
| return { | ||
| version, | ||
| content, | ||
| date: normalizeDate(date), | ||
| }; | ||
| }) | ||
| .filter((entry) => entry.version) | ||
| .sort((a, b) => compareVersionsDesc(a.version, b.version)); | ||
|
|
||
| export function getChangelogEntry(version: string) { | ||
| return changelogEntries.find((entry) => entry.version === version); | ||
| } | ||
|
|
||
| function normalizeDate(date: string | null) { | ||
| return date?.replace(/^["']|["']$/g, "") ?? null; | ||
| } | ||
|
|
||
| function compareVersionsDesc(a: string, b: string) { | ||
| const left = a.split(".").map(Number); | ||
| const right = b.split(".").map(Number); | ||
| const length = Math.max(left.length, right.length); | ||
|
|
||
| for (let i = 0; i < length; i++) { | ||
| const diff = (right[i] ?? 0) - (left[i] ?? 0); | ||
| if (diff !== 0) return diff; | ||
| } | ||
|
|
||
| return b.localeCompare(a); | ||
| } | ||
|
|
||
| export function formatChangelogDate(date: string) { | ||
| const parsed = new Date(`${date}T00:00:00Z`); | ||
|
|
||
| if (Number.isNaN(parsed.getTime())) { | ||
| return date; | ||
| } | ||
|
|
||
| return new Intl.DateTimeFormat("en-US", { | ||
| month: "short", | ||
| day: "numeric", | ||
| year: "numeric", | ||
| timeZone: "UTC", | ||
| }).format(parsed); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,89 @@ | ||
| import { createFileRoute, Link, notFound } from "@tanstack/react-router"; | ||
|
|
||
| import { ChangelogContent } from "@hypr/changelog"; | ||
|
|
||
| import { SiteFooter } from "@/components/site-footer"; | ||
| import { formatChangelogDate, getChangelogEntry } from "@/lib/changelog"; | ||
| import { ANARLOG_SITE_URL } from "@/lib/seo"; | ||
|
|
||
| export const Route = createFileRoute("/changelog/$version")({ | ||
| component: Component, | ||
| loader: async ({ params }) => { | ||
| const entry = getChangelogEntry(params.version); | ||
| if (!entry) { | ||
| throw notFound(); | ||
| } | ||
| return { entry }; | ||
| }, | ||
| head: ({ loaderData }) => { | ||
| const entry = loaderData?.entry; | ||
| if (!entry) return {}; | ||
|
|
||
| const url = `${ANARLOG_SITE_URL}/changelog/${entry.version}`; | ||
| return { | ||
| links: [{ rel: "canonical", href: url }], | ||
| meta: [ | ||
| { title: `Anarlog v${entry.version} Changelog` }, | ||
| { | ||
| name: "description", | ||
| content: `Release notes for Anarlog v${entry.version}.`, | ||
| }, | ||
| { | ||
| property: "og:title", | ||
| content: `Anarlog v${entry.version} Changelog`, | ||
| }, | ||
| { | ||
| property: "og:description", | ||
| content: `Release notes for Anarlog v${entry.version}.`, | ||
| }, | ||
| { property: "og:url", content: url }, | ||
| ], | ||
| }; | ||
| }, | ||
| }); | ||
|
|
||
| function Component() { | ||
| const { entry } = Route.useLoaderData(); | ||
|
|
||
| return ( | ||
| <main className="min-h-screen bg-white text-[#181613]"> | ||
| <div className="mx-auto w-full max-w-[700px] px-5 py-8 md:px-8 md:py-12"> | ||
| <header className="flex items-center justify-between gap-6"> | ||
| <Link to="/" aria-label="Anarlog home"> | ||
| <img src="/logo.svg" alt="Anarlog" className="h-9 w-auto" /> | ||
| </Link> | ||
| </header> | ||
|
|
||
| <Link | ||
| to="/changelog/" | ||
| className="mt-16 inline-block text-sm text-[#756b5d] hover:text-[#181613]" | ||
| > | ||
| ← Changelog | ||
| </Link> | ||
|
|
||
| <header className="pt-10 pb-12"> | ||
| <h1 className="font-hand text-5xl leading-[1.02] font-semibold tracking-normal text-balance text-black md:text-7xl"> | ||
| v{entry.version} | ||
| </h1> | ||
| {entry.date && ( | ||
| <time | ||
| dateTime={entry.date} | ||
| className="mt-6 block text-sm text-[#756b5d]" | ||
| > | ||
| {formatChangelogDate(entry.date)} | ||
| </time> | ||
| )} | ||
| </header> | ||
|
|
||
| <article className="border-t border-[#eee8df] pt-8"> | ||
| <ChangelogContent | ||
| content={entry.content} | ||
| className="text-sm leading-7" | ||
| /> | ||
| </article> | ||
| </div> | ||
|
|
||
| <SiteFooter /> | ||
| </main> | ||
| ); | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AGENTS.md exposed as a public changelog entry
High Severity
The glob
*.mdinchangelog.tsandgetChangelogVersionsinsitemap.tsboth pick up theAGENTS.mdfile frompackages/changelog/content/, which contains internal AI agent instructions — not a release. It passes the.filter((entry) => entry.version)check because"AGENTS"is truthy. This creates a public/changelog/AGENTSpage exposing development instructions and adds it to the sitemap. Additionally,compareVersionsDescreceivesNaNfrom"AGENTS".split(".").map(Number), causing undefined sort behavior for the entire list.Additional Locations (1)
apps/web/src/utils/sitemap.ts#L20-L31Reviewed by Cursor Bugbot for commit 42af488. Configure here.