(filePath: string, data: string, projectRoot: string)
| 53 | } |
| 54 | |
| 55 | const carefullyWriteFile = async (filePath: string, data: string, projectRoot: string) => { |
| 56 | if (existsSync(filePath)) { |
| 57 | type Answers = { |
| 58 | overwrite: boolean |
| 59 | } |
| 60 | const answers = await inquirer.prompt<Answers>([ |
| 61 | { |
| 62 | type: 'confirm', |
| 63 | name: 'overwrite', |
| 64 | message: `Overwrite existing file .${filePath.replace(projectRoot, '')}?`, |
| 65 | }, |
| 66 | ]) |
| 67 | if (answers.overwrite) { |
| 68 | await writeFile(filePath, data) |
| 69 | } |
| 70 | } else { |
| 71 | await writeFile(filePath, data) |
| 72 | } |
| 73 | } |
| 74 | |
| 75 | const readDirectoryEntries = async (dir: string): Promise<string[]> => { |
| 76 | try { |
no test coverage detected