-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
/
Copy pathcreate-vite.ts
60 lines (57 loc) · 1.87 KB
/
create-vite.ts
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
51
52
53
54
55
56
57
58
59
60
const FAVICONS = {
vanilla:
"https://upload.wikimedia.org/wikipedia/commons/6/6a/JavaScript-logo.png?20120221235433",
"vanilla-ts": "https://www.typescriptlang.org/favicon-32x32.png",
vue: "https://raw.githubusercontent.com/vuejs/art/a1c78b74569b70a25300925b4eacfefcc143b8f6/logo.svg",
react:
"https://upload.wikimedia.org/wikipedia/commons/thumb/a/a7/React-icon.svg/1024px-React-icon.svg.png",
preact: "https://avatars.githubusercontent.com/u/26872990?s=200&v=4",
svelte:
"https://raw.githubusercontent.com/sveltejs/branding/2af7bc72f1bf5152dab89bee1ee2093b1be0824d/svelte-logo.svg",
solid: "https://www.solidjs.com/img/logo/without-wordmark/logo.svg",
lit: "https://avatars.githubusercontent.com/u/18489846?s=200&v=4",
qwik: "https://qwik.builder.io/favicons/favicon.svg",
};
const iconWrap = (name: string): Fig.Suggestion => {
const icon = FAVICONS[name] || FAVICONS[name.split("-")[0]];
return { name, icon };
};
const spec: Fig.Spec = {
name: "create-vite",
description: "Create a new project powered by Vite",
icon: "https://vitejs.dev/logo.svg",
args: {
name: "projectName",
description: "Project name",
},
options: [
{
name: "--template",
isRequired: true,
args: {
name: "template",
suggestions: [
iconWrap("vanilla"),
iconWrap("vanilla-ts"),
iconWrap("vue"),
iconWrap("vue-ts"),
iconWrap("react"),
iconWrap("react-ts"),
iconWrap("react-swc"),
iconWrap("react-swc-ts"),
iconWrap("preact"),
iconWrap("preact-ts"),
iconWrap("lit"),
iconWrap("lit-ts"),
iconWrap("svelte"),
iconWrap("svelte-ts"),
iconWrap("solid"),
iconWrap("solid-ts"),
iconWrap("qwik"),
iconWrap("qwik-ts"),
],
},
},
],
};
export default spec;