@knowcode/doc-builder 1.10.7 → 1.10.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/core-builder.js +16 -1
- package/package.json +1 -1
package/lib/core-builder.js
CHANGED
|
@@ -1196,6 +1196,7 @@ async function scanAllFiles(dir, baseDir = dir, options = {}) {
|
|
|
1196
1196
|
const markdownFiles = [];
|
|
1197
1197
|
const attachmentFiles = [];
|
|
1198
1198
|
const attachmentTypes = options.attachmentTypes || [];
|
|
1199
|
+
const excludeDirs = options.excludeDirs || [];
|
|
1199
1200
|
const items = await fs.readdir(dir);
|
|
1200
1201
|
|
|
1201
1202
|
for (const item of items) {
|
|
@@ -1208,6 +1209,11 @@ async function scanAllFiles(dir, baseDir = dir, options = {}) {
|
|
|
1208
1209
|
const fullPath = path.join(dir, item);
|
|
1209
1210
|
const stat = await fs.stat(fullPath);
|
|
1210
1211
|
|
|
1212
|
+
// Skip excluded directories (output dirs, node_modules, .git, etc.)
|
|
1213
|
+
if (stat.isDirectory() && excludeDirs.includes(item)) {
|
|
1214
|
+
continue;
|
|
1215
|
+
}
|
|
1216
|
+
|
|
1211
1217
|
// Skip private directories if excludePrivate is true
|
|
1212
1218
|
if (stat.isDirectory() && options.excludePrivate && item === 'private') {
|
|
1213
1219
|
continue;
|
|
@@ -1345,8 +1351,17 @@ async function buildDocumentation(config) {
|
|
|
1345
1351
|
'.mp4', '.mp3', '.wav', '.avi', '.mov'
|
|
1346
1352
|
];
|
|
1347
1353
|
|
|
1354
|
+
// Auto-exclude output directories and common non-doc directories
|
|
1355
|
+
const excludeDirs = [
|
|
1356
|
+
path.basename(config.outputDir),
|
|
1357
|
+
path.basename(config.staticOutputDir || 'html-static'),
|
|
1358
|
+
'node_modules',
|
|
1359
|
+
'.git'
|
|
1360
|
+
];
|
|
1361
|
+
|
|
1348
1362
|
const { markdownFiles: files, attachmentFiles } = await scanAllFiles(docsDir, docsDir, {
|
|
1349
|
-
attachmentTypes: config.features?.attachments !== false ? attachmentTypes : []
|
|
1363
|
+
attachmentTypes: config.features?.attachments !== false ? attachmentTypes : [],
|
|
1364
|
+
excludeDirs
|
|
1350
1365
|
});
|
|
1351
1366
|
|
|
1352
1367
|
console.log(chalk.green(`✅ Found ${files.length} markdown files${readmeGenerated ? ' (including auto-generated README)' : ''}`));
|