(target: string, typescript: boolean)
| 24 | } |
| 25 | |
| 26 | function normalizeSourceExtension(target: string, typescript: boolean) { |
| 27 | if (!typescript) { |
| 28 | return target |
| 29 | } |
| 30 | |
| 31 | const normalizedTarget = target.replace(/\\/g, '/') |
| 32 | |
| 33 | if (!normalizedTarget.startsWith('src/')) { |
| 34 | return target |
| 35 | } |
| 36 | |
| 37 | if (normalizedTarget.endsWith('.js')) { |
| 38 | return `${target.slice(0, -3)}.ts` |
| 39 | } |
| 40 | |
| 41 | if (normalizedTarget.endsWith('.jsx')) { |
| 42 | return `${target.slice(0, -4)}.tsx` |
| 43 | } |
| 44 | |
| 45 | return target |
| 46 | } |
| 47 | |
| 48 | export function createTemplateFile(environment: Environment, options: Options) { |
| 49 | function getPackageManagerAddScript( |
no test coverage detected