-
-
Notifications
You must be signed in to change notification settings - Fork 328
Expand file tree
/
Copy pathsandbox.ts
More file actions
39 lines (33 loc) · 938 Bytes
/
sandbox.ts
File metadata and controls
39 lines (33 loc) · 938 Bytes
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
import { type Framework } from '~/libraries'
export const getExampleStartingPath = (
framework: Framework,
libraryId?: string,
) => {
if (libraryId && ['start', 'router'].includes(libraryId)) {
return 'src/routes/__root.tsx'
}
const dir = framework === 'angular' ? 'src/app' : 'src'
return `${dir}/${getExampleStartingFileName(framework, libraryId)}` as const
}
export function getExampleStartingFileName(
framework: Framework,
libraryId?: string,
) {
const file =
framework === 'angular'
? 'app.component'
: ['svelte', 'vue'].includes(framework)
? 'App'
: ['form', 'query', 'pacer', 'hotkeys'].includes(libraryId!)
? 'index'
: 'main'
const ext =
framework === 'svelte'
? 'svelte'
: framework === 'vue'
? 'vue'
: ['angular', 'lit'].includes(framework)
? 'ts'
: 'tsx'
return `${file}.${ext}` as const
}