Skip to content

Commit 6009d3d

Browse files
committed
fix: generate llms files from 1.x docs source
1 parent 670ef05 commit 6009d3d

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

scripts/generate-llms-full.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,18 @@ function collectContent(rootDir, dirPath = rootDir) {
165165
return combined;
166166
}
167167

168+
function resolveDocsSourceDir() {
169+
const versionedDocsDir = path.join(__dirname, '..', 'versioned_docs', 'version-1.x');
170+
171+
if (fs.existsSync(versionedDocsDir)) {
172+
return versionedDocsDir;
173+
}
174+
175+
return path.join(__dirname, '..', 'docs');
176+
}
177+
168178
function main() {
169-
const docsDir = path.join(__dirname, '..', 'docs');
179+
const docsDir = resolveDocsSourceDir();
170180
const buildDir = path.join(__dirname, '..', 'build');
171181
const outputFile = path.join(buildDir, 'llms-full.txt');
172182

scripts/generate-llms.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,16 @@ function collectSections(docsDir, repoRawBaseUrl) {
233233
return sections;
234234
}
235235

236+
function resolveDocsSourceDir() {
237+
const versionedDocsDir = path.join(__dirname, '..', 'versioned_docs', 'version-1.x');
238+
239+
if (fs.existsSync(versionedDocsDir)) {
240+
return versionedDocsDir;
241+
}
242+
243+
return path.join(__dirname, '..', 'docs');
244+
}
245+
236246
function renderSection(section) {
237247
const lines = [`## ${section.title}`, ''];
238248

@@ -245,7 +255,7 @@ function renderSection(section) {
245255
}
246256

247257
function main() {
248-
const docsDir = path.join(__dirname, '..', 'docs');
258+
const docsDir = resolveDocsSourceDir();
249259
const buildDir = path.join(__dirname, '..', 'build');
250260
const outputFile = path.join(buildDir, 'llms.txt');
251261
const siteBaseUrl = getSiteBaseUrl();

0 commit comments

Comments
 (0)