Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | 2x 2x 2x 14x 14x 14x 2198x 2198x 36218x 36218x 2184x 34034x 33040x 33040x 14x 83734x 14x 14x | /**
* @module Infrastructure/SitemapXml/Scanners/Docs
* @category Intelligence Operations / Supporting Infrastructure
* @name docs/ scanner — coverage / test-results / cypress / api index
*
* @description
* Walks `docs/` recursively (skipping `assets/` and `node_modules/`),
* collects every `*.html` file, and returns a sorted list. Output is
* sorted alphabetically by relative path so sitemap XML stays
* deterministic across platforms.
*
* Round-6 split: extracted from `scripts/generate-sitemap.ts`.
*
* @author Hack23 AB (Infrastructure Team)
* @license Apache-2.0
*/
import fs from 'fs';
import path from 'path';
import { fileURLToPath } from 'url';
import { getFileModTime } from '../git-timestamps.js';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const DOCS_DIR = path.join(__dirname, '..', '..', '..', 'docs');
/** Single docs page with its repo-absolute path and lastmod. */
export interface DocFile {
file: string;
path: string;
lastmod: string;
}
/**
* Get documentation files from the docs directory (api, coverage, test-results, cypress).
*/
export function getDocFiles(): DocFile[] {
console.log('📖 Scanning docs directory...');
Iif (!fs.existsSync(DOCS_DIR)) {
console.warn('⚠️ Docs directory not found');
return [];
}
const results: DocFile[] = [];
function scanDir(dir: string): void {
const entries = fs.readdirSync(dir, { withFileTypes: true });
for (const entry of entries) {
const fullPath = path.join(dir, entry.name);
if (entry.isDirectory() && entry.name !== 'assets' && entry.name !== 'node_modules') {
scanDir(fullPath);
} else if (entry.isFile() && entry.name.endsWith('.html')) {
const relativePath = path.relative(DOCS_DIR, fullPath).replace(/\\/g, '/');
results.push({
file: relativePath,
path: fullPath,
lastmod: getFileModTime(fullPath),
});
}
}
}
scanDir(DOCS_DIR);
// Sort for deterministic output across platforms/filesystems
results.sort((a, b) => a.file.localeCompare(b.file));
console.log(` Found ${results.length} documentation files in docs/`);
return results;
}
|