From 595b6a564ed906825ac8388b168ceee51f0df340 Mon Sep 17 00:00:00 2001 From: userquin Date: Tue, 14 May 2024 21:11:50 +0200 Subject: [PATCH] feat: add vitepress template --- src/customize/index.ts | 4 ++++ src/customize/vitepress.ts | 5 +++++ src/index.ts | 1 + src/prompts.ts | 14 +++++++++++++- src/types.ts | 2 +- 5 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 src/customize/vitepress.ts diff --git a/src/customize/index.ts b/src/customize/index.ts index e21595c..62e2e6a 100644 --- a/src/customize/index.ts +++ b/src/customize/index.ts @@ -15,6 +15,10 @@ export async function customize(prompts: PromptsData) { case 'vue-ts': await import('./vue').then(({ customize }) => customize(prompts)) break + case 'vitepress': + case 'vitepress-ts': + await import('./vitepress').then(({ customize }) => customize(prompts)) + break case 'react': case 'react-ts': await import('./react').then(({ customize }) => customize(prompts)) diff --git a/src/customize/vitepress.ts b/src/customize/vitepress.ts new file mode 100644 index 0000000..ad315a3 --- /dev/null +++ b/src/customize/vitepress.ts @@ -0,0 +1,5 @@ +import type { PromptsData } from '../types' + +export function customize(_prompts: PromptsData) { + +} diff --git a/src/index.ts b/src/index.ts index 4e9828a..8ac872e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -325,6 +325,7 @@ async function init() { const [command, ...args] = fullCustomCommand.split(' ') // we replace TARGET_DIR here because targetDir may include a space const replacedArgs = args.map(arg => arg.replace('TARGET_DIR', targetDir)) + console.log(replacedArgs) const { status } = spawn.sync(command, replacedArgs, { stdio: 'inherit', }) diff --git a/src/prompts.ts b/src/prompts.ts index 59db0a3..46774a2 100644 --- a/src/prompts.ts +++ b/src/prompts.ts @@ -55,6 +55,18 @@ export const FRAMEWORKS = ([ customCommand: 'npm exec nuxi init TARGET_DIR', enabled: true, }, + { + name: 'vitepress-ts', + display: 'VitePress + TypeScript', + color: blue, + enabled: true, + }, + { + name: 'vitepress', + display: 'VitePress + JavaScript', + color: yellow, + enabled: true, + }, ], }, { @@ -159,7 +171,7 @@ export const FRAMEWORKS = ([ { name: 'custom-svelte-kit', display: 'SvelteKit ↗', - color: red, + color: cyan, customCommand: 'npm create svelte@latest TARGET_DIR', enabled: true, }, diff --git a/src/types.ts b/src/types.ts index f33b230..107868f 100644 --- a/src/types.ts +++ b/src/types.ts @@ -10,7 +10,7 @@ export interface Framework { export type FrameworkVariantKey = | 'vanilla' | 'vanilla-ts' - | 'vue' | 'vue-ts' | 'custom-nuxt' + | 'vue' | 'vue-ts' | 'custom-nuxt' | 'vitepress' | 'vitepress-ts' | 'react' | 'react-ts' | 'preact' | 'preact-ts' | 'svelte' | 'svelte-ts' | 'custom-svelte-kit'