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 && (