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