(projectDir: string, relativePath: string = "")
| 131 | } |
| 132 | |
| 133 | function walkDirectoryForFilenames(projectDir: string, relativePath: string = ""): string[] { |
| 134 | let paths: string[] = []; |
| 135 | fs.readdirSync(path.join(projectDir, relativePath), { withFileTypes: true }) |
| 136 | .filter(directoryEntry => directoryEntry.name !== "node_modules") |
| 137 | .forEach(directoryEntry => { |
| 138 | if (directoryEntry.isDirectory()) { |
| 139 | paths = paths.concat(walkDirectoryForFilenames(projectDir, directoryEntry.name)); |
| 140 | return; |
| 141 | } |
| 142 | const fileExtension = directoryEntry.name.split(".").slice(-1)[0]; |
| 143 | if (directoryEntry.isFile() && SOURCE_EXTENSIONS.includes(fileExtension)) { |
| 144 | paths.push(directoryEntry.name); |
| 145 | } |
| 146 | }); |
| 147 | return paths.map(filename => path.join(relativePath, filename)); |
| 148 | } |
no test coverage detected