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 | 2x 2x 2x 14x 14x 14x 126x 126x 15218x 15218x 112x 15106x 14770x 14770x 14x 14x 14x | /**
* @module Infrastructure/SitemapXml/Scanners/Api
* @category Intelligence Operations / Supporting Infrastructure
* @name TypeDoc API documentation scanner
*
* @description
* Walks the TypeDoc-generated `api/` directory recursively (skipping the
* `assets/` bundle) and collects every `*.html` file. Each entry carries
* the path relative to `api/` plus its git/fs timestamp so the sitemap
* can emit one `<url>` per documentation page.
*
* 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 API_DIR = path.join(__dirname, '..', '..', '..', 'api');
/** Single TypeDoc page with its repo-absolute path and lastmod. */
export interface ApiDoc {
file: string;
path: string;
lastmod: string;
}
/**
* Get API documentation files (supports TypeDoc nested directory structure).
*/
export function getApiDocs(): ApiDoc[] {
console.log('📚 Scanning API documentation directory...');
Iif (!fs.existsSync(API_DIR)) {
console.warn('⚠️ API directory not found');
return [];
}
const results: ApiDoc[] = [];
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') {
scanDir(fullPath);
} else if (entry.isFile() && entry.name.endsWith('.html')) {
const relativePath = path.relative(API_DIR, fullPath).replace(/\\/g, '/');
results.push({
file: relativePath,
path: fullPath,
lastmod: getFileModTime(fullPath),
});
}
}
}
scanDir(API_DIR);
console.log(` Found ${results.length} API documentation files`);
return results;
}
|