( basePath: string, path: string, files: Record<string, string>, ignore: (filePath: string) => boolean, )
| 148 | } |
| 149 | |
| 150 | async function recursivelyGatherFilesHelper( |
| 151 | basePath: string, |
| 152 | path: string, |
| 153 | files: Record<string, string>, |
| 154 | ignore: (filePath: string) => boolean, |
| 155 | ) { |
| 156 | const dirFiles = await readdir(path, { withFileTypes: true }) |
| 157 | for (const file of dirFiles) { |
| 158 | if (ignore(file.name)) { |
| 159 | continue |
| 160 | } |
| 161 | if (file.isDirectory()) { |
| 162 | await recursivelyGatherFilesHelper( |
| 163 | basePath, |
| 164 | resolve(path, file.name), |
| 165 | files, |
| 166 | ignore, |
| 167 | ) |
| 168 | } else { |
| 169 | const filePath = resolve(path, file.name) |
| 170 | files[toCleanPath(filePath, basePath)] = await readFileHelper(filePath) |
| 171 | } |
| 172 | } |
| 173 | } |
| 174 | |
| 175 | export async function recursivelyGatherFiles( |
| 176 | path: string, |
no test coverage detected