Explorar el Código

chore(dev-hub) fix

Aditya Arora hace 2 semanas
padre
commit
ad369cb712

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

@@ -1,19 +1,8 @@
 import { createMDX } from "fumadocs-mdx/next";
 
 const config = {
-  async rewrites() {
-    return [
-      {
-        source: "/docs/:path*.mdx",
-        destination: "/llms.mdx/:path*",
-      },
-    ];
-  },
   reactStrictMode: true,
   pageExtensions: ["ts", "tsx", "mdx"],
-  outputFileTracingIncludes: {
-    "/*": ["./content/docs/**"],
-  },
 
   logging: {
     fetches: {

+ 1 - 1
apps/developer-hub/src/components/LLMShare/index.tsx

@@ -167,7 +167,7 @@ export function LLMShare({ content, title, url }: LLMShareProps) {
       <div>
         <Select<DropdownOption>
           label="More options"
-          buttonLabel=""
+          buttonLabel="More options"
           hideLabel={true}
           size="sm"
           variant="outline"

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

@@ -10,51 +10,22 @@ import remarkMdx from "remark-mdx";
 
 const processor = remark().use(remarkMdx).use(remarkInclude).use(remarkGfm);
 
-export async function getLLMText(page: Page) {
-  // eslint-disable-next-line no-console
-  console.error("🔥 getLLMText EXECUTED at", new Date().toISOString());
-
-  // Resolve a readable MDX path in this Lambda:
-  // 1) app-relative (when Vercel Root Directory is apps/developer-hub)
-  // 2) repo-relative (monorepo root)
-  // 3) absolutePath provided by Fumadocs (works locally)
-  const pathArray: string[] = Array.isArray(page.path)
-    ? page.path
-    : [page.path];
-  const appRelTry = path.join(process.cwd(), "content", "docs", ...pathArray);
-  const repoRelTry = path.join(
-    process.cwd(),
-    "apps",
-    "developer-hub",
-    "content",
-    "docs",
-    ...pathArray,
-  );
-  const absTry = page.absolutePath;
+function resolveMdxPath(page: Page): string {
+  const parts: string[] = Array.isArray(page.path) ? page.path : [page.path];
 
-  let mdxPath: string | undefined;
-  if (existsSync(appRelTry)) {
-    mdxPath = appRelTry;
-  } else if (existsSync(repoRelTry)) {
-    mdxPath = repoRelTry;
-  } else if (absTry && existsSync(absTry)) {
-    mdxPath = absTry;
-  }
+  const appRelPath = [process.cwd(), "content", "docs", ...parts] as [
+    string,
+    ...string[],
+  ];
 
-  // eslint-disable-next-line no-console
-  console.error("🧪[LLM] chosenPath=", mdxPath);
+  if (existsSync(path.join(...appRelPath))) {
+    return path.join(...appRelPath);
+  } else throw new Error(`MDX file not found at ${path.join(...appRelPath)}`);
+}
 
-  if (!mdxPath) {
-    throw new Error(
-      `MDX file not found at any known path:
-       appRel=${appRelTry},
-       repoRel=${repoRelTry},
-       abs=${absTry}`,
-    );
-  }
+export async function getLLMText(page: Page) {
+  const mdxPath = resolveMdxPath(page);
 
-  // eslint-disable-next-line no-console
-  console.error(`Getting LLM text for ${mdxPath}`);
   const processed = await processor.process({
     path: mdxPath,
     value: await readFile(mdxPath, "utf8"),