-
-
Notifications
You must be signed in to change notification settings - Fork 338
Expand file tree
/
Copy pathsandbox.ts
More file actions
50 lines (42 loc) · 1.09 KB
/
sandbox.ts
File metadata and controls
50 lines (42 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import { type Framework } from '~/libraries'
export const getInitialSandboxFileName = (
framework: Framework,
libraryId?: string
) => {
if (libraryId && ['start', 'router'].includes(libraryId)) {
return 'src/routes/__root.tsx'
}
const dir = 'src'
return `${dir}/${getFrameworkStartFileName(framework, libraryId)}` as const
}
export function getFrameworkStartFileName(
framework: Framework,
libraryId?: string
) {
const file =
framework === 'angular'
? 'app.component'
: ['svelte', 'vue'].includes(framework)
? 'App'
: ['form', 'query'].includes(libraryId!)
? 'index'
: 'main'
const ext =
framework === 'svelte'
? 'svelte'
: framework === 'vue'
? 'vue'
: ['angular', 'lit'].includes(framework)
? 'ts'
: 'tsx'
return `${file}.${ext}` as const
}
export const getInitialExplorerFileName = (
framework: Framework,
libraryId?: string
) => {
if (libraryId && ['start', 'router'].includes(libraryId)) {
return 'src/routes/__root.tsx'
}
return getFrameworkStartFileName(framework, libraryId)
}