| 157 | } |
| 158 | |
| 159 | async function writeProjectReadme(targetDir) { |
| 160 | const destPath = join(targetDir, 'README.md'); |
| 161 | try { |
| 162 | await stat(destPath); |
| 163 | // README already exists — skip to avoid overwriting user content |
| 164 | return; |
| 165 | } catch { |
| 166 | // does not exist — write it |
| 167 | } |
| 168 | const readmePath = join(__dirname, 'readme', 'README.md'); |
| 169 | const content = await readFile(readmePath, 'utf-8'); |
| 170 | await writeFile(destPath, content, 'utf-8'); |
| 171 | } |
| 172 | |
| 173 | async function copyCommonTemplates(targetDir) { |
| 174 | const entries = await getTemplateEntries(TEMPLATES_DIR); |