Explorar el Código

chore(dev-hub) llm prod fixes

Aditya Arora hace 3 semanas
padre
commit
d172d7c293

+ 7 - 0
apps/developer-hub/next.config.js

@@ -3,6 +3,13 @@ import { createMDX } from "fumadocs-mdx/next";
 const config = {
   reactStrictMode: true,
   pageExtensions: ["ts", "tsx", "mdx"],
+  experimental: {
+    // Ensure content/ docs are traced into the serverless output on Vercel
+    outputFileTracingIncludes: {
+      // For App Router output; adjust if you have custom directories
+      "app/**": ["content/**"],
+    },
+  },
 
   logging: {
     fetches: {

+ 10 - 0
apps/developer-hub/src/app/llms.txt/route.ts

@@ -34,3 +34,13 @@ export async function GET() {
     return new NextResponse("Internal server error", { status: 500 });
   }
 }
+
+export function HEAD() {
+  return new NextResponse(undefined, {
+    status: 200,
+    headers: {
+      "Content-Type": "text/plain; charset=utf-8",
+      "Cache-Control": "public, max-age=3600",
+    },
+  });
+}

+ 2 - 2
apps/developer-hub/src/lib/get-llm-text.ts

@@ -1,4 +1,4 @@
-import fs from "node:fs/promises";
+import { readFile } from "node:fs/promises";
 
 import type { Page } from "fumadocs-core/source";
 import { remarkInclude } from "fumadocs-mdx/config";
@@ -11,7 +11,7 @@ const processor = remark().use(remarkMdx).use(remarkInclude).use(remarkGfm);
 export async function getLLMText(page: Page) {
   const processed = await processor.process({
     path: page.absolutePath,
-    value: await fs.readFile(page.absolutePath, "utf8"),
+    value: await readFile(page.absolutePath, "utf8"),
   });
 
   return `# ${page.data.title ?? "Untitled"}

+ 6 - 1
apps/developer-hub/vercel.json

@@ -1,4 +1,9 @@
 {
   "$schema": "https://openapi.vercel.sh/vercel.json",
-  "buildCommand": "turbo run build --filter @pythnetwork/developer-hub"
+  "buildCommand": "turbo run build --filter @pythnetwork/developer-hub",
+  "functions": {
+    "**": {
+      "includeFiles": "apps/developer-hub/content/**"
+    }
+  }
 }