Skip to content

Commit

Permalink
spec(create-vite): Add create-vite spec (#2127)
Browse files Browse the repository at this point in the history
  • Loading branch information
Zeko369 authored Nov 30, 2023
1 parent 58d563a commit d3440b0
Showing 1 changed file with 60 additions and 0 deletions.
60 changes: 60 additions & 0 deletions src/create-vite.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,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;

0 comments on commit d3440b0

Please sign in to comment.