Skip to content

Commit ad369cb

Browse files
committed
chore(dev-hub) fix
1 parent 0f6037e commit ad369cb

File tree

3 files changed

+13
-53
lines changed

3 files changed

+13
-53
lines changed

apps/developer-hub/next.config.js

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,8 @@
11
import { createMDX } from "fumadocs-mdx/next";
22

33
const config = {
4-
async rewrites() {
5-
return [
6-
{
7-
source: "/docs/:path*.mdx",
8-
destination: "/llms.mdx/:path*",
9-
},
10-
];
11-
},
124
reactStrictMode: true,
135
pageExtensions: ["ts", "tsx", "mdx"],
14-
outputFileTracingIncludes: {
15-
"/*": ["./content/docs/**"],
16-
},
176

187
logging: {
198
fetches: {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ export function LLMShare({ content, title, url }: LLMShareProps) {
167167
<div>
168168
<Select<DropdownOption>
169169
label="More options"
170-
buttonLabel=""
170+
buttonLabel="More options"
171171
hideLabel={true}
172172
size="sm"
173173
variant="outline"

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

Lines changed: 12 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -10,51 +10,22 @@ import remarkMdx from "remark-mdx";
1010

1111
const processor = remark().use(remarkMdx).use(remarkInclude).use(remarkGfm);
1212

13-
export async function getLLMText(page: Page) {
14-
// eslint-disable-next-line no-console
15-
console.error("🔥 getLLMText EXECUTED at", new Date().toISOString());
16-
17-
// Resolve a readable MDX path in this Lambda:
18-
// 1) app-relative (when Vercel Root Directory is apps/developer-hub)
19-
// 2) repo-relative (monorepo root)
20-
// 3) absolutePath provided by Fumadocs (works locally)
21-
const pathArray: string[] = Array.isArray(page.path)
22-
? page.path
23-
: [page.path];
24-
const appRelTry = path.join(process.cwd(), "content", "docs", ...pathArray);
25-
const repoRelTry = path.join(
26-
process.cwd(),
27-
"apps",
28-
"developer-hub",
29-
"content",
30-
"docs",
31-
...pathArray,
32-
);
33-
const absTry = page.absolutePath;
13+
function resolveMdxPath(page: Page): string {
14+
const parts: string[] = Array.isArray(page.path) ? page.path : [page.path];
3415

35-
let mdxPath: string | undefined;
36-
if (existsSync(appRelTry)) {
37-
mdxPath = appRelTry;
38-
} else if (existsSync(repoRelTry)) {
39-
mdxPath = repoRelTry;
40-
} else if (absTry && existsSync(absTry)) {
41-
mdxPath = absTry;
42-
}
16+
const appRelPath = [process.cwd(), "content", "docs", ...parts] as [
17+
string,
18+
...string[],
19+
];
4320

44-
// eslint-disable-next-line no-console
45-
console.error("🧪[LLM] chosenPath=", mdxPath);
21+
if (existsSync(path.join(...appRelPath))) {
22+
return path.join(...appRelPath);
23+
} else throw new Error(`MDX file not found at ${path.join(...appRelPath)}`);
24+
}
4625

47-
if (!mdxPath) {
48-
throw new Error(
49-
`MDX file not found at any known path:
50-
appRel=${appRelTry},
51-
repoRel=${repoRelTry},
52-
abs=${absTry}`,
53-
);
54-
}
26+
export async function getLLMText(page: Page) {
27+
const mdxPath = resolveMdxPath(page);
5528

56-
// eslint-disable-next-line no-console
57-
console.error(`Getting LLM text for ${mdxPath}`);
5829
const processed = await processor.process({
5930
path: mdxPath,
6031
value: await readFile(mdxPath, "utf8"),

0 commit comments

Comments
 (0)