| 175 | } |
| 176 | |
| 177 | function destinationPathForSource(destPath: string, sourcePath: string): string { |
| 178 | const normalizedDestPath = destPath.replace(/\\/g, '/'); |
| 179 | const sourceExt = path.extname(sourcePath); |
| 180 | if (sourceExt.length === 0) return normalizedDestPath; |
| 181 | const parsed = path.posix.parse(normalizedDestPath); |
| 182 | if (parsed.ext.toLowerCase() === sourceExt.toLowerCase()) return normalizedDestPath; |
| 183 | return path.posix.join(parsed.dir, `${parsed.name}${sourceExt}`); |
| 184 | } |
| 185 | |
| 186 | export async function runScaffold(req: ScaffoldRequest): Promise<ScaffoldResult> { |
| 187 | let manifest: ScaffoldManifest; |