Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

feat(www): new changelog sync (#47880)

Francesco Sansalvadore7c20cc574c57
diff --git a/apps/www/components/Changelog/ChangelogDetailSidebar.tsx b/apps/www/components/Changelog/ChangelogDetailSidebar.tsx
index ad5cd2d56a7..17f25044d7a 100644
--- a/apps/www/components/Changelog/ChangelogDetailSidebar.tsx
+++ b/apps/www/components/Changelog/ChangelogDetailSidebar.tsx
@@ -5,35 +5,94 @@ import { Chatgpt, Claude } from 'icons'
import { Check, Copy, ExternalLink } from 'lucide-react'
import { cn } from 'ui'
-import { LabelBadges } from '@/components/Changelog/ChangelogTimelineList'
-import type { ChangelogLabel } from '@/lib/changelog-github'
+import { ChangeTypeBadge, ProductBadges } from '@/components/Changelog/ChangelogTimelineList'
+import type { ChangelogEntryFrontmatter } from '@/lib/changelog-repo'
import { SITE_ORIGIN } from '@/lib/constants'
type Props = {
slug: string
- url: string
- labels: ChangelogLabel[]
+ frontmatter: ChangelogEntryFrontmatter
className?: string
}
-export function ChangelogDetailSidebar({ slug, url, labels, className }: Props) {
+export function ChangelogDetailSidebar({ slug, frontmatter, className }: Props) {
const { copied, copyMarkdown } = useCopyMarkdownFromUrl()
const mdPath = `/changelog/${slug}.md`
const mdAbs = `${SITE_ORIGIN}${mdPath}`
const aiPrompt = `Read from ${mdAbs} so I can ask questions about its contents`
+ const affectedProducts = frontmatter.affected_products ?? []
return (
- <div className={cn('flex flex-col gap-6', className)}>
- {labels.length > 0 && (
+ <div className={cn('flex flex-col gap-5', className)}>
+ <section aria-labelledby="changelog-detail-type">
+ <h2
+ id="changelog-detail-type"
+ className="text-foreground-light mb-2 font-mono text-xs uppercase tracking-wide"
+ >
+ Change type
+ </h2>
+ <ChangeTypeBadge type={frontmatter.change_type} />
+ </section>
+
+ <div className="border-default border-t" role="presentation" />
+
+ {affectedProducts.length > 0 && (
<>
<section aria-labelledby="changelog-detail-tags">
<h2
id="changelog-detail-tags"
- className="text-foreground-light mb-3 font-mono text-xs uppercase tracking-wide"
+ className="text-foreground-light mb-2 font-mono text-xs uppercase tracking-wide"
+ >
+ Products
+ </h2>
+ <ProductBadges products={affectedProducts} onBadgeClick={(e) => e.stopPropagation()} />
+ </section>
+ <div className="border-default border-t" role="presentation" />
+ </>
+ )}
+
+ {frontmatter.product_stage && (
+ <>
+ <section aria-labelledby="changelog-detail-stage">
+ <h2
+ id="changelog-detail-stage"
+ className="text-foreground-light mb-2 font-mono text-xs uppercase tracking-wide"
+ >
+ Product stage
+ </h2>
+ <span className="text-foreground-light text-sm">{frontmatter.product_stage}</span>
+ </section>
+ <div className="border-default border-t" role="presentation" />
+ </>
+ )}
+
+ {frontmatter.sunset_date && (
+ <>
+ <section aria-labelledby="changelog-detail-sunset">
+ <h2
+ id="changelog-detail-sunset"
+ className="text-foreground-light mb-2 font-mono text-xs uppercase tracking-wide"
+ >
+ Sunset date
+ </h2>
+ <p className="text-foreground-lighter font-mono text-xs">{frontmatter.sunset_date}</p>
+ </section>
+ <div className="border-default border-t" role="presentation" />
+ </>
+ )}
+
+ {frontmatter.affects_self_hosted != null && (
+ <>
+ <section aria-labelledby="changelog-detail-selfhosted">
+ <h2
+ id="changelog-detail-selfhosted"
+ className="text-foreground-light mb-2 font-mono text-xs uppercase tracking-wide"
>
- Tags
+ Self-hosted
</h2>
- <LabelBadges labels={labels} onBadgeClick={(e) => e.stopPropagation()} />
+ <span className="text-foreground-lighter font-mono text-xs">
+ {frontmatter.affects_self_hosted ? 'Affected' : 'Not affected'}
+ </span>
</section>
<div className="border-default border-t" role="presentation" />
</>
@@ -42,20 +101,22 @@ export function ChangelogDetailSidebar({ slug, url, labels, className }: Props)
<section aria-labelledby="changelog-detail-links">
<h2
id="changelog-detail-links"
- className="text-foreground-light mb-3 font-mono text-xs uppercase tracking-wide"
+ className="text-foreground-light mb-2 font-mono text-xs uppercase tracking-wide"
>
Links
</h2>
<nav className="flex flex-col gap-2">
- <a
- href={url}
- target="_blank"
- rel="noreferrer noopener"
- className="text-foreground-lighter hover:text-foreground flex items-center gap-1.5 text-xs transition-colors"
- >
- <ExternalLink size={14} strokeWidth={1.5} />
- View discussion on GitHub
- </a>
+ {frontmatter.legacy_gh_discussion && (
+ <a
+ href={`https://github.com/supabase/supabase/discussions/${frontmatter.legacy_gh_discussion}`}
+ target="_blank"
+ rel="noreferrer noopener"
+ className="text-foreground-lighter hover:text-foreground flex items-center gap-1.5 text-xs transition-colors"
+ >
+ <ExternalLink size={14} strokeWidth={1.5} />
+ View discussion on GitHub
+ </a>
+ )}
<button
tabIndex={0}
type="button"
diff --git a/apps/www/components/Changelog/ChangelogTimelineList.tsx b/apps/www/components/Changelog/ChangelogTimelineList.tsx
index acd81b4a600..a01a3490271 100644
--- a/apps/www/components/Changelog/ChangelogTimelineList.tsx
+++ b/apps/www/components/Changelog/ChangelogTimelineList.tsx
@@ -1,9 +1,14 @@
-import type { ChangelogLabel, ChangelogTimelineIndexItem } from '~/lib/changelog-github'
-import { changelogLabelDisplayName, changelogTagFilterUrl } from '~/lib/changelog.utils'
+import type { ChangeType } from '~/lib/changelog-repo'
+import {
+ CHANGE_TYPE_DISPLAY,
+ changelogTagFilterUrl,
+ changelogTypeFilterUrl,
+ type ChangelogTimelineIndexItem,
+} from '~/lib/changelog.utils'
import dayjs from 'dayjs'
import { GitCommit } from 'lucide-react'
import Link from 'next/link'
-import type { MouseEvent } from 'react'
+import { type MouseEvent } from 'react'
import { Badge, cn } from 'ui'
function groupChangelogIndexByYear(
@@ -18,24 +23,47 @@ function groupChangelogIndexByYear(
return [...map.entries()].sort((a, b) => b[0] - a[0])
}
-export function LabelBadges({
- labels,
+export function ChangeTypeBadge({
+ type,
+ onBadgeClick,
+ className,
+}: {
+ type: ChangeType
+ onBadgeClick?: (e: MouseEvent) => void
+ className?: string
+}) {
+ const { label, badgeVariant } = CHANGE_TYPE_DISPLAY[type]
+ return (
+ <a
+ href={changelogTypeFilterUrl(type)}
+ className="inline-flex shrink-0 no-underline focus-visible:ring-brand-default rounded-md focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-hidden"
+ onClick={onBadgeClick}
+ >
+ <Badge variant={badgeVariant} className={className}>
+ {label}
+ </Badge>
+ </a>
+ )
+}
+
+export function ProductBadges({
+ products,
onBadgeClick,
tiny,
className,
}: {
- labels: ChangelogLabel[]
+ products: string[]
onBadgeClick?: (e: MouseEvent) => void
tiny?: boolean
className?: string
}) {
- if (labels.length === 0) return null
+ if (products.length === 0) return null
return (
<div className={cn('flex flex-wrap items-center', tiny ? 'gap-0.5' : 'gap-1', className)}>
- {labels.map((label) => (
+ {products.map((product) => (
<a
- key={label.name}
- href={changelogTagFilterUrl(label.name)}
+ key={product}
+ href={changelogTagFilterUrl(product)}
className={
tiny
? 'inline-flex shrink-0 no-underline focus-ring rounded-sm'
@@ -48,11 +76,11 @@ export function LabelBadges({
className={cn(
'tracking-normal lowercase border-default',
tiny
- ? 'text-foreground-lighter hover:text-foreground-light rounded-full border px-0.5 py-px text-[8px] font-medium leading-none'
- : 'text-foreground-light hover:text-foreground rounded-full border px-1.5 py-px text-[11px] font-medium leading-tight'
+ ? 'text-foreground-lighter hover:text-foreground-light px-0.5 py-px text-[8px] leading-none'
+ : 'text-foreground-light hover:text-foreground px-1.5 py-px text-[11px] leading-tight'
)}
>
- {changelogLabelDisplayName(label.name)}
+ {product}
</Badge>
</a>
))}
@@ -62,23 +90,34 @@ export function LabelBadges({
function TimelineRow({ item, href }: { item: ChangelogTimelineIndexItem; href: string }) {
const dateLabel = dayjs(item.sortDate).format('MMM D')
- const labels = item.labels ?? []
return (
- <div
- className="group border-default flex w-full flex-col gap-0.5 border-b py-3 text-left scroll-mt-16"
- id={item.number.toString()}
- >
- <div className="min-w-0">
- <Link href={href} prefetch={false} className="min-w-0 text-left">
- <h3 className="text-foreground text-lg leading-snug hover:underline">{item.title}</h3>
- </Link>
+ <div className="relative group flex w-full gap-3 text-left scroll-mt-16" id={item.slug}>
+ <div className="absolute top-[-3px] right-[calc(100%+0.75rem)] hidden shrink-0 lg:block lg:pt-3">
+ <ChangeTypeBadge type={item.changeType} onBadgeClick={(e) => e.stopPropagation()} />
</div>
- <div className="flex min-w-0 gap-2 pt-0.5">
- <time dateTime={item.sortDate} className="text-foreground-lighter text-xs tracking-normal">
- {dateLabel}
- </time>
- <LabelBadges labels={labels} onBadgeClick={(e) => e.stopPropagation()} />
+ <div className="border-default timeline-row-content flex min-w-0 flex-1 flex-col gap-0.5 border-b py-3">
+ <div className="min-w-0">
+ <Link href={href} prefetch={false} className="min-w-0 text-left">
+ <h3 className="text-foreground text-lg leading-snug hover:underline">{item.title}</h3>
+ </Link>
+ </div>
+ {item.summary && <p className="text-foreground-lighter text-sm">{item.summary}</p>}
+ <div className="flex min-w-0 gap-2 pt-0.5">
+ <time
+ dateTime={item.sortDate}
+ className="text-foreground-lighter text-xs font-mono tracking-normal"
+ >
+ {dateLabel}
+ </time>
+ <span className="lg:hidden">
+ <ChangeTypeBadge type={item.changeType} onBadgeClick={(e) => e.stopPropagation()} />
+ </span>
+ <ProductBadges
+ products={item.affectedProducts}
+ onBadgeClick={(e) => e.stopPropagation()}
+ />
+ </div>
</div>
</div>
)
@@ -118,11 +157,11 @@ export function ChangelogTimelineList(props: Props) {
<div
className={
yearIndex === yearGroups.length - 1
- ? 'grid lg:grid-cols-12 lg:gap-4 pt-2 lg:pt-2'
- : 'grid lg:grid-cols-12 lg:gap-4 pb-8 lg:pb-20 lg:py-2'
+ ? 'grid lg:grid-cols-12 lg:gap-8 pt-2 lg:pt-2'
+ : 'grid lg:grid-cols-12 lg:gap-8 pb-8 lg:pb-20 lg:py-2'
}
>
- <div className="relative hidden lg:col-span-2 lg:block">
+ <div className="relative hidden lg:col-span-4 lg:block">
<div className="ml-[-42px] text-foreground lg:sticky lg:top-[calc(65px+1rem)] lg:pt-4">
<div className="text-foreground-light mb-1 flex items-center gap-2">
<div className="bg-border border-muted flex h-5 w-5 shrink-0 items-center justify-center rounded-sm border drop-shadow-xs">
@@ -139,9 +178,9 @@ export function ChangelogTimelineList(props: Props) {
</div>
</div>
- <div className="min-w-0 lg:col-span-10 [&>*:last-child]:border-b-0">
+ <div className="min-w-0 lg:col-span-8 [&>*:last-child>.timeline-row-content]:border-b-0">
{yearItems.map((item) => (
- <TimelineRow key={item.number} item={item} href={`/changelog/${item.slug}`} />
+ <TimelineRow key={item.slug} item={item} href={`/changelog/${item.slug}`} />
))}
</div>
</div>
diff --git a/apps/www/data/changelog-product-tags.json b/apps/www/data/changelog-product-tags.json
index 6d7da04a24e..4c8563cfc20 100644
--- a/apps/www/data/changelog-product-tags.json
+++ b/apps/www/data/changelog-product-tags.json
@@ -1,25 +1,25 @@
[
- { "slug": "database", "label": "Database" },
+ { "slug": "ai", "label": "AI" },
{ "slug": "auth", "label": "Auth" },
- { "slug": "storage", "label": "Storage" },
- { "slug": "realtime", "label": "Realtime" },
- { "slug": "edge functions", "label": "Edge Functions" },
- { "slug": "postgres", "label": "postgres" },
- { "slug": "postgrest", "label": "PostgREST" },
- { "slug": "ai", "label": "AI & Vector" },
- { "slug": "analytics", "label": "Analytics" },
- { "slug": "billing", "label": "Billing" },
- { "slug": "breaking-change", "label": "Breaking Change" },
{ "slug": "cli", "label": "CLI" },
+ { "slug": "compliance", "label": "Compliance" },
+ { "slug": "data apis", "label": "Data APIs" },
+ { "slug": "database", "label": "Database" },
+ { "slug": "dev workflows", "label": "Dev Workflows" },
{ "slug": "etl", "label": "ETL" },
- { "slug": "frontend", "label": "Dashboard" },
- { "slug": "graphql", "label": "GraphQL" },
- { "slug": "documentation", "label": "Docs" },
- { "slug": "infra", "label": "Infra" },
- { "slug": "multigres", "label": "Multigres" },
- { "slug": "self-hosted", "label": "Self-hosted" },
- { "slug": "javascript", "label": "supabase-js" },
- { "slug": "swift", "label": "supabase-swift" },
- { "slug": "flutter", "label": "supabase-flutter" },
- { "slug": "python", "label": "supabase-py" }
+ { "slug": "edge functions", "label": "Edge Functions" },
+ { "slug": "networking", "label": "Networking" },
+ { "slug": "observability", "label": "Observability" },
+ { "slug": "platform", "label": "Platform" },
+ { "slug": "realtime", "label": "Realtime" },
+ { "slug": "replication", "label": "Replication" },
+ { "slug": "security", "label": "Security" },
+ { "slug": "storage", "label": "Storage" },
+ { "slug": "studio", "label": "Studio" },
+ { "slug": "vector", "label": "Vector" },
+ { "slug": "supabase-flutter", "label": "supabase-flutter" },
+ { "slug": "supabase-js", "label": "supabase-js" },
+ { "slug": "supabase-py", "label": "supabase-py" },
+ { "slug": "supabase-react", "label": "supabase-react" },
+ { "slug": "supabase-swift", "label": "supabase-swift" }
]
diff --git a/apps/www/lib/changelog-entries-core.mjs b/apps/www/lib/changelog-entries-core.mjs
new file mode 100644
index 00000000000..db452741a4e
--- /dev/null
+++ b/apps/www/lib/changelog-entries-core.mjs
@@ -0,0 +1,164 @@
+/**
+ * Parsing + fetch helpers for supabase/changelog `entries/*.md` files, shared by:
+ * - lib/changelog-repo.ts (page rendering, via GitHub App fetch)
+ * - scripts/generateStaticContent.mjs (RSS + changelog.md static generation)
+ *
+ * Plain .mjs (no TypeScript syntax) so both a TS Next.js module and a plain
+ * `node` build script can import it directly.
+ */
+import { Readable } from 'stream'
+import zlib from 'zlib'
+import matter from 'gray-matter'
+import * as tarStream from 'tar-stream'
+
+export const CHANGE_TYPE_LABELS = {
+ 'breaking-change': 'Breaking Change',
+ deprecation: 'Deprecation',
+ 'new-feature': 'New Feature',
+ improvement: 'Improvement',
+ 'bug-fix': 'Bug Fix',
+ security: 'Security',
+ policy: 'Policy',
+}
+
+/**
+ * Fetches the whole repo as a single tarball and extracts `entries/*.md` in
+ * memory. One API call regardless of entry count — fetching each file
+ * individually (one request per entry) trips GitHub's secondary rate limit
+ * once the entries directory grows past a couple hundred files.
+ *
+ * @param {import('@octokit/core').Octokit} octokit - already authenticated
+ * @param {{ owner: string, repo: string, entriesPath?: string }} options
+ * @returns {Promise<{ filename: string, content: string }[]>}
+ */
+export async function fetchChangelogEntryFilesFromTarball(
+ octokit,
+ { owner, repo, entriesPath = 'entries' }
+) {
+ const tarballRes = await octokit.request('GET /repos/{owner}/{repo}/tarball/{ref}', {
+ owner,
+ repo,
+ ref: 'HEAD',
+ })
+
+ const gunzipped = zlib.gunzipSync(Buffer.from(tarballRes.data))
+ const entryPathRe = new RegExp(`/${entriesPath}/([^/]+\\.md)$`)
+ const extract = tarStream.extract()
+ const files = []
+
+ extract.on('entry', (header, stream, next) => {
+ const match = header.type === 'file' ? header.name.match(entryPathRe) : null
+ if (!match) {
+ stream.resume()
+ next()
+ return
+ }
+ const chunks = []
+ stream.on('data', (chunk) => chunks.push(chunk))
+ stream.on('end', () => {
+ files.push({ filename: match[1], content: Buffer.concat(chunks).toString('utf8') })
+ next()
+ })
+ stream.resume()
+ })
+
+ await new Promise((resolve, reject) => {
+ extract.on('finish', resolve)
+ extract.on('error', reject)
+ Readable.from(gunzipped).pipe(extract)
+ })
+
+ return files
+}
+
+export function stripInternalBlock(body) {
+ let sanitized = body.replace(/<!--\s*internal\s*-->[\s\S]*?<!--\s*\/internal\s*-->/gi, '')
+ // MDX doesn't support raw HTML comments (only {/* */}) — strip any that are left
+ // (e.g. author/template notes) so they can't break rendering. Applied repeatedly:
+ // a single pass could in principle leave a fresh `<!-- ... -->` behind.
+ let previous
+ do {
+ previous = sanitized
+ sanitized = sanitized.replace(/<!--[\s\S]*?-->/g, '')
+ } while (sanitized !== previous)
+ return sanitized.trim()
+}
+
+/**
+ * Extracts the content under a `## <heading>` line.
+ * @param {string[]} [stopAtHeadings] - exact heading names that terminate this section; omit to stop at any `##` line
+ */
+export function extractSection(markdown, heading, stopAtHeadings) {
+ const stopClause = stopAtHeadings?.length
+ ? stopAtHeadings.map((h) => `##\\s+${h}\\s*$`).join('|')
+ : '##\\s+.*$'
+ const regex = new RegExp(
+ `^##\\s+${heading}\\s*\\n([\\s\\S]*?)(?=^(?:${stopClause})|(?![\\s\\S]))`,
+ 'im'
+ )
+ const match = markdown.match(regex)
+ return match ? match[1].trim() : ''
+}
+
+function resolveDateFromFilename(filename) {
+ const m = filename.match(/^(\d{4})(\d{2})(\d{2})-/)
+ return m ? `${m[1]}-${m[2]}-${m[3]}` : null
+}
+
+/**
+ * `legacy_gh_discussion-suffix` for backfilled entries
+ * (preserves old supabase.com/changelog URLs)
+ * or the filename without timestamp and extension.
+ * */
+export function computeChangelogEntrySlug(filename, frontmatter) {
+ const base = filename.replace(/\.md$/, '')
+ const suffixMatch = base.match(/^\d{8}-(.+)$/)
+ const suffix = suffixMatch ? suffixMatch[1] : base
+ if (frontmatter.legacy_gh_discussion) {
+ return `${frontmatter.legacy_gh_discussion}-${suffix}`
+ }
+ return suffix
+}
+
+/** @param {string} filename @param {string} raw */
+export function parseChangelogEntryFile(filename, raw) {
+ const { data: frontmatter, content } = matter(raw)
+ const publicBody = stripInternalBlock(content)
+
+ return {
+ slug: computeChangelogEntrySlug(filename, frontmatter),
+ filename,
+ frontmatter,
+ sortDate: frontmatter.publish_date ?? resolveDateFromFilename(filename) ?? '',
+ summary: extractSection(publicBody, 'Summary'),
+ bodySection: extractSection(publicBody, 'Body', ['Migration steps']),
+ migrationSteps: extractSection(publicBody, 'Migration steps'),
+ }
+}
+
+/** `public: true` and not scheduled for a future `publish_date`. */
+export function isPublished(entry) {
+ if (entry.frontmatter.public !== true) return false
+ if (!entry.sortDate) return true
+ return new Date(entry.sortDate).getTime() <= Date.now()
+}
+
+export function getPublishedChangelogEntries(files) {
+ const entries = files
+ .map(({ filename, content }) => parseChangelogEntryFile(filename, content))
+ .filter(isPublished)
+ .sort((a, b) => (a.sortDate < b.sortDate ? 1 : a.sortDate > b.sortDate ? -1 : 0))
+
+ const filenameBySlug = new Map()
+ for (const entry of entries) {
+ const clashingFilename = filenameBySlug.get(entry.slug)
+ if (clashingFilename) {
+ throw new Error(
+ `Duplicate changelog slug "${entry.slug}" from "${clashingFilename}" and "${entry.filename}"`
+ )
+ }
+ filenameBySlug.set(entry.slug, entry.filename)
+ }
+
+ return entries
+}
diff --git a/apps/www/lib/changelog-github.ts b/apps/www/lib/changelog-github.ts
deleted file mode 100644
index be049de5ae9..00000000000
--- a/apps/www/lib/changelog-github.ts
+++ /dev/null
@@ -1,183 +0,0 @@
-import { createAppAuth } from '@octokit/auth-app'
-import { Octokit } from '@octokit/core'
-import { paginateGraphql } from '@octokit/plugin-paginate-graphql'
-import dayjs from 'dayjs'
-
-import { changelogEntrySlug, discussionDisplayDate } from './changelog.utils'
-
-export const CHANGELOG_CATEGORY_ID = 'DIC_kwDODMpXOc4CAFUr'
-
-export type ChangelogLabel = { name: string; color: string }
-
-export type ChangelogTimelineIndexItem = {
- number: number
- slug: string
- title: string
- url: string
- sortDate: string
- labels: ChangelogLabel[]
-}
-
-export type ChangelogDiscussionMetadata = {
- id: string
- number: number
- title: string
- publishedAt: string | null
- createdAt: string
- url: string
- labels?: {
- nodes: ChangelogLabel[]
- }
-}
-
-export function createChangelogOctokit() {
- const ExtendedOctokit = Octokit.plugin(paginateGraphql)
- return new ExtendedOctokit({
- authStrategy: createAppAuth,
- auth: {
- appId: process.env.GITHUB_CHANGELOG_APP_ID,
- installationId: process.env.GITHUB_CHANGELOG_APP_INSTALLATION_ID,
- privateKey: process.env.GITHUB_CHANGELOG_APP_PRIVATE_KEY,
- },
- })
-}
-
-export async function fetchAllChangelogDiscussionMetadata(
- octokit: ReturnType<typeof createChangelogOctokit>,
- owner: string,
- repo: string,
- categoryId: string
-): Promise<ChangelogDiscussionMetadata[]> {
- type DiscussionMetadataResponse = {
- repository: {
- discussions: {
- nodes: ChangelogDiscussionMetadata[]
- pageInfo: { hasNextPage: boolean; endCursor: string | null }
- }
- }
- }
-
- const query = `
- query changelogDiscussionMetadata($cursor: String, $owner: String!, $repo: String!, $categoryId: ID!) {
- repository(owner: $owner, name: $repo) {
- discussions(
- first: 100
- after: $cursor
- categoryId: $categoryId
- orderBy: { field: CREATED_AT, direction: DESC }
- ) {
- nodes {
- id
- number
- title
- publishedAt
- createdAt
- url
- labels(first: 25) {
- nodes {
- name
- color
- }
- }
- }
- pageInfo {
- hasNextPage
- endCursor
- }
- }
- }
- }
- `
-
- const collected: ChangelogDiscussionMetadata[] = []
- let cursor: string | null = null
- let hasNextPage = true
-
- while (hasNextPage) {
- const response: DiscussionMetadataResponse = await octokit.graphql(query, {
- owner,
- repo,
- categoryId,
- cursor,
- })
- const { nodes, pageInfo } = response.repository.discussions
-
- collected.push(...nodes)
- hasNextPage = pageInfo.hasNextPage
- cursor = pageInfo.endCursor
- }
-
- return collected
-}
-
-export type FetchedChangelogDiscussion = {
- number: number
- title: string
- body: string
- url: string
- createdAt: string
- category: { id: string; name: string } | null
- labels: { nodes: ChangelogLabel[] }
-}
-
-export async function fetchChangelogDiscussionByNumber(
- octokit: ReturnType<typeof createChangelogOctokit>,
- owner: string,
- repo: string,
- number: number
-): Promise<FetchedChangelogDiscussion | null> {
- const query = `
- query changelogDiscussionByNumber($owner: String!, $repo: String!, $number: Int!) {
- repository(owner: $owner, name: $repo) {
- discussion(number: $number) {
- number
- title
- body
- url
- createdAt
- category {
- id
- name
- }
- labels(first: 25) {
- nodes {
- name
- color
- }
- }
- }
- }
- }
- `
-
- const data = await octokit.graphql<{
- repository: { discussion: FetchedChangelogDiscussion | null }
- }>(query, { owner, repo, number })
-
- return data.repository.discussion
-}
-
-export async function getChangelogTimelineSortedIndex(): Promise<ChangelogTimelineIndexItem[]> {
- const octokit = createChangelogOctokit()
- const raw = await fetchAllChangelogDiscussionMetadata(
- octokit,
- 'supabase',
- 'supabase',
- CHANGELOG_CATEGORY_ID
- )
-
- return raw
- .map((item) => ({
- number: item.number,
- slug: changelogEntrySlug(item.number, item.title),
- title: item.title,
- url: item.url,
- sortDate: discussionDisplayDate(item) ?? item.createdAt,
- labels:
- item.labels?.nodes?.map((l) => ({
- name: l.name,
- color: (l.color || '6b7280').replace(/^#/, ''),
- })) ?? [],
- }))
- .sort((a, b) => dayjs(b.sortDate).diff(dayjs(a.sortDate)))
-}
diff --git a/apps/www/lib/changelog-repo.ts b/apps/www/lib/changelog-repo.ts
new file mode 100644
index 00000000000..c5d6e7cbfae
--- /dev/null
+++ b/apps/www/lib/changelog-repo.ts
@@ -0,0 +1,101 @@
+import { createAppAuth } from '@octokit/auth-app'
+import { Octokit } from '@octokit/core'
+
+import {
+ fetchChangelogEntryFilesFromTarball,
+ getPublishedChangelogEntries,
+} from './changelog-entries-core.mjs'
+
+const CHANGELOG_REPO_OWNER = 'supabase'
+const CHANGELOG_REPO_NAME = 'changelog'
+const CHANGELOG_ENTRIES_PATH = 'entries'
+
+export type ChangeType =
+ | 'breaking-change'
+ | 'deprecation'
+ | 'new-feature'
+ | 'improvement'
+ | 'bug-fix'
+ | 'security'
+ | 'policy'
+
+export type ChangelogEntryFrontmatter = {
+ title: string
+ change_type: ChangeType
+ product_stage?: string | null
+ affected_products: string[]
+ affects_self_hosted?: boolean | null
+ version?: string | null
+ public: boolean
+ publish_date?: string | null
+ sunset_date?: string | null
+ learn_more_url?: string | null
+ rfc_url?: string | null
+ legacy_gh_discussion?: number | null
+}
+
+export type ChangelogEntry = {
+ /** URL-safe identifier. `legacy_gh_discussion-suffix` for backfilled entries, else the filename suffix. */
+ slug: string
+ filename: string
+ frontmatter: ChangelogEntryFrontmatter
+ /** Date used for sorting/display: publish_date, falling back to the filename's date prefix. */
+ sortDate: string
+ /** Contents of `## Summary` only. */
+ summary: string
+ /** Contents of `## Body` only. Never includes the internal block. */
+ bodySection: string
+ /** Contents of `## Migration steps`, if present. */
+ migrationSteps: string
+}
+
+function createChangelogRepoOctokit() {
+ return new Octokit({
+ authStrategy: createAppAuth,
+ auth: {
+ appId: process.env.CHANGELOG_SYNC_APP_ID,
+ installationId: process.env.CHANGELOG_SYNC_APP_INSTALLATION_ID,
+ privateKey: process.env.CHANGELOG_SYNC_APP_PRIVATE_KEY?.replace(/\\n/g, '\n'),
+ },
+ })
+}
+
+/**
+ * supabase/changelog is the source of truth — no fallback source. If this
+ * throws (outage, misconfigured App access, etc.), it propagates so the
+ * failure is loud and visible rather than silently degrading to a stale or
+ * differently-shaped data source.
+ */
+async function listChangelogEntries(): Promise<ChangelogEntry[]> {
+ const octokit = createChangelogRepoOctokit()
+ const files = await fetchChangelogEntryFilesFromTarball(octokit, {
+ owner: CHANGELOG_REPO_OWNER,
+ repo: CHANGELOG_REPO_NAME,
+ entriesPath: CHANGELOG_ENTRIES_PATH,
+ })
+ return getPublishedChangelogEntries(files) as ChangelogEntry[]
+}
+
+const CACHE_TTL_MS = 5 * 60 * 1000
+
+let cachedEntries: Promise<ChangelogEntry[]> | null = null
+let cachedAt = 0
+
+/** All public, currently-published changelog entries, newest first. */
+export async function getChangelogEntries(): Promise<ChangelogEntry[]> {
+ if (!cachedEntries || Date.now() - cachedAt > CACHE_TTL_MS) {
+ cachedAt = Date.now()
+ cachedEntries = listChangelogEntries().catch((error) => {
+ // Clear cache on failure so the next call retries instead of reusing the rejection.
+ cachedEntries = null
+ cachedAt = 0
+ throw error
+ })
+ }
+ return cachedEntries
+}
+
+export async function getChangelogEntryBySlug(slug: string): Promise<ChangelogEntry | null> {
+ const entries = await getChangelogEntries()
+ return entries.find((entry) => entry.slug === slug) ?? null
+}
diff --git a/apps/www/lib/changelog-rss.mjs b/apps/www/lib/changelog-rss.mjs
index 0016b573ee3..016458cd94e 100644
--- a/apps/www/lib/changelog-rss.mjs
+++ b/apps/www/lib/changelog-rss.mjs
@@ -1,6 +1,6 @@
/**
* Pure ESM changelog RSS document builder (used by generateStaticContent.mjs and re-exported from rss.tsx).
- * @typedef {{ number?: number; slug?: string; title: string; url: string; sortDate: string; labels?: string[] }} ChangelogRssItemInput
+ * @typedef {{ slug: string; title: string; sortDate: string; affectedProducts?: string[] }} ChangelogRssItemInput
*/
import dayjs from 'dayjs'
import utc from 'dayjs/plugin/utc.js'
@@ -25,11 +25,7 @@ function buildItemsXml(sorted) {
return sorted
.map((e) => {
const encodedTitle = xmlEncodeRss(e.title)
- const canonicalUrl = e.slug
- ? `https://supabase.com/changelog/${e.slug}`
- : e.number
- ? `https://supabase.com/changelog/${e.number}`
- : e.url
+ const canonicalUrl = `https://supabase.com/changelog/${e.slug}`
const encodedCanonical = xmlEncodeRss(canonicalUrl)
const pubDate = formatRssPubDate(e.sortDate)
return ` <item>
@@ -42,25 +38,9 @@ function buildItemsXml(sorted) {
.join('\n')
}
-/**
- * Generates the URL slug for a changelog entry: `<number>-<slugified-title>`.
- * Mirrors changelogEntrySlug in apps/www/lib/changelog.utils.ts.
- * @param {number} number
- * @param {string} title
- */
-export function changelogEntrySlug(number, title) {
- const titlePart = String(title ?? '')
- .toLowerCase()
- .replace(/[^a-z0-9]+/g, '-')
- .replace(/^-+|-+$/g, '')
- .slice(0, 80)
- .replace(/-+$/, '')
- return `${number}-${titlePart}`
-}
-
/**
* Converts a display label into a lowercase, URL-safe filename slug.
- * e.g. "Edge Functions" → "edge-functions", "AI & Vector" → "ai-vector"
+ * e.g. "Edge Functions" → "edge-functions", "Data APIs" → "data-apis"
* @param {string} label
*/
export function labelToFileSlug(label) {
@@ -72,8 +52,7 @@ export function labelToFileSlug(label) {
/** @param {ChangelogRssItemInput[]} entries */
export function generateChangelogRssXml(entries) {
- const visible = entries.filter((e) => !e.title.includes('[d]'))
- const sorted = [...visible].sort(
+ const sorted = [...entries].sort(
(a, b) => dayjs(b.sortDate).valueOf() - dayjs(a.sortDate).valueOf()
)
@@ -98,16 +77,17 @@ ${buildItemsXml(sorted)}
/**
* Generates a tag-filtered RSS feed.
- * @param {ChangelogRssItemInput[]} allEntries - all entries with labels as lowercase strings
- * @param {{ githubLabelSlug: string; displayLabel: string }} tag
+ * @param {ChangelogRssItemInput[]} allEntries - all entries, with `affected_products` display strings
+ * @param {{ displayLabel: string }} tag
*/
export function generateChangelogTagRssXml(allEntries, tag) {
- const { githubLabelSlug, displayLabel } = tag
+ const { displayLabel } = tag
const fileSlug = labelToFileSlug(displayLabel)
- const filtered = allEntries.filter(
- (e) =>
- !e.title.includes('[d]') && (e.labels ?? []).includes(githubLabelSlug.toLowerCase())
+ const filtered = allEntries.filter((e) =>
+ (e.affectedProducts ?? []).some(
+ (product) => product.toLowerCase() === displayLabel.toLowerCase()
+ )
)
const sorted = [...filtered].sort(
(a, b) => dayjs(b.sortDate).valueOf() - dayjs(a.sortDate).valueOf()
diff --git a/apps/www/lib/changelog.utils.ts b/apps/www/lib/changelog.utils.ts
index 72cb77ec55e..0ed4870fffa 100644
--- a/apps/www/lib/changelog.utils.ts
+++ b/apps/www/lib/changelog.utils.ts
@@ -1,170 +1,70 @@
import changelogProductTags from '~/data/changelog-product-tags.json'
-import type { ChangelogTimelineIndexItem } from './changelog-github'
-
-// hackery to fix Terry accidentally deleting
-// a bunch of releases and their associted discussions in Dec 2023
-// checks if titles match and grabs this original createdAt timestamp
-//
-// When editing entries with `createdAt`, also sync `scripts/data/changelog-deleted-discussions.json`
-// (title + createdAt only) — used by generateStaticContent.mjs for changelog-rss.xml.
-export const deletedDiscussions = [
- {
- title: 'Platform updates: October 2023',
- oldNumber: 18759,
- newNumber: 19705,
- createdAt: '2023-11-06T16:25:12Z',
- },
- {
- title: 'Platform update September 2023',
- oldNumber: 17975,
- newNumber: 19706,
- createdAt: '2023-10-06T09:23:56Z',
- },
- {
- title: 'Platform updates: August 2023',
- oldNumber: 17274,
- newNumber: 19704,
- createdAt: '2023-09-08T13:00:39Z',
- },
- {
- title: 'Platform updates June 2023',
- oldNumber: 15623,
- newNumber: 19703,
- createdAt: '2023-07-07T16:09:32Z',
- },
- {
- title: 'Platform updates: May 2023',
- oldNumber: 14941,
- newNumber: 19702,
- createdAt: '2023-06-09T16:40:16Z',
- },
- {
- title: 'Platform updates: April 2023',
- oldNumber: 14271,
- newNumber: 19701,
- createdAt: '2023-05-10T18:40:02Z',
- },
- {
- title: 'Platform Update February 2023',
- oldNumber: 12915,
- newNumber: 19700,
- createdAt: '2023-03-09T12:06:01Z',
- },
- {
- title: 'Platform update January 2023',
- oldNumber: 12268,
- newNumber: 19699,
- createdAt: '2023-02-08T18:29:41Z',
- },
- {
- title: 'Platform Updates November 2022',
- oldNumber: 10803,
- newNumber: 19698,
- createdAt: '2022-12-08T12:00:48Z',
- },
- {
- title: 'Platform updates: October 2022',
- oldNumber: 10036,
- newNumber: 19697,
- createdAt: '2022-11-02T16:07:47Z',
- },
- {
- title: 'Platform Update September 2022',
- oldNumber: 9388,
- newNumber: 19696,
- createdAt: '2022-10-07T10:18:21Z',
- },
- {
- title: 'Platform Update August 2022',
- },
- {
- title: 'Platform updates: 30 Nov 2021',
- oldNumber: 4169,
- newNumber: 19695,
- createdAt: '2021-11-30T10:06:55Z',
- },
- {
- title: 'October Beta 2021',
- oldNumber: 3830,
- newNumber: 19694,
- createdAt: '2021-11-08T13:14:35Z',
- },
- {
- title: 'September Beta 2021',
- oldNumber: 3417,
- newNumber: 19693,
- createdAt: '2021-10-04T18:10:57Z',
- },
- {
- title: 'August Beta 2021',
- oldNumber: 3184,
- newNumber: 19692,
- createdAt: '2021-09-13T09:47:18Z',
- },
- {
- title: 'July Beta 2021',
- oldNumber: 2815,
- newNumber: 19691,
- createdAt: '2021-08-12T13:46:14Z',
- },
- {
- title: 'June Beta 2021',
- oldNumber: 2216,
- newNumber: 19690,
- createdAt: '2021-07-04T13:23:35Z',
- },
- {
- title: 'May Beta 2021',
- oldNumber: 1912,
- newNumber: 19689,
- createdAt: '2021-06-10T11:53:14Z',
- },
- {
- title: 'April Beta 2021',
- oldNumber: 1433,
- newNumber: 19688,
- createdAt: '2021-05-05T05:17:27Z',
- },
-]
-
-export function discussionDisplayDate(item: { title: string; createdAt: string }) {
- const dateRewrite = deletedDiscussions.find(
- (rewrite) => item.title && rewrite.title && item.title.includes(rewrite.title)
- )
- return dateRewrite ? dateRewrite.createdAt : item.createdAt
-}
+import { CHANGE_TYPE_LABELS } from './changelog-entries-core.mjs'
+import type { ChangelogEntry, ChangeType } from './changelog-repo'
-const CHANGELOG_LABEL_DISPLAY_NAME: Record<string, string> = {
- documentation: 'docs',
- frontend: 'dashboard',
- javascript: 'supabase-js',
- swift: 'supabase-swift',
- flutter: 'supabase-flutter',
- python: 'supabase-py',
+export type ChangelogTimelineIndexItem = {
+ slug: string
+ title: string
+ summary: string
+ sortDate: string
+ changeType: ChangeType
+ affectedProducts: string[]
+ productStage: string | null
+ affectsSelfHosted: boolean | null
}
-/** Returns the display name for a GitHub label, falling back to the original name. */
-export function changelogLabelDisplayName(name: string): string {
- return CHANGELOG_LABEL_DISPLAY_NAME[name.toLowerCase()] ?? name
+export function toChangelogTimelineIndexItem(entry: ChangelogEntry): ChangelogTimelineIndexItem {
+ return {
+ slug: entry.slug,
+ title: entry.frontmatter.title,
+ summary: entry.summary,
+ sortDate: entry.sortDate,
+ changeType: entry.frontmatter.change_type,
+ affectedProducts: entry.frontmatter.affected_products ?? [],
+ productStage: entry.frontmatter.product_stage ?? null,
+ affectsSelfHosted: entry.frontmatter.affects_self_hosted ?? null,
+ }
}
-/** Generates the URL slug for a changelog entry: `<number>-<slugified-title>`. */
-export function changelogEntrySlug(number: number, title: string): string {
- const titlePart = title
- .toLowerCase()
- .replace(/[^a-z0-9]+/g, '-')
- .replace(/^-+|-+$/g, '')
- .slice(0, 80)
- .replace(/-+$/, '')
- return `${number}-${titlePart}`
+const CHANGE_TYPE_BADGE_VARIANT: Record<
+ ChangeType,
+ 'default' | 'warning' | 'success' | 'destructive'
+> = {
+ 'breaking-change': 'destructive',
+ deprecation: 'warning',
+ 'new-feature': 'success',
+ improvement: 'default',
+ 'bug-fix': 'warning',
+ security: 'destructive',
+ policy: 'default',
}
+export const CHANGE_TYPE_DISPLAY: Record<
+ ChangeType,
+ { label: string; badgeVariant: 'default' | 'warning' | 'success' | 'destructive' }
+> = Object.fromEntries(
+ (Object.keys(CHANGE_TYPE_LABELS) as ChangeType[]).map((type) => [
+ type,
+ { label: CHANGE_TYPE_LABELS[type], badgeVariant: CHANGE_TYPE_BADGE_VARIANT[type] },
+ ])
+) as Record<
+ ChangeType,
+ { label: string; badgeVariant: 'default' | 'warning' | 'success' | 'destructive' }
+>
+
/** Internal changelog index URL with preselected tag filter (nuqs `tags` param). */
-export function changelogTagFilterUrl(labelName: string) {
- return `/changelog?tags=${encodeURIComponent(labelName.toLowerCase())}`
+export function changelogTagFilterUrl(productSlug: string) {
+ return `/changelog?tags=${encodeURIComponent(productSlug.toLowerCase())}`
}
+/** Internal changelog index URL with preselected change-type filter (nuqs `types` param). */
+export function changelogTypeFilterUrl(changeType: ChangeType) {
+ return `/changelog?types=${encodeURIComponent(changeType)}`
+}
+
+export const CHANGE_TYPES = Object.keys(CHANGE_TYPE_DISPLAY) as ChangeType[]
+
export const CHANGELOG_PRODUCT_TAGS = changelogProductTags as Array<{
slug: string
label: string
@@ -176,11 +76,49 @@ export function isChangelogProductSlug(value: string) {
return CHANGELOG_PRODUCT_SLUG_SET.has(value)
}
+export function isChangelogChangeType(value: string): value is ChangeType {
+ return Object.prototype.hasOwnProperty.call(CHANGE_TYPE_DISPLAY, value)
+}
+
+/** Matches the `product_stage` enum in supabase/changelog's entry schema. */
+export const CHANGELOG_PRODUCT_STAGES = [
+ { slug: 'private-alpha', label: 'Private Alpha' },
+ { slug: 'public-alpha', label: 'Public Alpha' },
+ { slug: 'beta', label: 'Beta' },
+ { slug: 'public-beta', label: 'Public Beta' },
+ { slug: 'general-availability', label: 'General Availability' },
+] as const
+
+const CHANGELOG_PRODUCT_STAGE_SLUG_SET = new Set<string>(
+ CHANGELOG_PRODUCT_STAGES.map((stage) => stage.slug)
+)
+
+export function isChangelogProductStageSlug(value: string) {
+ return CHANGELOG_PRODUCT_STAGE_SLUG_SET.has(value)
+}
+
+function productStageToSlug(productStage: string) {
+ return productStage.toLowerCase().replace(/\s+/g, '-')
+}
+
+export const CHANGELOG_SELF_HOSTED_OPTIONS = [
+ { slug: 'yes', label: 'Affects self-hosted' },
+ { slug: 'no', label: "Doesn't affect self-hosted" },
+] as const
+
+const CHANGELOG_SELF_HOSTED_SLUG_SET = new Set<string>(
+ CHANGELOG_SELF_HOSTED_OPTIONS.map((option) => option.slug)
+)
+
+export function isChangelogSelfHostedSlug(value: string) {
+ return CHANGELOG_SELF_HOSTED_SLUG_SET.has(value)
+}
+
export function itemMatchesChangelogSearch(item: ChangelogTimelineIndexItem, query: string) {
const normalizedQuery = query.trim().toLowerCase()
if (!normalizedQuery) return true
if (item.title.toLowerCase().includes(normalizedQuery)) return true
- return item.labels.some((label) => label.name.toLowerCase().includes(normalizedQuery))
+ return item.affectedProducts.some((product) => product.toLowerCase().includes(normalizedQuery))
}
export function itemMatchesChangelogSelectedTags(
@@ -188,9 +126,35 @@ export function itemMatchesChangelogSelectedTags(
selectedTags: Set<string>
) {
if (selectedTags.size === 0) return true
- const labelNames = new Set(item.labels.map((label) => label.name.toLowerCase()))
+ const productSlugs = new Set(item.affectedProducts.map((product) => product.toLowerCase()))
for (const slug of selectedTags) {
- if (labelNames.has(slug.toLowerCase())) return true
+ if (productSlugs.has(slug.toLowerCase())) return true
}
return false
}
+
+export function itemMatchesChangelogSelectedTypes(
+ item: ChangelogTimelineIndexItem,
+ selectedTypes: Set<ChangeType>
+) {
+ if (selectedTypes.size === 0) return true
+ return selectedTypes.has(item.changeType)
+}
+
+export function itemMatchesChangelogSelectedStages(
+ item: ChangelogTimelineIndexItem,
+ selectedStages: Set<string>
+) {
+ if (selectedStages.size === 0) return true
+ if (!item.productStage) return false
+ return selectedStages.has(productStageToSlug(item.productStage))
+}
+
+export function itemMatchesChangelogSelectedSelfHosted(
+ item: ChangelogTimelineIndexItem,
+ selectedSelfHosted: Set<string>
+) {
+ if (selectedSelfHosted.size === 0) return true
+ const key = item.affectsSelfHosted === true ? 'yes' : 'no'
+ return selectedSelfHosted.has(key)
+}
diff --git a/apps/www/lib/rss.tsx b/apps/www/lib/rss.tsx
index 3befa67f463..30d70d8438c 100644
--- a/apps/www/lib/rss.tsx
+++ b/apps/www/lib/rss.tsx
@@ -39,8 +39,9 @@ const generateRssItem = (post: any): string => {
export type ChangelogRssItemInput = {
title: string
- url: string
+ slug: string
sortDate: string
+ affectedProducts?: string[]
}
/** Implemented in `./changelog-rss.mjs` (used by `scripts/generateStaticContent.mjs`). */
diff --git a/apps/www/package.json b/apps/www/package.json
index 404c0d41de5..901f465841e 100644
--- a/apps/www/package.json
+++ b/apps/www/package.json
@@ -118,6 +118,7 @@
"react-hook-form": "^7.71.2",
"remark-mdx": "^3.0.1",
"tailwindcss": "catalog:",
+ "tar-stream": "^3.1.7",
"tsconfig": "workspace:*",
"unist-util-visit": "^5.1.0",
"unist-util-visit-parents": "5.1.3",
diff --git a/apps/www/pages/api/changelog-discussion/[number].ts b/apps/www/pages/api/changelog-discussion/[number].ts
deleted file mode 100644
index 64ffd1d02a5..00000000000
--- a/apps/www/pages/api/changelog-discussion/[number].ts
+++ /dev/null
@@ -1,52 +0,0 @@
-import {
- CHANGELOG_CATEGORY_ID,
- createChangelogOctokit,
- fetchChangelogDiscussionByNumber,
-} from '~/lib/changelog-github'
-import { discussionDisplayDate } from '~/lib/changelog.utils'
-import { mdxSerialize } from '~/lib/mdx/mdxSerialize'
-import type { NextApiRequest, NextApiResponse } from 'next'
-
-export default async function handler(req: NextApiRequest, res: NextApiResponse) {
- if (req.method !== 'GET') {
- res.setHeader('Allow', 'GET')
- return res.status(405).json({ error: 'Method not allowed' })
- }
-
- const raw = req.query.number
- const numStr = Array.isArray(raw) ? raw[0] : raw
- const number = Number(numStr)
- if (!Number.isFinite(number)) {
- return res.status(400).json({ error: 'Invalid discussion number' })
- }
-
- try {
- const octokit = createChangelogOctokit()
- const discussion = await fetchChangelogDiscussionByNumber(
- octokit,
- 'supabase',
- 'supabase',
- number
- )
-
- if (!discussion || discussion.category?.id !== CHANGELOG_CATEGORY_ID) {
- return res.status(404).json({ error: 'Not found' })
- }
-
- const source = await mdxSerialize(discussion.body)
- const created_at = discussionDisplayDate({
- title: discussion.title,
- createdAt: discussion.createdAt,
- })
- res.setHeader('Cache-Control', 'public, max-age=900, stale-while-revalidate=900')
- return res.status(200).json({
- title: discussion.title,
- url: discussion.url,
- created_at,
- source,
- })
- } catch (e) {
- console.error(e)
- return res.status(500).json({ error: 'Failed to load discussion' })
- }
-}
diff --git a/apps/www/pages/changelog.tsx b/apps/www/pages/changelog.tsx
index 5f3092d13a9..7a260e9664a 100644
--- a/apps/www/pages/changelog.tsx
+++ b/apps/www/pages/changelog.tsx
@@ -13,25 +13,31 @@ import { useEffect, useMemo, useState } from 'react'
import { Badge, Button, cn, IconYCombinator, Input } from 'ui'
import { ChangelogLlmMarkdownButton } from '@/components/Changelog/ChangelogLlmMarkdownButton'
-import { ChangelogTimelineList } from '@/components/Changelog/ChangelogTimelineList'
+import {
+ ChangelogTimelineList,
+ ChangeTypeBadge,
+} from '@/components/Changelog/ChangelogTimelineList'
import CTABanner from '@/components/CTABanner'
import DefaultLayout from '@/components/Layouts/Default'
-import changelogProductTags from '@/data/changelog-product-tags.json'
-import {
- createChangelogOctokit,
- fetchChangelogDiscussionByNumber,
- getChangelogTimelineSortedIndex,
- type ChangelogLabel,
- type ChangelogTimelineIndexItem,
-} from '@/lib/changelog-github'
+import { getChangelogEntries, type ChangeType } from '@/lib/changelog-repo'
import {
+ CHANGE_TYPE_DISPLAY,
+ CHANGE_TYPES,
+ CHANGELOG_PRODUCT_STAGES,
CHANGELOG_PRODUCT_TAGS,
- changelogLabelDisplayName,
+ CHANGELOG_SELF_HOSTED_OPTIONS,
changelogTagFilterUrl,
- discussionDisplayDate,
+ isChangelogChangeType,
isChangelogProductSlug,
+ isChangelogProductStageSlug,
+ isChangelogSelfHostedSlug,
itemMatchesChangelogSearch,
+ itemMatchesChangelogSelectedSelfHosted,
+ itemMatchesChangelogSelectedStages,
itemMatchesChangelogSelectedTags,
+ itemMatchesChangelogSelectedTypes,
+ toChangelogTimelineIndexItem,
+ type ChangelogTimelineIndexItem,
} from '@/lib/changelog.utils'
import mdxComponents from '@/lib/mdx/mdxComponents'
import { mdxSerialize } from '@/lib/mdx/mdxSerialize'
@@ -39,13 +45,12 @@ import { mdxSerialize } from '@/lib/mdx/mdxSerialize'
const FEATURED_COUNT = 3
type FeaturedEntry = {
- number: number
slug: string
title: string
- url: string
created_at: string
source: MDXRemoteSerializeResult
- labels: ChangelogLabel[]
+ changeType: ChangelogTimelineIndexItem['changeType']
+ affectedProducts: string[]
}
type PageProps = {
@@ -55,61 +60,34 @@ type PageProps = {
}
export const getServerSideProps: GetServerSideProps<PageProps> = async ({ res }) => {
- try {
- const changelogIndex = await getChangelogTimelineSortedIndex()
- const visible = changelogIndex.filter((item) => !item.title.includes('[d]'))
- const allIndex = visible
- const firstMeta = visible.slice(0, FEATURED_COUNT)
- const restIndex = visible.slice(FEATURED_COUNT)
+ const entries = await getChangelogEntries()
+ const allIndex = entries.map(toChangelogTimelineIndexItem)
+ const firstEntries = entries.slice(0, FEATURED_COUNT)
+ const restIndex = allIndex.slice(FEATURED_COUNT)
- const octokit = createChangelogOctokit()
- const featuredResults = await Promise.all(
- firstMeta.map(
- async (meta): Promise<FeaturedEntry | { failedMeta: ChangelogTimelineIndexItem }> => {
- try {
- const discussion = await fetchChangelogDiscussionByNumber(
- octokit,
- 'supabase',
- 'supabase',
- meta.number
- )
- if (!discussion) return { failedMeta: meta }
- const source = await mdxSerialize(discussion.body)
- const created_at =
- discussionDisplayDate({
- title: discussion.title,
- createdAt: discussion.createdAt,
- }) ?? discussion.createdAt
- return {
- number: meta.number,
- slug: meta.slug,
- title: discussion.title,
- url: discussion.url ?? '',
- created_at,
- source,
- labels: meta.labels,
- }
- } catch (e) {
- console.error(e)
- return { failedMeta: meta }
- }
- }
- )
+ // Serialized independently so one entry's MDX failure doesn't drop the others.
+ const featuredResults = await Promise.allSettled(
+ firstEntries.map(
+ async (entry): Promise<FeaturedEntry> => ({
+ slug: entry.slug,
+ title: entry.frontmatter.title,
+ created_at: entry.sortDate,
+ source: await mdxSerialize(entry.bodySection),
+ changeType: entry.frontmatter.change_type,
+ affectedProducts: entry.frontmatter.affected_products ?? [],
+ })
)
+ )
+ const featured = featuredResults.flatMap((result) => {
+ if (result.status === 'rejected') {
+ console.error(result.reason)
+ return []
+ }
+ return [result.value]
+ })
- const featured = featuredResults.filter((e): e is FeaturedEntry => !('failedMeta' in e))
- const fallbackItems = featuredResults
- .filter((e): e is { failedMeta: ChangelogTimelineIndexItem } => 'failedMeta' in e)
- .map((e) => e.failedMeta)
- const restIndexWithFallbacks = fallbackItems.concat(restIndex)
-
- res.setHeader('Cache-Control', 'public, max-age=900, stale-while-revalidate=900')
- return { props: { featured, restIndex: restIndexWithFallbacks, allIndex } }
- } catch (e) {
- console.error(e)
- res.setHeader('Cache-Control', 'private, no-store, max-age=0, must-revalidate')
- return { props: { featured: [], restIndex: [], allIndex: [] } }
- }
+ res.setHeader('Cache-Control', 'public, max-age=900, stale-while-revalidate=900')
+ return { props: { featured, restIndex, allIndex } }
}
export default function ChangelogPage(props: PageProps) {
@@ -131,6 +109,18 @@ function ChangelogIndex({ featured, restIndex, allIndex }: PageProps) {
'tags',
parseAsArrayOf(parseAsString).withOptions(nuqsUrlOptions)
)
+ const [queryTypes, setQueryTypes] = useQueryState(
+ 'types',
+ parseAsArrayOf(parseAsString).withOptions(nuqsUrlOptions)
+ )
+ const [queryStages, setQueryStages] = useQueryState(
+ 'stages',
+ parseAsArrayOf(parseAsString).withOptions(nuqsUrlOptions)
+ )
+ const [querySelfHosted, setQuerySelfHosted] = useQueryState(
+ 'selfHosted',
+ parseAsArrayOf(parseAsString).withOptions(nuqsUrlOptions)
+ )
const isMobile = useBreakpoint('lg')
const [filterPanelOpen, setFilterPanelOpen] = useState(false)
@@ -143,10 +133,36 @@ function ChangelogIndex({ featured, restIndex, allIndex }: PageProps) {
}
return next
}, [queryTags])
+ const selectedTypes = useMemo(() => {
+ const next = new Set<ChangeType>()
+ for (const raw of queryTypes ?? []) {
+ if (isChangelogChangeType(raw)) next.add(raw)
+ }
+ return next
+ }, [queryTypes])
+ const selectedStages = useMemo(() => {
+ const next = new Set<string>()
+ for (const raw of queryStages ?? []) {
+ if (isChangelogProductStageSlug(raw)) next.add(raw)
+ }
+ return next
+ }, [queryStages])
+ const selectedSelfHosted = useMemo(() => {
+ const next = new Set<string>()
+ for (const raw of querySelfHosted ?? []) {
+ if (isChangelogSelfHostedSlug(raw)) next.add(raw)
+ }
+ return next
+ }, [querySelfHosted])
const hasNuqsFilters = useMemo(
- () => filterSearch.trim().length > 0 || selectedTags.size > 0,
- [filterSearch, selectedTags]
+ () =>
+ filterSearch.trim().length > 0 ||
+ selectedTags.size > 0 ||
+ selectedTypes.size > 0 ||
+ selectedStages.size > 0 ||
+ selectedSelfHosted.size > 0,
+ [filterSearch, selectedTags, selectedTypes, selectedStages, selectedSelfHosted]
)
useEffect(() => {
@@ -157,15 +173,21 @@ function ChangelogIndex({ featured, restIndex, allIndex }: PageProps) {
const q = filterSearch
const hasSearch = q.trim().length > 0
const hasTags = selectedTags.size > 0
- if (!hasSearch && !hasTags) return null
+ const hasTypes = selectedTypes.size > 0
+ const hasStages = selectedStages.size > 0
+ const hasSelfHosted = selectedSelfHosted.size > 0
+ if (!hasSearch && !hasTags && !hasTypes && !hasStages && !hasSelfHosted) return null
return allIndex
.filter(
(item) =>
itemMatchesChangelogSearch(item, q) &&
- itemMatchesChangelogSelectedTags(item, selectedTags)
+ itemMatchesChangelogSelectedTags(item, selectedTags) &&
+ itemMatchesChangelogSelectedTypes(item, selectedTypes) &&
+ itemMatchesChangelogSelectedStages(item, selectedStages) &&
+ itemMatchesChangelogSelectedSelfHosted(item, selectedSelfHosted)
)
.sort((a, b) => dayjs(b.sortDate).diff(dayjs(a.sortDate)))
- }, [allIndex, filterSearch, selectedTags])
+ }, [allIndex, filterSearch, selectedTags, selectedTypes, selectedStages, selectedSelfHosted])
const toggleProductTag = (slug: string) => {
const current = (queryTags ?? []).filter(isChangelogProductSlug)
@@ -174,12 +196,36 @@ function ChangelogIndex({ featured, restIndex, allIndex }: PageProps) {
void setQueryTags(next.length > 0 ? next : null)
}
+ const toggleChangeType = (type: ChangeType) => {
+ const current = (queryTypes ?? []).filter(isChangelogChangeType)
+ const has = current.includes(type)
+ const next = has ? current.filter((t) => t !== type) : [...current, type]
+ void setQueryTypes(next.length > 0 ? next : null)
+ }
+
+ const toggleProductStage = (slug: string) => {
+ const current = (queryStages ?? []).filter(isChangelogProductStageSlug)
+ const has = current.includes(slug)
+ const next = has ? current.filter((s) => s !== slug) : [...current, slug]
+ void setQueryStages(next.length > 0 ? next : null)
+ }
+
+ const toggleSelfHosted = (slug: string) => {
+ const current = (querySelfHosted ?? []).filter(isChangelogSelfHostedSlug)
+ const has = current.includes(slug)
+ const next = has ? current.filter((s) => s !== slug) : [...current, slug]
+ void setQuerySelfHosted(next.length > 0 ? next : null)
+ }
+
const clearFilters = () => {
void setQuerySearch(null)
void setQueryTags(null)
+ void setQueryTypes(null)
+ void setQueryStages(null)
+ void setQuerySelfHosted(null)
}
- const isSingleQueryTag = queryTags?.length === 1
+ const singleSelectedTag = selectedTags.size === 1 ? [...selectedTags][0] : null
const TITLE = 'Changelog'
const DESCRIPTION = 'New updates and improvements to Supabase'
@@ -239,13 +285,13 @@ function ChangelogIndex({ featured, restIndex, allIndex }: PageProps) {
>
<Link
href={
- isSingleQueryTag
- ? `/changelog-rss/${queryTags?.[0]}.xml`
+ singleSelectedTag
+ ? `/changelog-rss/${singleSelectedTag}.xml`
: '/changelog-rss.xml'
}
>
- {isSingleQueryTag &&
- changelogProductTags.find((tag) => tag.slug === queryTags?.[0])?.label +
+ {singleSelectedTag &&
+ CHANGELOG_PRODUCT_TAGS.find((tag) => tag.slug === singleSelectedTag)?.label +
' '}{' '}
RSS
</Link>
@@ -272,7 +318,11 @@ function ChangelogIndex({ featured, restIndex, allIndex }: PageProps) {
void setQuerySearch(v.length === 0 ? null : v)
}}
/>
- {(filterSearch.trim().length > 0 || selectedTags.size > 0) && (
+ {(filterSearch.trim().length > 0 ||
+ selectedTags.size > 0 ||
+ selectedTypes.size > 0 ||
+ selectedStages.size > 0 ||
+ selectedSelfHosted.size > 0) && (
<Button
variant="outline"
size="tiny"
@@ -285,16 +335,47 @@ function ChangelogIndex({ featured, restIndex, allIndex }: PageProps) {
)}
</div>
</div>
- <div>
- <p className="sr-only">Filter by tags</p>
+ <div className="py-1">
+ <p className="text-foreground-lighter text-xs font-mono uppercase tracking-wide">
+ Change types
+ </p>
<div className="flex flex-wrap gap-1.5">
+ {CHANGE_TYPES.map((type) => {
+ const { label } = CHANGE_TYPE_DISPLAY[type]
+ const on = selectedTypes.has(type)
+ return (
+ <button
+ tabIndex={0}
+ key={type}
+ type="button"
+ aria-pressed={on}
+ onClick={() => toggleChangeType(type)}
+ >
+ <Badge
+ variant={on ? 'success' : 'default'}
+ className={cn(!on && 'hover:text-foreground')}
+ >
+ {label}
+ </Badge>
+ </button>
+ )
+ })}
+ </div>
+ </div>
+ <div className="border-default border-t" role="presentation" />
+ <div className="py-1">
+ <p className="text-foreground-lighter text-xs font-mono uppercase tracking-wide">
+ Products
+ </p>
+ <div className="flex flex-wrap gap-x-1.5 gap-y-1">
{CHANGELOG_PRODUCT_TAGS.map(({ slug, label }) => {
const on = selectedTags.has(slug)
return (
<button
- tabIndex={0}
key={slug}
+ tabIndex={0}
type="button"
+ aria-pressed={on}
onClick={() => toggleProductTag(slug)}
>
<Badge
@@ -308,6 +389,60 @@ function ChangelogIndex({ featured, restIndex, allIndex }: PageProps) {
})}
</div>
</div>
+ <div className="border-default border-t" role="presentation" />
+ <div className="py-1">
+ <p className="text-foreground-lighter text-xs font-mono uppercase tracking-wide">
+ Product stage
+ </p>
+ <div className="flex flex-wrap gap-1.5">
+ {CHANGELOG_PRODUCT_STAGES.map(({ slug, label }) => {
+ const on = selectedStages.has(slug)
+ return (
+ <button
+ tabIndex={0}
+ key={slug}
+ type="button"
+ aria-pressed={on}
+ onClick={() => toggleProductStage(slug)}
+ >
+ <Badge
+ variant={on ? 'success' : 'default'}
+ className={cn(!on && 'hover:text-foreground')}
+ >
+ {label}
+ </Badge>
+ </button>
+ )
+ })}
+ </div>
+ </div>
+ <div className="border-default border-t" role="presentation" />
+ <div className="py-1">
+ <p className="text-foreground-lighter text-xs font-mono uppercase tracking-wide">
+ Self-hosted
+ </p>
+ <div className="flex flex-wrap gap-1.5">
+ {CHANGELOG_SELF_HOSTED_OPTIONS.map(({ slug, label }) => {
+ const on = selectedSelfHosted.has(slug)
+ return (
+ <button
+ tabIndex={0}
+ key={slug}
+ type="button"
+ aria-pressed={on}
+ onClick={() => toggleSelfHosted(slug)}
+ >
+ <Badge
+ variant={on ? 'success' : 'default'}
+ className={cn(!on && 'hover:text-foreground')}
+ >
+ {label}
+ </Badge>
+ </button>
+ )
+ })}
+ </div>
+ </div>
</div>
)}
@@ -358,8 +493,8 @@ function ChangelogIndex({ featured, restIndex, allIndex }: PageProps) {
<div className="grid">
{featured.map((entry) => (
<div
- key={entry.number}
- id={entry.number.toString()}
+ key={entry.slug}
+ id={entry.slug}
className="grid pb-12 lg:grid-cols-12 lg:gap-8 lg:pb-36 scroll-mt-32"
>
<div className="col-span-12 lg:ml-[-31px] mb-8 lg:mb-0 self-start z-10 sticky top-[65px] lg:top-32 lg:col-span-4">
@@ -375,24 +510,12 @@ function ChangelogIndex({ featured, restIndex, allIndex }: PageProps) {
</h3>
</Link>
)}
- <p className="text-foreground-lighter font-mono text-xs">
- {dayjs(entry.created_at).format('MMM D, YYYY')}
- </p>
- {entry.labels && entry.labels.length > 0 && (
- <div className="flex flex-wrap gap-1.5 pt-1.5">
- {entry.labels.map((label) => (
- <a
- key={`${entry.number}-${label.name}`}
- href={changelogTagFilterUrl(label.name)}
- className="group inline-flex no-underline focus-ring rounded-md"
- >
- <Badge className="group-hover:text-foreground-light text-foreground-lighter group-hover:border-foreground-muted px-1.5 py-px text-[11px] tracking-normal lowercase">
- {changelogLabelDisplayName(label.name)}
- </Badge>
- </a>
- ))}
- </div>
- )}
+ <div className="flex items-center gap-2 mb-2">
+ <p className="text-foreground-lighter font-mono text-xs">
+ {dayjs(entry.created_at).format('MMM D, YYYY')}
+ </p>
+ </div>
+ <ChangeTypeBadge type={entry.changeType} />
</div>
</div>
</div>
@@ -404,6 +527,21 @@ function ChangelogIndex({ featured, restIndex, allIndex }: PageProps) {
<MDXClient {...entry.source} components={mdxComponents('blog')} />
)}
</article>
+ {entry.affectedProducts.length > 0 && (
+ <div className="flex flex-wrap gap-1.5 pt-2">
+ {entry.affectedProducts.map((product) => (
+ <a
+ key={`${entry.slug}-${product}`}
+ href={changelogTagFilterUrl(product)}
+ className="group inline-flex no-underline focus-visible:ring-brand-default rounded-md focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-hidden"
+ >
+ <Badge className="group-hover:text-foreground-light text-foreground-lighter group-hover:border-foreground-muted px-1.5 py-px text-[11px] tracking-normal lowercase">
+ {product}
+ </Badge>
+ </a>
+ ))}
+ </div>
+ )}
</div>
</div>
))}
@@ -416,7 +554,7 @@ function ChangelogIndex({ featured, restIndex, allIndex }: PageProps) {
)}
<div className="hidden lg:grid">
<div className="col-span-12 -ml-8 mb-8 lg:mb-0 self-start lg:sticky lg:top-0 lg:col-span-4 lg:-mt-20 lg:pt-20">
- <div className="flex w-full items-baseline border-b pb-4 lg:gap-4 lg:border-none lg:pb-0">
+ <div className="flex w-full items-baseline border-b pb-4 lg:gap-8 lg:border-none lg:pb-0">
<Link
href="https://www.ycombinator.com/companies/supabase"
target="_blank"
diff --git a/apps/www/pages/changelog/[slug].tsx b/apps/www/pages/changelog/[slug].tsx
index 2242c36e77c..98b144d9e49 100644
--- a/apps/www/pages/changelog/[slug].tsx
+++ b/apps/www/pages/changelog/[slug].tsx
@@ -8,27 +8,19 @@ import Link from 'next/link'
import { ChangelogDetailSidebar } from '@/components/Changelog/ChangelogDetailSidebar'
import CTABanner from '@/components/CTABanner'
import DefaultLayout from '@/components/Layouts/Default'
-import {
- CHANGELOG_CATEGORY_ID,
- createChangelogOctokit,
- fetchChangelogDiscussionByNumber,
- type ChangelogLabel,
-} from '@/lib/changelog-github'
-import { changelogEntrySlug, discussionDisplayDate } from '@/lib/changelog.utils'
+import { getChangelogEntries, type ChangelogEntryFrontmatter } from '@/lib/changelog-repo'
import mdxComponents from '@/lib/mdx/mdxComponents'
import { mdxSerialize } from '@/lib/mdx/mdxSerialize'
type PageProps = {
title: string
- url: string
created_at: string
- number: number
slug: string
+ frontmatter: ChangelogEntryFrontmatter
source: MDXRemoteSerializeResult
- labels: ChangelogLabel[]
}
-const ChangelogDetailPage = ({ title, url, created_at, slug, source, labels }: PageProps) => (
+const ChangelogDetailPage = ({ title, created_at, slug, frontmatter, source }: PageProps) => (
<>
<Head>
<link rel="alternate" type="text/markdown" href={`/changelog/${slug}.md`} />
@@ -54,16 +46,18 @@ const ChangelogDetailPage = ({ title, url, created_at, slug, source, labels }: P
</nav>
<header className="border-default mb-8 flex flex-col gap-2 border-b pb-6">
<h1 className="h1 text-2xl sm:text-3xl">{title}</h1>
- <p className="text-foreground-lighter font-mono text-xs">
- {dayjs(created_at).format('MMM D, YYYY')}
- </p>
+ <div className="flex items-center gap-2">
+ <p className="text-foreground-lighter font-mono text-xs">
+ {dayjs(created_at).format('MMM D, YYYY')}
+ </p>
+ </div>
</header>
<div className="grid grid-cols-1 gap-8 lg:grid-cols-12 lg:gap-10 mb-8 lg:mb-20">
<div className="min-w-0 lg:col-span-8">
<article className="prose prose-docs max-w-none wrap-break-word [&>*:first-child:not(style):not(script)]:mt-0 [&>style:first-child+*]:mt-0 [&>script:first-child+*]:mt-0 [&>*:last-child:not(style):not(script)]:mb-0">
{'error' in source ? (
- <p>Error rendering blog post: {source.error.message}</p>
+ <p>Error rendering changelog entry: {source.error.message}</p>
) : (
<MDXClient {...source} components={mdxComponents('blog')} />
)}
@@ -72,7 +66,7 @@ const ChangelogDetailPage = ({ title, url, created_at, slug, source, labels }: P
<aside className="border-default border-t pt-6 lg:col-span-4 lg:border-t-0 lg:pl-4 lg:pt-0">
<div className="thin-scrollbar lg:sticky lg:top-24 lg:max-h-[calc(100vh-8rem)] lg:overflow-y-auto">
- <ChangelogDetailSidebar slug={slug} url={url} labels={labels} />
+ <ChangelogDetailSidebar slug={slug} frontmatter={frontmatter} />
</div>
</aside>
</div>
@@ -88,53 +82,23 @@ export const getStaticPaths: GetStaticPaths = async () => {
export const getStaticProps: GetStaticProps<PageProps> = async ({ params }) => {
const raw = params?.slug
- const slugStr = Array.isArray(raw) ? raw[0] : (raw ?? '')
- // The slug always starts with the numeric discussion number.
- const number = parseInt(slugStr, 10)
- if (!Number.isFinite(number) || number <= 0) return { notFound: true }
-
- try {
- const octokit = createChangelogOctokit()
- const discussion = await fetchChangelogDiscussionByNumber(
- octokit,
- 'supabase',
- 'supabase',
- number
- )
-
- if (!discussion || discussion.category?.id !== CHANGELOG_CATEGORY_ID) {
- return { notFound: true }
- }
-
- const expectedSlug = changelogEntrySlug(number, discussion.title)
+ const slug = Array.isArray(raw) ? raw[0] : (raw ?? '')
- // Redirect number-only or mismatched slugs to the canonical slug URL.
- if (slugStr !== expectedSlug) {
- return { redirect: { destination: `/changelog/${expectedSlug}`, permanent: true } }
- }
+ const entries = await getChangelogEntries()
+ const entry = entries.find((e) => e.slug === slug)
+ if (!entry) return { notFound: true }
- const source = await mdxSerialize(discussion.body)
- const created_at =
- discussionDisplayDate({
- title: discussion.title,
- createdAt: discussion.createdAt,
- }) ?? discussion.createdAt
+ const source = await mdxSerialize(entry.bodySection)
- return {
- props: {
- title: discussion.title,
- url: discussion.url,
- created_at,
- number,
- slug: expectedSlug,
- source,
- labels: discussion.labels?.nodes ?? [],
- },
- revalidate: 900,
- }
- } catch (e) {
- console.error(e)
- return { notFound: true }
+ return {
+ props: {
+ title: entry.frontmatter.title,
+ created_at: entry.sortDate,
+ slug: entry.slug,
+ frontmatter: entry.frontmatter,
+ source,
+ },
+ revalidate: 900,
}
}
diff --git a/apps/www/scripts/data/changelog-deleted-discussions.json b/apps/www/scripts/data/changelog-deleted-discussions.json
deleted file mode 100644
index d4d97616816..00000000000
--- a/apps/www/scripts/data/changelog-deleted-discussions.json
+++ /dev/null
@@ -1,21 +0,0 @@
-[
- { "title": "Platform updates: October 2023", "createdAt": "2023-11-06T16:25:12Z" },
- { "title": "Platform update September 2023", "createdAt": "2023-10-06T09:23:56Z" },
- { "title": "Platform updates: August 2023", "createdAt": "2023-09-08T13:00:39Z" },
- { "title": "Platform updates June 2023", "createdAt": "2023-07-07T16:09:32Z" },
- { "title": "Platform updates: May 2023", "createdAt": "2023-06-09T16:40:16Z" },
- { "title": "Platform updates: April 2023", "createdAt": "2023-05-10T18:40:02Z" },
- { "title": "Platform Update February 2023", "createdAt": "2023-03-09T12:06:01Z" },
- { "title": "Platform update January 2023", "createdAt": "2023-02-08T18:29:41Z" },
- { "title": "Platform Updates November 2022", "createdAt": "2022-12-08T12:00:48Z" },
- { "title": "Platform updates: October 2022", "createdAt": "2022-11-02T16:07:47Z" },
- { "title": "Platform Update September 2022", "createdAt": "2022-10-07T10:18:21Z" },
- { "title": "Platform updates: 30 Nov 2021", "createdAt": "2021-11-30T10:06:55Z" },
- { "title": "October Beta 2021", "createdAt": "2021-11-08T13:14:35Z" },
- { "title": "September Beta 2021", "createdAt": "2021-10-04T18:10:57Z" },
- { "title": "August Beta 2021", "createdAt": "2021-09-13T09:47:18Z" },
- { "title": "July Beta 2021", "createdAt": "2021-08-12T13:46:14Z" },
- { "title": "June Beta 2021", "createdAt": "2021-07-04T13:23:35Z" },
- { "title": "May Beta 2021", "createdAt": "2021-06-10T11:53:14Z" },
- { "title": "April Beta 2021", "createdAt": "2021-05-05T05:17:27Z" }
-]
diff --git a/apps/www/scripts/generateStaticContent.mjs b/apps/www/scripts/generateStaticContent.mjs
index 0fac6a1eaed..04f694b38c0 100644
--- a/apps/www/scripts/generateStaticContent.mjs
+++ b/apps/www/scripts/generateStaticContent.mjs
@@ -378,198 +378,140 @@ try {
console.warn('Error generating RSS feed:', error)
}
-// Changelog RSS → public/changelog-rss.xml (same GitHub App + category as lib/changelog-github.ts)
-try {
- const appId = process.env.GITHUB_CHANGELOG_APP_ID
- const installationId = process.env.GITHUB_CHANGELOG_APP_INSTALLATION_ID
- const privateKey = process.env.GITHUB_CHANGELOG_APP_PRIVATE_KEY
+// Changelog RSS + changelog.md → sourced from supabase/changelog entries/*.md (private repo).
+// Missing secret: warns and skips outside Vercel, but fails Vercel builds so they can't
+// publish stale generated changelog files. Generic CI (typecheck/lint on GitHub Actions)
+// has no access to this secret and isn't publishing anything, so it only warns too.
+async function generateChangelogContent() {
+ const appId = process.env.CHANGELOG_SYNC_APP_ID
+ const installationId = process.env.CHANGELOG_SYNC_APP_INSTALLATION_ID
+ const privateKey = process.env.CHANGELOG_SYNC_APP_PRIVATE_KEY
if (!appId || !installationId || !privateKey) {
- console.warn('Skipping changelog RSS: missing GITHUB_CHANGELOG_APP_* env vars')
- } else {
- const { createAppAuth } = await import('@octokit/auth-app')
- const { Octokit } = await import('@octokit/core')
- const { paginateGraphql } = await import('@octokit/plugin-paginate-graphql')
-
- const { generateChangelogRssXml, generateChangelogTagRssXml, labelToFileSlug, changelogEntrySlug } =
- await import('../lib/changelog-rss.mjs')
- const rewritesPath = path.join(__dirname, 'data/changelog-deleted-discussions.json')
- const rewrites = JSON.parse(await fs.readFile(rewritesPath, 'utf8'))
- const discussionDisplayDate = (item) => {
- const dateRewrite = rewrites.find(
- (r) => item.title && r.title && item.title.includes(r.title)
- )
- return dateRewrite ? dateRewrite.createdAt : item.createdAt
+ if (process.env.VERCEL) {
+ throw new Error('CHANGELOG_SYNC_APP_* env vars not set — cannot generate changelog content')
}
+ console.warn('⚠️ CHANGELOG_SYNC_APP_* env vars not set — skipping changelog RSS/md generation')
+ return
+ }
- const CHANGELOG_CATEGORY_ID = 'DIC_kwDODMpXOc4CAFUr'
-
- const changelogQuery = `
- query changelogDiscussionMetadata($cursor: String, $owner: String!, $repo: String!, $categoryId: ID!) {
- repository(owner: $owner, name: $repo) {
- discussions(
- first: 100
- after: $cursor
- categoryId: $categoryId
- orderBy: { field: CREATED_AT, direction: DESC }
- ) {
- nodes {
- number
- title
- body
- createdAt
- url
- labels(first: 25) {
- nodes {
- name
- }
- }
- }
- pageInfo {
- hasNextPage
- endCursor
- }
- }
- }
- }
- `
-
- const ExtendedOctokit = Octokit.plugin(paginateGraphql)
- const octokit = new ExtendedOctokit({
- authStrategy: createAppAuth,
- auth: {
- appId,
- installationId,
- privateKey: privateKey.replace(/\\n/g, '\n'),
- },
- })
+ const { getPublishedChangelogEntries, fetchChangelogEntryFilesFromTarball, CHANGE_TYPE_LABELS } =
+ await import('../lib/changelog-entries-core.mjs')
+ const { generateChangelogRssXml, generateChangelogTagRssXml, labelToFileSlug } = await import(
+ '../lib/changelog-rss.mjs'
+ )
+ const { createAppAuth } = await import('@octokit/auth-app')
+ const { Octokit } = await import('@octokit/core')
+ const octokit = new Octokit({
+ authStrategy: createAppAuth,
+ auth: { appId, installationId, privateKey: privateKey.replace(/\\n/g, '\n') },
+ })
- const collected = []
- let cursor = null
- let hasNextPage = true
- while (hasNextPage) {
- const {
- repository: {
- discussions: { nodes, pageInfo },
- },
- } = await octokit.graphql(changelogQuery, {
- owner: 'supabase',
- repo: 'supabase',
- categoryId: CHANGELOG_CATEGORY_ID,
- cursor,
- })
- collected.push(...nodes)
- hasNextPage = pageInfo.hasNextPage
- cursor = pageInfo.endCursor
+ // Single tarball request — fetching each entry file individually trips
+ // GitHub's secondary rate limit once the entries directory gets large.
+ const files = await fetchChangelogEntryFilesFromTarball(octokit, {
+ owner: 'supabase',
+ repo: 'changelog',
+ entriesPath: 'entries',
+ })
+ const entries = getPublishedChangelogEntries(files)
+
+ const rssEntries = entries.map((entry) => ({
+ slug: entry.slug,
+ title: entry.frontmatter.title,
+ sortDate: entry.sortDate,
+ affectedProducts: entry.frontmatter.affected_products ?? [],
+ }))
+
+ const changelogXml = generateChangelogRssXml(rssEntries)
+ const changelogRssPath = path.join(__dirname, '../public/changelog-rss.xml')
+ await fs.writeFile(changelogRssPath, changelogXml.trim(), 'utf8')
+ console.log(`✅ Generated changelog RSS with ${entries.length} entries`)
+
+ // Per-tag feeds → public/changelog-rss/<label-slug>.xml
+ const productTagsPath = path.join(__dirname, '../data/changelog-product-tags.json')
+ const productTags = JSON.parse(await fs.readFile(productTagsPath, 'utf8'))
+ const tagFeedsDir = path.join(__dirname, '../public/changelog-rss')
+ // Clear first so a renamed/removed product tag doesn't leave a stale feed file behind.
+ await fs.rm(tagFeedsDir, { recursive: true, force: true })
+ await fs.mkdir(tagFeedsDir, { recursive: true })
+ const tagFilenames = productTags.map(({ label }) => `${labelToFileSlug(label)}.xml`)
+ const tagResults = await Promise.allSettled(
+ productTags.map(async ({ label }) => {
+ const fileSlug = labelToFileSlug(label)
+ const tagXml = generateChangelogTagRssXml(rssEntries, { displayLabel: label })
+ await fs.writeFile(path.join(tagFeedsDir, `${fileSlug}.xml`), tagXml.trim(), 'utf8')
+ })
+ )
+ const failedTagFeeds = tagResults.flatMap((result, i) =>
+ result.status === 'rejected' ? [{ file: tagFilenames[i], reason: result.reason }] : []
+ )
+ const succeeded = tagResults.length - failedTagFeeds.length
+ console.log(`✅ Generated ${succeeded}/${productTags.length} per-tag changelog RSS feeds`)
+ if (failedTagFeeds.length > 0) {
+ for (const { file, reason } of failedTagFeeds) {
+ console.error(`Failed to write changelog-rss/${file}:`, reason)
}
-
- const entries = collected.map((item) => ({
- number: item.number,
- slug: changelogEntrySlug(item.number, item.title),
- title: item.title,
- url: item.url,
- sortDate: discussionDisplayDate({ title: item.title, createdAt: item.createdAt }),
- labels: (item.labels?.nodes ?? []).map((l) => l.name.toLowerCase()),
- body: item.body ?? '',
- }))
-
- const changelogXml = generateChangelogRssXml(entries)
- const changelogRssPath = path.join(__dirname, '../public/changelog-rss.xml')
- await fs.writeFile(changelogRssPath, changelogXml.trim(), 'utf8')
- const visibleCount = entries.filter((e) => !e.title.includes('[d]')).length
- console.log(`✅ Generated changelog RSS with ${visibleCount} entries`)
-
- // Per-tag feeds → public/changelog-rss/<label-slug>.xml
- const productTagsPath = path.join(__dirname, '../data/changelog-product-tags.json')
- const productTags = JSON.parse(await fs.readFile(productTagsPath, 'utf8'))
- const tagFeedsDir = path.join(__dirname, '../public/changelog-rss')
- await fs.mkdir(tagFeedsDir, { recursive: true })
- const tagResults = await Promise.allSettled(
- productTags.map(async ({ slug, label }) => {
- const fileSlug = labelToFileSlug(label)
- const tagXml = generateChangelogTagRssXml(entries, {
- githubLabelSlug: slug,
- displayLabel: label,
- })
- await fs.writeFile(path.join(tagFeedsDir, `${fileSlug}.xml`), tagXml.trim(), 'utf8')
- })
+ throw new Error(
+ `Failed to generate ${failedTagFeeds.length}/${productTags.length} per-tag changelog RSS feeds`
)
- const succeeded = tagResults.filter((r) => r.status === 'fulfilled').length
- console.log(`✅ Generated ${succeeded}/${productTags.length} per-tag changelog RSS feeds`)
-
- // LLM-friendly changelog markdown index (RSS remains canonical syndication format).
- const visibleEntries = entries.filter((entry) => !entry.title.includes('[d]'))
-
- /**
- * Extracts the first meaningful paragraph from a markdown body.
- * Skips headings, code fences, HTML blocks, and empty lines.
- */
- const extractSummary = (body) => {
- if (!body) return ''
- for (const para of body.split(/\n{2,}/)) {
- const trimmed = para.trim()
- if (
- !trimmed ||
- trimmed.startsWith('#') ||
- trimmed.startsWith('```') ||
- trimmed.startsWith('<') ||
- trimmed.startsWith('|') ||
- trimmed.startsWith('---')
- ) continue
- const oneLiner = trimmed.replace(/\n/g, ' ')
- return oneLiner.length > 200 ? oneLiner.slice(0, 200).replace(/\s+\S*$/, '') + '…' : oneLiner
- }
- return ''
- }
+ }
- const mdSections = visibleEntries.map((entry) => {
- const date = dayjs(entry.sortDate).isValid() ? dayjs(entry.sortDate).format('YYYY-MM-DD') : ''
- const labels = (entry.labels ?? []).join(', ')
- const meta = [date, labels, `[supabase.com/changelog/${entry.slug}](https://supabase.com/changelog/${entry.slug})`]
- .filter(Boolean)
- .join(' · ')
- const summary = extractSummary(entry.body)
- return [`## ${entry.title}`, meta, summary].filter(Boolean).join('\n\n')
- })
- const changelogMd = `# Supabase Changelog\n\n${mdSections.join('\n\n---\n\n')}\n`
- const changelogMdPath = path.join(__dirname, '../public/changelog.md')
- await fs.writeFile(changelogMdPath, changelogMd, 'utf8')
- console.log(`✅ Generated changelog.md (${visibleEntries.length} entries)`)
-
- // One markdown file per entry → /changelog/<number>.md (same content shape as the web page body).
- const changelogEntryMdDir = path.join(__dirname, '../public/changelog')
- await fs.mkdir(changelogEntryMdDir, { recursive: true })
- for (const entry of visibleEntries) {
- const published = dayjs(entry.sortDate).isValid()
- ? dayjs(entry.sortDate).format('YYYY-MM-DD')
- : ''
- const titleLine = String(entry.title ?? '')
- .replace(/\n/g, ' ')
- .trim()
- const labelsYaml = (entry.labels ?? []).map((l) => ` - ${l}`).join('\n')
- const pageUrl = `https://supabase.com/changelog/${entry.slug}`
- const entryMd = `---
-number: ${entry.number}
+ // LLM-friendly changelog markdown index (RSS remains canonical syndication format).
+ const mdSections = entries.map((entry) => {
+ const date = dayjs(entry.sortDate).isValid() ? dayjs(entry.sortDate).format('YYYY-MM-DD') : ''
+ const changeType = CHANGE_TYPE_LABELS[entry.frontmatter.change_type] ?? entry.frontmatter.change_type
+ const products = (entry.frontmatter.affected_products ?? []).join(', ')
+ const meta = [
+ date,
+ changeType,
+ products,
+ `[supabase.com/changelog/${entry.slug}](https://supabase.com/changelog/${entry.slug})`,
+ ]
+ .filter(Boolean)
+ .join(' · ')
+ return [`## ${entry.frontmatter.title}`, meta, entry.summary].filter(Boolean).join('\n\n')
+ })
+ const changelogMd = `# Supabase Changelog\n\n${mdSections.join('\n\n---\n\n')}\n`
+ const changelogMdPath = path.join(__dirname, '../public/changelog.md')
+ await fs.writeFile(changelogMdPath, changelogMd, 'utf8')
+ console.log(`✅ Generated changelog.md (${entries.length} entries)`)
+
+ // One markdown file per entry → /changelog/<slug>.md (Body section only — internal notes never included).
+ const changelogEntryMdDir = path.join(__dirname, '../public/changelog')
+ // Clear first so a renamed/unpublished entry doesn't leave a stale file behind.
+ await fs.rm(changelogEntryMdDir, { recursive: true, force: true })
+ await fs.mkdir(changelogEntryMdDir, { recursive: true })
+ for (const entry of entries) {
+ const published = dayjs(entry.sortDate).isValid()
+ ? dayjs(entry.sortDate).format('YYYY-MM-DD')
+ : ''
+ const titleLine = String(entry.frontmatter.title ?? '')
+ .replace(/\n/g, ' ')
+ .trim()
+ const productsYaml = (entry.frontmatter.affected_products ?? [])
+ .map((p) => ` - ${p}`)
+ .join('\n')
+ const pageUrl = `https://supabase.com/changelog/${entry.slug}`
+ const entryMd = `---
slug: ${entry.slug}
published: ${published}
-discussion: ${entry.url}
-labels:
-${labelsYaml || ' []'}
+change_type: ${entry.frontmatter.change_type}
+affected_products:
+${productsYaml || ' []'}
page: ${pageUrl}
---
# ${titleLine}
-${entry.body ?? ''}
+${entry.bodySection}
`
- await fs.writeFile(
- path.join(changelogEntryMdDir, `${entry.slug}.md`),
- entryMd.trim() + '\n',
- 'utf8'
- )
- }
- console.log(`✅ Generated changelog/*.md (${visibleEntries.length} files)`)
+ await fs.writeFile(
+ path.join(changelogEntryMdDir, `${entry.slug}.md`),
+ entryMd.trim() + '\n',
+ 'utf8'
+ )
}
-} catch (error) {
- console.warn('Error generating changelog RSS:', error)
+ console.log(`✅ Generated changelog/*.md (${entries.length} files)`)
}
+await generateChangelogContent()
diff --git a/apps/www/turbo.jsonc b/apps/www/turbo.jsonc
index e4ba1802468..728b752ffc1 100644
--- a/apps/www/turbo.jsonc
+++ b/apps/www/turbo.jsonc
@@ -57,6 +57,9 @@
"GITHUB_CHANGELOG_APP_INSTALLATION_ID",
"GITHUB_CHANGELOG_APP_REST_KEY",
"GITHUB_CHANGELOG_APP_PRIVATE_KEY",
+ "CHANGELOG_SYNC_APP_ID",
+ "CHANGELOG_SYNC_APP_INSTALLATION_ID",
+ "CHANGELOG_SYNC_APP_PRIVATE_KEY",
"NEXT_PUBLIC_EMAIL_ABUSE_URL",
"EMAIL_ABUSE_SERVICE_KEY",
"HUBSPOT_PORTAL_ID",
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 783197513ee..95702943339 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -1932,6 +1932,9 @@ importers:
tailwindcss:
specifier: 'catalog:'
version: 4.2.4
+ tar-stream:
+ specifier: ^3.1.7
+ version: 3.1.7
tsconfig:
specifier: workspace:*
version: link:../../packages/tsconfig