Skip to content

Commit

Permalink
kickstart app router migration
Browse files Browse the repository at this point in the history
  • Loading branch information
abvthecity committed Jan 25, 2025
1 parent bac5485 commit a6224f8
Show file tree
Hide file tree
Showing 123 changed files with 3,738 additions and 2,896 deletions.
2 changes: 1 addition & 1 deletion clis/generator-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"@fern-api/fs-utils": "0.15.0-rc63",
"@fern-api/github": "workspace:*",
"@types/jest": "^29.5.11",
"@types/node": "^18.7.18",
"@types/node": "^18.19.74",
"@types/yargs": "^17.0.32",
"@yarnpkg/esbuild-plugin-pnp": "^3.0.0-rc.15",
"depcheck": "^1.4.7",
Expand Down
2 changes: 1 addition & 1 deletion clis/vercel-scripts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
},
"devDependencies": {
"@fern-platform/configs": "workspace:*",
"@types/node": "^18.7.18",
"@types/node": "^18.19.74",
"@types/yargs": "^17.0.32",
"depcheck": "^1.4.7",
"eslint": "^9",
Expand Down
10 changes: 4 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@
"markdown-to-jsx": "7.4.0",
"micromatch": "4.0.8",
"postcss": "8.4.31",
"react": "18.3.1",
"react-dom": "18.3.1",
"tailwindcss": "3.4.17",
"typescript": "5.7.2",
"webpack": "5.94.0"
Expand All @@ -63,8 +61,8 @@
},
"devDependencies": {
"@babel/core": "^7.26.0",
"@babel/preset-env": "^7.26.0",
"@babel/preset-react": "^7.25.9",
"@babel/preset-env": "^7.26.7",
"@babel/preset-react": "^7.26.3",
"@babel/preset-typescript": "^7.26.0",
"@eslint/compat": "^1.2.4",
"@eslint/eslintrc": "^3.2.0",
Expand All @@ -76,7 +74,7 @@
"@types/http-proxy": "^1.17.15",
"@types/is-ci": "^3.0.4",
"@types/js-yaml": "^4.0.9",
"@types/node": "^18.7.18",
"@types/node": "^18.19.74",
"@typescript-eslint/eslint-plugin": "8.18.1",
"@typescript-eslint/parser": "8.18.1",
"@yarnpkg/sdks": "^3.1.0",
Expand Down Expand Up @@ -107,7 +105,7 @@
"prettier": "^3.4.2",
"prettier-plugin-organize-imports": "^4.1.0",
"prettier-plugin-tailwindcss": "^0.6.9",
"react": "^18",
"react": "^19",
"rollup": "^4.22.4",
"styled-jsx": "^5.1.2",
"stylelint": "^16.1.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/cdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"devDependencies": {
"@fern-platform/configs": "workspace:*",
"@types/archiver": "^6.0.2",
"@types/node": "^18.7.18",
"@types/node": "^18.19.74",
"aws-cdk": "^2.118.0",
"prettier": "^3.4.2",
"typescript": "^5"
Expand Down
2 changes: 1 addition & 1 deletion packages/commons/core-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
},
"devDependencies": {
"@fern-platform/configs": "workspace:*",
"@types/node": "^18.7.18",
"@types/node": "^18.19.74",
"@types/title": "^3.4.3",
"@types/ua-parser-js": "^0.7.39",
"depcheck": "^1.4.7",
Expand Down
2 changes: 1 addition & 1 deletion packages/commons/fdr-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
},
"devDependencies": {
"@fern-platform/configs": "workspace:*",
"@types/node": "^18.7.18",
"@types/node": "^18.19.74",
"depcheck": "^1.4.7",
"eslint": "^9",
"prettier": "^3.4.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/commons/github/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
},
"devDependencies": {
"@fern-platform/configs": "workspace:*",
"@types/node": "^18.7.18",
"@types/node": "^18.19.74",
"depcheck": "^1.4.7",
"eslint": "^9",
"prettier": "^3.4.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/commons/loadable/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
},
"devDependencies": {
"@fern-platform/configs": "workspace:*",
"@types/node": "^18.7.18",
"@types/node": "^18.19.74",
"depcheck": "^1.4.7",
"eslint": "^9",
"prettier": "^3.4.2",
Expand Down
6 changes: 3 additions & 3 deletions packages/commons/react-commons/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@
"es-toolkit": "^1.27.0",
"fastdom": "^1.0.12",
"immer": "^9.0.15",
"react": "^18",
"react": "^19",
"ts-essentials": "^10.0.1"
},
"devDependencies": {
"@fern-platform/configs": "workspace:*",
"@types/node": "^18.7.18",
"@types/react": "^18",
"@types/node": "^18.19.74",
"@types/react": "^19",
"depcheck": "^1.4.7",
"eslint": "^9",
"prettier": "^3.4.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/fern-docs/auth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
},
"devDependencies": {
"@fern-platform/configs": "workspace:*",
"@types/node": "^18.7.18",
"@types/node": "^18.19.74",
"depcheck": "^1.4.7",
"eslint": "^9",
"prettier": "^3.4.2",
Expand Down
1 change: 0 additions & 1 deletion packages/fern-docs/bundle/.depcheckrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"@tailwindcss/typography",
"@tailwindcss/forms",
"tailwindcss",
"jsonpath",
"cssnano",
"sharp",
"esbuild",
Expand Down
25 changes: 11 additions & 14 deletions packages/fern-docs/bundle/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
"@opentelemetry/sdk-logs": "^0.57.0",
"@types/qs": "6.9.14",
"@upstash/qstash": "^2.7.16",
"@vercel/functions": "^1.5.2",
"@vercel/kv": "^2.0.0",
"@vercel/otel": "^1.10.0",
"@workos-inc/node": "^7.31.0",
Expand All @@ -69,27 +70,29 @@
"feed": "^4.2.2",
"iron-session": "^8.0.3",
"jose": "^5.2.3",
"jsonpath": "^1.1.1",
"next": "npm:@fern-api/next@14.2.9-fork.2",
"next": "15.1.6",
"postcss-import": "^16.0.1",
"posthog-node": "^4.2.1",
"qs": "6.12.0",
"react": "^18",
"react-dom": "^18",
"react": "^19",
"react-dom": "^19",
"schema-dts": "^1.1.2",
"server-only": "^0.0.1",
"sharp": "^0.33.3",
"styled-jsx": "^5.1.2",
"ts-essentials": "^10.0.1",
"url-join": "5.0.0",
"webflow-api": "^2.4.2",
"zod": "^3.23.8"
},
"devDependencies": {
"@fern-platform/configs": "workspace:*",
"@next/bundle-analyzer": "14.2.9",
"@next/bundle-analyzer": "15.1.6",
"@tailwindcss/forms": "^0.5.7",
"@tailwindcss/typography": "^0.5.10",
"@types/node": "^18.7.18",
"@types/react": "^18",
"@types/react-dom": "^18",
"@types/node": "^18.19.74",
"@types/react": "^19",
"@types/react-dom": "^19",
"autoprefixer": "^10.4.16",
"depcheck": "^1.4.7",
"eslint": "^9",
Expand All @@ -103,11 +106,5 @@
"tailwindcss": "^3",
"typescript": "^5",
"vitest": "^2.1.4"
},
"optionalDependencies": {
"@next/swc-darwin-arm64": "14.2.9",
"@next/swc-darwin-x64": "14.2.9",
"@next/swc-linux-x64-gnu": "14.2.9",
"@next/swc-win32-x64-msvc": "14.2.9"
}
}
File renamed without changes.
62 changes: 62 additions & 0 deletions packages/fern-docs/bundle/src/app/[[...slug]]/@markdown/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
"use server";

