(target)
| 493 | } |
| 494 | |
| 495 | function listDirectories(target) { |
| 496 | const cwd = assertDirectoryPath(target); |
| 497 | const roots = getDirectoryRoots(); |
| 498 | const parentDir = path.dirname(cwd); |
| 499 | const parent = normalizeFsPath(parentDir) === normalizeFsPath(cwd) ? null : parentDir; |
| 500 | |
| 501 | const entries = fs.readdirSync(cwd, { withFileTypes: true }) |
| 502 | .filter(entry => entry.isDirectory()) |
| 503 | .map(entry => ({ |
| 504 | name: entry.name, |
| 505 | path: path.join(cwd, entry.name), |
| 506 | })) |
| 507 | .sort((a, b) => a.name.localeCompare(b.name, undefined, { numeric: true, sensitivity: 'base' })); |
| 508 | |
| 509 | return { cwd, parent, roots, entries }; |
| 510 | } |
| 511 | |
| 512 | module.exports = { |
| 513 | normalizeFsPath, |
no test coverage detected