()
| 57 | * Gets list of all available components by scanning for directories with info.json |
| 58 | */ |
| 59 | export async function getAvailableComponents(): Promise<string[]> { |
| 60 | const { componentsPath } = await ensureSourcePaths(); |
| 61 | if (!(await fs.pathExists(componentsPath))) { |
| 62 | return []; |
| 63 | } |
| 64 | |
| 65 | const dirs = await fs.readdir(componentsPath); |
| 66 | const components: string[] = []; |
| 67 | |
| 68 | for (const dir of dirs) { |
| 69 | const componentPath = path.join(componentsPath, dir); |
| 70 | const stat = await fs.stat(componentPath); |
| 71 | |
| 72 | if (stat.isDirectory()) { |
| 73 | const infoPath = path.join(componentPath, "info.json"); |
| 74 | if (await fs.pathExists(infoPath)) { |
| 75 | components.push(dir); |
| 76 | } |
| 77 | } |
| 78 | } |
| 79 | |
| 80 | return components; |
| 81 | } |
| 82 | |
| 83 | /** |
| 84 | * Resolves all dependencies for a component including nested dependencies |
no test coverage detected