Skip to content

Commit 8116cbd

Browse files
authored
feat(create-vite): support create-vite-extra (#10214)
1 parent e793df3 commit 8116cbd

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

packages/create-vite/src/index.ts

+18-4
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,13 @@ const FRAMEWORKS: Framework[] = [
7373
},
7474
{
7575
name: 'custom-create-vue',
76-
display: 'Customize with create-vue',
76+
display: 'Customize with create-vue',
7777
color: green,
7878
customCommand: 'npm create vue@latest TARGET_DIR'
7979
},
8080
{
8181
name: 'custom-nuxt',
82-
display: 'Nuxt',
82+
display: 'Nuxt',
8383
color: lightGreen,
8484
customCommand: 'npm exec nuxi init TARGET_DIR'
8585
}
@@ -153,11 +153,24 @@ const FRAMEWORKS: Framework[] = [
153153
},
154154
{
155155
name: 'custom-svelte-kit',
156-
display: 'SvelteKit',
156+
display: 'SvelteKit',
157157
color: red,
158158
customCommand: 'npm create svelte@latest TARGET_DIR'
159159
}
160160
]
161+
},
162+
{
163+
name: 'others',
164+
display: 'Others',
165+
color: reset,
166+
variants: [
167+
{
168+
name: 'create-vite-extra',
169+
display: 'create-vite-extra ↗',
170+
color: reset,
171+
customCommand: 'npm create vite-extra@latest TARGET_DIR'
172+
}
173+
]
161174
}
162175
]
163176

@@ -279,14 +292,15 @@ async function init() {
279292
}
280293

281294
// determine template
282-
const template: string = variant || framework || argTemplate
295+
const template: string = variant || framework?.name || argTemplate
283296

284297
const pkgInfo = pkgFromUserAgent(process.env.npm_config_user_agent)
285298
const pkgManager = pkgInfo ? pkgInfo.name : 'npm'
286299
const isYarn1 = pkgManager === 'yarn' && pkgInfo?.version.startsWith('1.')
287300

288301
const { customCommand } =
289302
FRAMEWORKS.flatMap((f) => f.variants).find((v) => v.name === template) ?? {}
303+
290304
if (customCommand) {
291305
const fullCustomCommand = customCommand
292306
.replace('TARGET_DIR', targetDir)

0 commit comments

Comments
 (0)