(dir: string, cwd?: string)
| 3 | import path from 'pathe'; |
| 4 | |
| 5 | export const getDirectories = (dir: string, cwd?: string) => { |
| 6 | try { |
| 7 | return fs |
| 8 | .readdirSync(path.join(cwd ?? process.cwd(), dir), { |
| 9 | withFileTypes: true, |
| 10 | }) |
| 11 | .filter((dirent) => dirent.isDirectory()) |
| 12 | .map((dirent) => dirent.name); |
| 13 | } catch { |
| 14 | return []; |
| 15 | } |
| 16 | }; |