import { createCachedFindNode } from "@/app/find-node";
import { createCachedDocsLoader } from "@/server/cached-docs-loader";
import { createFileResolver } from "@/server/file-resolver";
import { withServerProps } from "@/server/withServerProps";
import { FernNavigation } from "@fern-api/fdr-sdk";
import { getPageId } from "@fern-api/fdr-sdk/navigation";
import {
MdxBundlerComponent,
serializeMdx,
} from "@fern-docs/ui/bundlers/mdx-bundler";
import { notFound } from "next/navigation";

export default async function Page({
params,
}: {
params: Promise<{ slug?: string[] }>;
}) {
const slug = await params.then((params) =>
FernNavigation.slugjoin(params.slug)
);
const { domain, host, fern_token } = await withServerProps();
const findNode = createCachedFindNode(domain, host);
const docs = createCachedDocsLoader(domain, host);
const { node, currentVersion, currentTab, authState } = await findNode(
slug,
fern_token
);

const pageId = getPageId(node);
if (!pageId) {
return notFound();
}

const page = await docs.getPage(pageId);
if (!page) {
return notFound();
}

const resolveFileSrc = createFileResolver(await docs.getFiles());

const mdx = await serializeMdx(page.markdown, {
filename: pageId,
files: await docs.getMdxBundlerFiles(),
scope: {
props: {
authed: authState.authed,
user: authState.authed ? authState.user : undefined,
version: currentVersion?.versionId,
tab: currentTab?.title,
},
},
replaceSrc: resolveFileSrc,
});

if (typeof mdx === "string") {
return <div>{mdx}</div>;
}

return <MdxBundlerComponent {...mdx} />;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
"use client";

export default function GlobalStyle({ children }: { children: string }) {
return (
<style jsx global>
{children}
</style>
);
}
16 changes: 16 additions & 0 deletions packages/fern-docs/bundle/src/app/[[...slug]]/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"use server";

export default async function Layout({
children,
markdown,
}: {
children: React.ReactNode;
markdown: React.ReactNode;
}) {
return (
<>
{children}
{markdown}
</>
);
}
Loading

0 comments on commit a6224f8

Please sign in to comment.