(files: string[])
| 278 | } |
| 279 | |
| 280 | export function findMainSourceFolder(files: string[]) { |
| 281 | let mainFolder = ''; |
| 282 | let mainFolderCount = 0; |
| 283 | let rawFolders = files.map(filepath => { |
| 284 | let shortPath = filepath.replace(process.cwd() + path.sep, ''); |
| 285 | return path.dirname(shortPath); |
| 286 | }); |
| 287 | let folders = {}; |
| 288 | rawFolders = _.uniq(rawFolders); |
| 289 | |
| 290 | for (let i = 0; i < rawFolders.length; i++) { |
| 291 | let sep = rawFolders[i].split(path.sep); |
| 292 | sep.forEach(folder => { |
| 293 | if (folders[folder]) { |
| 294 | folders[folder] += 1; |
| 295 | } else { |
| 296 | folders[folder] = 1; |
| 297 | } |
| 298 | }); |
| 299 | } |
| 300 | for (let f in folders) { |
| 301 | if (folders[f] > mainFolderCount) { |
| 302 | mainFolderCount = folders[f]; |
| 303 | mainFolder = f; |
| 304 | } |
| 305 | } |
| 306 | return mainFolder; |
| 307 | } |
| 308 | |
| 309 | // Create a compilerHost object to allow the compiler to read and write files |
| 310 | export function compilerHost(transpileOptions: any): ts.CompilerHost { |
no test coverage detected
searching dependent graphs…