Skip to content

Commit 50c9d94

Browse files
committed
removes docs from path and adds check llms script
1 parent c5952a9 commit 50c9d94

File tree

5 files changed

+24
-39
lines changed

5 files changed

+24
-39
lines changed

.github/workflows/deploy.yml

Lines changed: 1 addition & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -28,39 +28,7 @@ jobs:
2828
- name: Build website with LLMs generation
2929
run: npm run build:llms-fixed
3030
- name: Verify LLMs files
31-
run: |
32-
echo "Verifying LLMs files generation..."
33-
34-
# Check if LLMs files were generated
35-
if [ ! -f "build/llms.txt" ] || [ ! -f "build/llms-full.txt" ]; then
36-
echo "❌ LLMs files not found!"
37-
exit 1
38-
fi
39-
40-
# Check file sizes
41-
llms_txt_size=$(wc -c < build/llms.txt)
42-
llms_full_size=$(wc -c < build/llms-full.txt)
43-
echo "llms.txt: $llms_txt_size bytes"
44-
echo "llms-full.txt: $llms_full_size bytes"
45-
46-
# Verify URLs are correct (no prepended numbers)
47-
if grep -q "https://dev\.flare\.network/docs/[^)]*/\d+-" build/llms.txt; then
48-
echo "❌ Found URLs with prepended numbers!"
49-
exit 1
50-
else
51-
echo "✅ All URLs are correctly formatted"
52-
fi
53-
54-
# Check content structure
55-
sections=$(grep -c "^- \[" build/llms.txt || true)
56-
echo "Found $sections sections in llms.txt"
57-
58-
if [ "$sections" -lt 10 ]; then
59-
echo "❌ Too few sections found!"
60-
exit 1
61-
fi
62-
63-
echo "✅ LLMs files verified successfully"
31+
run: npm run check-llms
6432
- name: Upload Build Artifact
6533
uses: actions/upload-pages-artifact@v3
6634
with:

check-llms.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash
2+
3+
if [ ! -f "build/llms.txt" ] || [ ! -f "build/llms-full.txt" ]; then
4+
echo "⚠️ LLMs files not found!"
5+
else
6+
echo "✅ LLMs files found"
7+
8+
if grep -q "https://dev\.flare\.network/[^)]*/\d+-" build/llms.txt; then
9+
echo "⚠️ Found URLs with prepended numbers! "
10+
else
11+
echo "✅ All URLs are correctly formatted"
12+
fi
13+
fi

docusaurus.config.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,9 @@ const config: Config = {
266266
// Content cleaning options for better LLM consumption
267267
excludeImports: true,
268268
removeDuplicateHeadings: true,
269+
pathTransformation: {
270+
ignorePaths: ['docs'],
271+
}
269272
},
270273
],
271274
],

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
"format:check": "prettier --check \"**/*.{js,jsx,ts,tsx,md,mdx}\"",
2121
"lint": "npx eslint .",
2222
"fix-llms-urls": "node scripts/fix-llms-urls.mjs",
23-
"build:llms-fixed": "npm run build && npm run fix-llms-urls"
23+
"build:llms-fixed": "npm run build && npm run fix-llms-urls && npm run check-llms",
24+
"check-llms": "./check-llms.sh"
2425
},
2526
"dependencies": {
2627
"@docusaurus/core": "^3.8.1",

scripts/fix-llms-urls.mjs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import path from "path";
1313
const config = {
1414
buildDir: "build",
1515
filesToFix: ["llms.txt", "llms-full.txt"],
16-
baseUrl: "https://dev.flare.network/docs/",
16+
baseUrl: "https://dev.flare.network/",
1717
};
1818

1919
function fixUrlsInFile(filePath) {
@@ -22,10 +22,10 @@ function fixUrlsInFile(filePath) {
2222

2323
const content = fs.readFileSync(filePath, "utf8");
2424

25-
// Fix URLs by removing prepended numbers
26-
// Pattern: https://dev.flare.network/docs/network/0-overview -> https://dev.flare.network/docs/network/overview
27-
const fixedContent = content.replace(
28-
/(https:\/\/dev\.flare\.network\/docs\/[^)]+\/)\d+-([^)]+)/g,
25+
// Fix URLs by removing prepended numbers folder
26+
// Pattern: https://dev.flare.network/network/0-overview -> https://dev.flare.network/network/overview
27+
let fixedContent = content.replace(
28+
/(https:\/\/dev\.flare\.network\/[^)]+\/)\d+-([^)]+)/g,
2929
"$1$2",
3030
);
3131

0 commit comments

Comments
 (0)