aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOgulcan Celik <ogulcancelik@gmail.com>2026-08-14 03:12:00 +0300
committerOgulcan Celik <ogulcancelik@gmail.com>2026-08-14 03:12:00 +0300
commitb710176fd23f4dfa3b3c2fa9b0c326b11dd5fd17 (patch)
tree0561310dd2a46e012c81de4e30c8e7ba838f1b9a
parent1bfabbab3fc9a79bf3b93f5dc3962fb8e7afea50 (diff)
fix(docs): apply llms patch during website builds
-rw-r--r--website/bun.lock3
-rw-r--r--website/package.json10
-rw-r--r--website/patches/starlight-llms-txt@0.6.1.patch18
-rw-r--r--website/scripts/patch-starlight-llms.mjs24
4 files changed, 28 insertions, 27 deletions
diff --git a/website/bun.lock b/website/bun.lock
index 4255507b..28bac73d 100644
--- a/website/bun.lock
+++ b/website/bun.lock
@@ -12,9 +12,6 @@
},
},
},
- "patchedDependencies": {
- "starlight-llms-txt@0.6.1": "patches/starlight-llms-txt@0.6.1.patch",
- },
"packages": {
"@astrojs/compiler": ["@astrojs/compiler@2.13.1", "", {}, "sha512-f3FN83d2G/v32ipNClRKgYv30onQlMZX1vCeZMjPsMMPl1mDpmbl0+N5BYo4S/ofzqJyS5hvwacEo0CCVDn/Qg=="],
diff --git a/website/package.json b/website/package.json
index d3c35a89..d4474007 100644
--- a/website/package.json
+++ b/website/package.json
@@ -4,10 +4,11 @@
"type": "module",
"scripts": {
"prepare-docs": "node scripts/prepare-docs.mjs",
- "dev": "node scripts/prepare-docs.mjs --draft && astro dev",
+ "prepare-llms": "node scripts/patch-starlight-llms.mjs",
+ "dev": "bun run prepare-llms && node scripts/prepare-docs.mjs --draft && astro dev",
"test": "bun test",
- "build": "bun run test && node scripts/prepare-docs.mjs && astro build && node scripts/check-built-docs.mjs",
- "build:draft": "node scripts/prepare-docs.mjs --draft && astro build && node scripts/check-built-docs.mjs",
+ "build": "bun run test && bun run prepare-llms && node scripts/prepare-docs.mjs && astro build && node scripts/check-built-docs.mjs",
+ "build:draft": "bun run prepare-llms && node scripts/prepare-docs.mjs --draft && astro build && node scripts/check-built-docs.mjs",
"preview": "astro preview"
},
"dependencies": {
@@ -15,8 +16,5 @@
"@astrojs/starlight": "^0.36.0",
"astro": "^5.0.0",
"starlight-llms-txt": "0.6.1"
- },
- "patchedDependencies": {
- "starlight-llms-txt@0.6.1": "patches/starlight-llms-txt@0.6.1.patch"
}
}
diff --git a/website/patches/starlight-llms-txt@0.6.1.patch b/website/patches/starlight-llms-txt@0.6.1.patch
deleted file mode 100644
index b59049c0..00000000
--- a/website/patches/starlight-llms-txt@0.6.1.patch
+++ /dev/null
@@ -1,18 +0,0 @@
-diff --git a/llms-full.txt.ts b/llms-full.txt.ts
-index cdc3a34c0555c4a556224f63d937d976c669eef0..45d60f54994240e93277021cb649237c4874f4ce 100644
---- a/llms-full.txt.ts
-+++ b/llms-full.txt.ts
-@@ -1,4 +1,5 @@
- import type { APIRoute } from 'astro';
-+import { starlightLllmsTxtContext } from 'virtual:starlight-llms-txt/context';
- import { generateLlmsTxt } from './generator';
- import { getSiteTitle } from './utils';
-
-@@ -9,6 +10,7 @@ export const GET: APIRoute = async (context) => {
- const body = await generateLlmsTxt(context, {
- minify: false,
- description: `This is the full developer documentation for ${getSiteTitle()}`,
-+ exclude: starlightLllmsTxtContext.exclude,
- });
- return new Response(body);
- };
diff --git a/website/scripts/patch-starlight-llms.mjs b/website/scripts/patch-starlight-llms.mjs
new file mode 100644
index 00000000..16d3ba9b
--- /dev/null
+++ b/website/scripts/patch-starlight-llms.mjs
@@ -0,0 +1,24 @@
+import { readFile, writeFile } from 'node:fs/promises';
+import { resolve } from 'node:path';
+
+const path = resolve('node_modules/starlight-llms-txt/llms-full.txt.ts');
+const original = await readFile(path, 'utf8');
+const importLine = "import { starlightLllmsTxtContext } from 'virtual:starlight-llms-txt/context';";
+const excludeLine = '\t\texclude: starlightLllmsTxtContext.exclude,';
+
+if (original.includes(importLine) && original.includes(excludeLine)) process.exit(0);
+
+const withImport = original.replace(
+ "import { generateLlmsTxt } from './generator';",
+ `${importLine}\nimport { generateLlmsTxt } from './generator';`,
+);
+const patched = withImport.replace(
+ '\t\tdescription: `This is the full developer documentation for ${getSiteTitle()}`,',
+ '\t\tdescription: `This is the full developer documentation for ${getSiteTitle()}`,\n' + excludeLine,
+);
+
+if (patched === original || !patched.includes(importLine) || !patched.includes(excludeLine)) {
+ throw new Error('starlight-llms-txt changed: update the stable-only llms-full compatibility patch');
+}
+
+await writeFile(path, patched, 'utf8');