From 02d5ce85ec8854c74980b9631578daa123f0fe3d Mon Sep 17 00:00:00 2001 From: shadcn Date: Wed, 29 Oct 2025 13:37:41 +0400 Subject: [PATCH] feat: upgrade to Next.js 16 (#8615) * feat: upgrade to Next.js 16 * chore: deps * fix * fix * fix * fix: workaround zod 4 for now * fix * fix: copy button * fix: update apps/v4/hooks/use-is-mac.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * fix * fix: remove --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .github/workflows/prerelease.yml | 4 +- .github/workflows/release.yml | 4 +- .github/workflows/test.yml | 2 +- apps/v4/app/(app)/docs/[[...slug]]/page.tsx | 33 +- apps/v4/app/(app)/llm/[[...slug]]/route.ts | 5 +- apps/v4/app/(view)/view/[name]/page.tsx | 1 + apps/v4/components/command-menu.tsx | 6 +- apps/v4/components/docs-breadcrumb.tsx | 4 +- apps/v4/eslint.config.mjs | 36 +- apps/v4/hooks/use-is-mac.ts | 11 - apps/v4/hooks/use-layout.tsx | 5 +- apps/v4/hooks/use-mobile.ts | 2 +- apps/v4/lib/llm.ts | 2 +- apps/v4/lib/source.ts | 2 +- apps/v4/mdx-components.tsx | 3 +- apps/v4/next.config.mjs | 3 + apps/v4/package.json | 26 +- apps/v4/registry/__index__.tsx | 11104 ++++++++++------ .../sidebar-11/components/app-sidebar.tsx | 4 +- .../examples/form-rhf-password.tsx | 7 +- .../new-york-v4/examples/sheet-side.tsx | 3 +- .../new-york-v4/examples/typography-table.tsx | 4 +- apps/v4/source.config.ts | 30 +- apps/v4/tsconfig.json | 23 +- package.json | 6 + pnpm-lock.yaml | 3981 +++--- 26 files changed, 9625 insertions(+), 5686 deletions(-) delete mode 100644 apps/v4/hooks/use-is-mac.ts diff --git a/.github/workflows/prerelease.yml b/.github/workflows/prerelease.yml index ad80e2f308..e60d757d3c 100644 --- a/.github/workflows/prerelease.yml +++ b/.github/workflows/prerelease.yml @@ -27,10 +27,10 @@ jobs: with: version: 9.0.6 - - name: Use Node.js 18 + - name: Use Node.js 20 uses: actions/setup-node@v3 with: - node-version: 18 + node-version: 20 cache: "pnpm" - name: Install NPM Dependencies diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 56cc0ea459..65c8e9347d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -23,11 +23,11 @@ jobs: with: version: 9.0.6 - - name: Use Node.js 18 + - name: Use Node.js 20 uses: actions/setup-node@v3 with: version: 9.0.6 - node-version: 18 + node-version: 20 cache: "pnpm" - name: Install NPM Dependencies diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index fe4dd7902b..11bc27bb0d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -19,7 +19,7 @@ jobs: - name: Install Node.js uses: actions/setup-node@v3 with: - node-version: 18 + node-version: 20 - uses: pnpm/action-setup@v4 name: Install pnpm diff --git a/apps/v4/app/(app)/docs/[[...slug]]/page.tsx b/apps/v4/app/(app)/docs/[[...slug]]/page.tsx index 532d3ae3ce..808f6750e5 100644 --- a/apps/v4/app/(app)/docs/[[...slug]]/page.tsx +++ b/apps/v4/app/(app)/docs/[[...slug]]/page.tsx @@ -6,7 +6,9 @@ import { IconArrowRight, IconArrowUpRight, } from "@tabler/icons-react" -import { findNeighbour } from "fumadocs-core/server" +import fm from "front-matter" +import { findNeighbour } from "fumadocs-core/page-tree" +import z from "zod" import { source } from "@/lib/source" import { absoluteUrl } from "@/lib/utils" @@ -25,7 +27,7 @@ export function generateStaticParams() { } export async function generateMetadata(props: { - params: Promise<{ slug?: string[] }> + params: Promise<{ slug: string[] }> }) { const params = await props.params const page = source.getPage(params.slug) @@ -73,7 +75,7 @@ export async function generateMetadata(props: { } export default async function Page(props: { - params: Promise<{ slug?: string[] }> + params: Promise<{ slug: string[] }> }) { const params = await props.params const page = source.getPage(params.slug) @@ -82,12 +84,21 @@ export default async function Page(props: { } const doc = page.data - // @ts-expect-error - revisit fumadocs types. const MDX = doc.body - const neighbours = await findNeighbour(source.pageTree, page.url) + const neighbours = findNeighbour(source.pageTree, page.url) - // @ts-expect-error - revisit fumadocs types. - const links = doc.links + const raw = await page.data.getText("raw") + const { attributes } = fm(raw) + const { links } = z + .object({ + links: z + .object({ + doc: z.string().optional(), + api: z.string().optional(), + }) + .optional(), + }) + .parse(attributes) return (
- + {neighbours.previous && (