MCPcopy Create free account
hub / github.com/TanStack/cli / normalizeSourceExtension

Function normalizeSourceExtension

packages/create/src/edge-template-file.ts:26–46  ·  view source on GitHub ↗
(target: string, typescript: boolean)

Source from the content-addressed store, hash-verified

24}
25
26function 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
48export function createTemplateFile(environment: Environment, options: Options) {
49 function getPackageManagerAddScript(

Callers 1

createTemplateFileFunction · 0.70

Calls 1

replaceMethod · 0.65

Tested by

no test coverage detected