( folder: ResultDir, currentPath: string, createProjectFolder = true, fs: IFileSystem = systemFs, )
| 9 | } |
| 10 | |
| 11 | export const writeFolder = async ( |
| 12 | folder: ResultDir, |
| 13 | currentPath: string, |
| 14 | createProjectFolder = true, |
| 15 | fs: IFileSystem = systemFs, |
| 16 | ): Promise<void> => { |
| 17 | const { name, files, dirs } = folder; |
| 18 | |
| 19 | const folderPath = createProjectFolder ? join(currentPath, name) : currentPath; |
| 20 | |
| 21 | if (!fs.existsSync(folderPath)) { |
| 22 | await createDirectory(folderPath, fs); |
| 23 | } |
| 24 | |
| 25 | const promises = [ |
| 26 | writeFilesToFolder(folderPath, files, fs), |
| 27 | writeSubFoldersToFolder(folderPath, dirs, fs), |
| 28 | ]; |
| 29 | |
| 30 | await Promise.all(promises); |
| 31 | }; |
| 32 | |
| 33 | const writeFilesToFolder = async ( |
| 34 | folderPath: string, |
no test coverage detected
searching dependent graphs…