* Discovers all component directories, including base-elements sub-directories. * A valid component directory contains a `.component.ts` file matching the dir name.
()
| 69 | * A valid component directory contains a `.component.ts` file matching the dir name. |
| 70 | */ |
| 71 | function discoverComponentDirs(): string[] { |
| 72 | const dirs: string[] = []; |
| 73 | |
| 74 | // Scan top-level component directories (skip base-elements folder itself) |
| 75 | const topLevelEntries = fs.readdirSync(COMPONENTS_DIR, { withFileTypes: true }); |
| 76 | for (const entry of topLevelEntries) { |
| 77 | if (!entry.isDirectory()) continue; |
| 78 | if (entry.name === 'base-elements') continue; |
| 79 | |
| 80 | const dirPath = path.join(COMPONENTS_DIR, entry.name); |
| 81 | if (hasComponentFile(dirPath, entry.name)) { |
| 82 | dirs.push(dirPath); |
| 83 | } |
| 84 | } |
| 85 | |
| 86 | // Scan base-elements sub-directories |
| 87 | if (fs.existsSync(BASE_ELEMENTS_DIR)) { |
| 88 | const baseEntries = fs.readdirSync(BASE_ELEMENTS_DIR, { withFileTypes: true }); |
| 89 | for (const entry of baseEntries) { |
| 90 | if (!entry.isDirectory()) continue; |
| 91 | |
| 92 | const dirPath = path.join(BASE_ELEMENTS_DIR, entry.name); |
| 93 | if (hasComponentFile(dirPath, entry.name)) { |
| 94 | dirs.push(dirPath); |
| 95 | } |
| 96 | } |
| 97 | } |
| 98 | |
| 99 | return dirs.sort(); |
| 100 | } |
| 101 | |
| 102 | /** |
| 103 | * Checks if a directory contains a component .ts file matching the directory name. |
no test coverage detected