Files
supabase/apps/www/pages/customers/[slug].tsx
supabase-vercel-tedd[bot] 1f6ee9e8b9 chore(www): replace markdown-toc with the local TOC helper to drop vulnerable toml (#53879)
## Problem

`markdown-toc@1.2.0` (its latest release) depends on
`gray-matter@2.1.1`, which pins `toml@^2.3.2`. That leaves `toml@2.3.6`
in the lockfile, and `pnpm audit` flags it with several high-severity
advisories (fixed in `>=5.0.1`). Neither parent has a release that moves
off toml 2.x, so a lockfile-only bump or a temporary override can't
remove it.

## Solution

The customer story (`/customers/[slug]`) and alternatives
(`/alternatives/[slug]`) pages built a `toc` prop at build time, but
neither page nor `LayoutComparison` ever read it. This PR removes that
prop, the `markdown-toc` dependency, and `apps/www/lib/toc.ts`, which
had no other callers. With `markdown-toc` gone from
`apps/www/package.json`, `gray-matter@2.1.1` and `toml` leave the
dependency tree. www keeps using `gray-matter@4.0.3` directly. The
lockfile change only removes entries.

## Review instructions

1. Run `pnpm why toml --recursive` and check it finds no `toml`.
2. Run `pnpm tsx scripts/fix-audit-vulnerability.ts --json` and check
`toml` is not in `vulnerabilities`.
3. Open a customer story on the preview, for example
`/customers/asap-work`, and an alternatives page, for example
`/alternatives/supabase-vs-auth0`. Each page builds and renders as it
does on production.

Checks run: `pnpm install --frozen-lockfile`, `pnpm run typecheck` in
`apps/www` (next typegen + tsc), eslint on both changed pages (no
errors), and `oxfmt --check` on the changed files.

## Checklist

Check all before review:

- [ ] I have read
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
- [ ] If I wrote a new docs topic or edited an existing topic, I used
the `/write-the-docs` or `/edit-the-docs` skill, which applies the docs
[style
guide](https://github.com/supabase/supabase/tree/master/apps/docs/style-guide)


[FE-5192](https://linear.app/supabase/issue/FE-5192/bump-a-single-vulnerable-dependency)

## Feedback for Tedd

To ask Tedd for a change to this PR, reply in Tedd's session on
[FE-5192](https://linear.app/supabase/issue/FE-5192/bump-a-single-vulnerable-dependency).
Tedd doesn't read comments on this PR.

---------

Co-authored-by: supabase-vercel-tedd[bot] <336548405+supabase-vercel-tedd[bot]@users.noreply.github.com>
2026-11-24 16:44:02 +01:00

248 lines
8.5 KiB
TypeScript

import CTABanner from '~/components/CTABanner'
import DefaultLayout from '~/components/Layouts/Default'
import { breadcrumbs } from '~/lib/breadcrumbs'
import { SITE_ORIGIN } from '~/lib/constants'
import { breadcrumbListSchema, serializeJsonLd } from '~/lib/json-ld'
import mdxComponents from '~/lib/mdx/mdxComponents'
import { mdxSerialize } from '~/lib/mdx/mdxSerialize'
import { getAllPostSlugs, getPostdata, getSortedPosts } from '~/lib/posts'
import matter from 'gray-matter'
import { ChevronLeft, ChevronRight, ExternalLink } from 'lucide-react'
import { MDXClient } from 'next-mdx-remote-client/csr'
import { NextSeo } from 'next-seo'
import Head from 'next/head'
import Image from 'next/image'
import Link from 'next/link'
import { Button } from 'ui'
import { AiTools } from '@/components/AiTools'
import SectionContainer from '@/components/Layouts/SectionContainer'
export async function getStaticPaths() {
const paths = getAllPostSlugs('_customers')
return {
paths,
fallback: false,
}
}
export async function getStaticProps({ params }: any) {
const filePath = `${params.slug}`
const postContent = await getPostdata(filePath, '_customers')
const { data, content } = matter(postContent)
const mdxSource: any = await mdxSerialize(content)
const relatedPosts = getSortedPosts({
directory: '_customers',
limit: 5,
tags: mdxSource.scope.tags,
currentPostSlug: filePath,
})
const allPosts = getSortedPosts({ directory: '_customers' })
const currentIndex = allPosts
.map(function (e) {
return e.slug
})
.indexOf(filePath)
const nextPost = allPosts[currentIndex + 1]
const prevPost = allPosts[currentIndex - 1]
const payload = {
props: {
prevPost: currentIndex === 0 ? null : prevPost ? prevPost : null,
nextPost: currentIndex === allPosts.length ? null : nextPost ? nextPost : null,
relatedPosts,
blog: {
slug: `${params.slug}`,
content: mdxSource,
source: content,
...data,
},
},
}
return payload
}
function CaseStudyPage(props: any) {
const {
about,
company_url,
content,
date,
description,
logo,
meta_description,
meta_title,
misc,
name,
slug,
title,
} = props.blog
const ogImageUrl = encodeURI(
`${process.env.NODE_ENV === 'development' ? 'http://127.0.0.1:54321' : 'https://obuldanrptloktxcffvn.supabase.co'}/functions/v1/og-images?site=customers&customer=${slug}&title=${meta_title ?? title}`
)
const meta = {
title: meta_title ?? `${name} | Supabase Customer Stories`,
description: meta_description ?? description,
image: ogImageUrl ?? `${SITE_ORIGIN}/images/customers/og/customer-stories.jpg`,
url: `${SITE_ORIGIN}/customers/${slug}`,
}
const breadcrumbItems = [
...breadcrumbs.customersIndex,
{ name: meta_title ?? title, url: `https://supabase.com/customers/${slug}` },
]
return (
<>
<NextSeo
title={meta.title}
openGraph={{
title: meta.title,
description: meta.description,
url: meta.url,
type: 'article',
article: {
//
// to do: add expiration and modified dates
// https://github.com/garmeeh/next-seo#article
publishedTime: date,
},
images: [
{
url: meta.image,
alt: `${meta.title} thumbnail`,
},
],
}}
/>
<Head>
<script
type="application/ld+json"
dangerouslySetInnerHTML={{
__html: serializeJsonLd(breadcrumbListSchema(breadcrumbItems)),
}}
/>
</Head>
<DefaultLayout>
<SectionContainer className="py-8 sm:py-16!">
<div className="grid grid-cols-12 gap-4">
<div className="hidden xl:block col-span-12 mb-2 xl:col-span-2">
{/* Back button */}
<Link
href="/customers"
className="text-foreground-lighter hover:text-foreground flex cursor-pointer items-center text-sm transition"
>
<ChevronLeft style={{ padding: 0 }} />
Back
</Link>
</div>
<div className="col-span-12 lg:col-span-8">
<div>
<article className="flex flex-col gap-8">
<div className="flex flex-col gap-4 sm:gap-8 max-w-xxl">
<Link
href="/customers"
className="text-primary hover:text-brand-600 sm:mb-2 mt-0"
>
Customer Stories
</Link>
<h1 className="text-foreground text-4xl font-semibold xl:text-5xl">{title}</h1>
<p className="text-foreground text-xl xl:text-2xl">{description}</p>
</div>
<div className="grid grid-cols-12 prose max-w-none gap-8 lg:gap-20">
<div className="col-span-12 lg:col-span-4 lg:block xl:col-span-4">
<div className="space-y-8 lg:sticky lg:top-24 lg:mb-24">
{/* Logo */}
<div className="relative h-16 w-32 lg:mt-5">
<Image
fill
src={logo}
alt={`${title} logo`}
priority
placeholder="blur"
blurDataURL="/images/blur.png"
draggable={false}
className="
bg-no-repeat
object-left
object-contain
m-0
in-data-[theme*=dark]:brightness-200
in-data-[theme*=dark]:contrast-0
in-data-[theme*=dark]:filter
"
/>
</div>
<div className="flex flex-col space-y-2">
<span className="text-foreground-lighter">About</span>
<p>{about}</p>
{company_url && (
<span className="not-prose ">
<a
href={company_url}
className="flex cursor-pointer items-center space-x-1 transition-opacity text-foreground-lightround-ligtext-foreground-light:text-foreground-light"
target="_blank"
>
<span>{company_url}</span>
<ExternalLink size={14} />
</a>
</span>
)}
</div>
{misc?.map((x: any) => {
return (
<div className="flex flex-col gap-0">
<span className="text-foreground-lighter">{x.label}</span>
<span className="text-foreground-light">{x.text}</span>
</div>
)
})}
<AiTools
pagePath={`/customers/${slug}`}
pageType="customers"
titleClassName="sr-only"
className="not-prose"
/>
<div>
<p>Ready to get started?</p>
<div>
<Button asChild iconRight={<ChevronRight />}>
<Link
href="https://forms.supabase.com/enterprise"
className="no-underline"
>
Contact sales
</Link>
</Button>
</div>
</div>
</div>
</div>
<div className="xm:col-span-7 col-span-12 lg:col-span-8 xl:col-span-8 ">
<MDXClient {...content} components={mdxComponents()} />
</div>
</div>
</article>
</div>
</div>
</div>
</SectionContainer>
<CTABanner />
</DefaultLayout>
</>
)
}
export default CaseStudyPage