Skip to content

Commit 4a5bc7e

Browse files
committed
edit generate-llms to copy plain text versions of release notes
1 parent d54380b commit 4a5bc7e

File tree

1 file changed

+19
-7
lines changed

1 file changed

+19
-7
lines changed

static/js/generate-llms.js

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -160,21 +160,25 @@ function processContent(content, filePath) {
160160
return content.trim();
161161
}
162162

163-
function shouldSkipDirectory(filePath) {
164-
const excludedDirs = ['.history', 'release-notes', 'templates', 'pdfs'];
163+
function shouldSkipDirectory(filePath, excludedDirs = ['.history', 'templates', 'pdfs']) {
165164
return excludedDirs.some(dir => filePath.includes(dir));
166165
}
167166

168-
function getAllMarkdownFiles(dir, fileList = []) {
167+
function getAllMarkdownFiles(dir, fileList = [], excludeReleaseNotes = true) {
169168
fs.readdirSync(dir).forEach(file => {
170169
const filePath = path.join(dir, file);
171170

171+
// Skip release-notes if excludeReleaseNotes is true
172+
if (excludeReleaseNotes && filePath.includes('release-notes')) {
173+
return;
174+
}
175+
172176
if (shouldSkipDirectory(filePath)) {
173177
return;
174178
}
175179

176180
if (fs.statSync(filePath).isDirectory()) {
177-
getAllMarkdownFiles(filePath, fileList);
181+
getAllMarkdownFiles(filePath, fileList, excludeReleaseNotes);
178182
} else if ((path.extname(file) === '.md' || path.extname(file) === '.mdx') && !file.startsWith('_')) {
179183
const content = fs.readFileSync(filePath, 'utf8');
180184

@@ -198,6 +202,11 @@ function getAllMarkdownFiles(dir, fileList = []) {
198202
return fileList;
199203
}
200204

205+
// New function to get all markdown files including release-notes (only for static folder)
206+
function getAllMarkdownFilesForStatic(dir, fileList = []) {
207+
return getAllMarkdownFiles(dir, fileList, false);
208+
}
209+
201210
function getCuratedFiles(dir) {
202211
const fileList = [];
203212
INCLUDED_FILES.forEach(relativePath => {
@@ -286,9 +295,6 @@ function generateFullLLMsTxt(files) {
286295

287296
fs.writeFileSync(OUTPUT_FULL_FILE, fullContent);
288297
console.log("✅ llms-full.txt generated!");
289-
290-
// Copy all processed markdown files to static directory
291-
copyProcessedMarkdownToStatic(files);
292298
}
293299

294300
function copyProcessedMarkdownToStatic(files) {
@@ -328,8 +334,14 @@ function generateLLMsTxt(files) {
328334

329335
// Update the main execution
330336
loadPartials(DOCS_DIR);
337+
// Get files for llms-full.txt (excluding release-notes)
331338
const allFiles = getAllMarkdownFiles(DOCS_DIR);
339+
// Get all files including release-notes for copying to static
340+
const allFilesForStatic = getAllMarkdownFilesForStatic(DOCS_DIR);
332341
const curatedFiles = getCuratedFiles(DOCS_DIR);
333342

343+
// Generate llms-full.txt (excluding release-notes)
334344
generateFullLLMsTxt(allFiles);
345+
// Copy all files including release-notes to static
346+
copyProcessedMarkdownToStatic(allFilesForStatic);
335347
generateLLMsTxt(curatedFiles);

0 commit comments

Comments
 (0)