Skip to content

Commit e49a3b5

Browse files
authored
feat(create-vite): add TanStack Router commands (#19573)
1 parent a3a94ab commit e49a3b5

1 file changed

Lines changed: 23 additions & 2 deletions

File tree

packages/create-vite/src/index.ts

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,13 @@ const FRAMEWORKS: Framework[] = [
143143
color: cyan,
144144
customCommand: 'npm create react-router@latest TARGET_DIR',
145145
},
146+
{
147+
name: 'custom-tanstack-router',
148+
display: 'TanStack Router ↗',
149+
color: cyan,
150+
customCommand:
151+
'npm create -- tsrouter-app@latest TARGET_DIR --framework react',
152+
},
146153
],
147154
},
148155
{
@@ -223,6 +230,13 @@ const FRAMEWORKS: Framework[] = [
223230
display: 'JavaScript',
224231
color: yellow,
225232
},
233+
{
234+
name: 'custom-tanstack-router',
235+
display: 'TanStack Router ↗',
236+
color: cyan,
237+
customCommand:
238+
'npm create -- tsrouter-app@latest TARGET_DIR --framework solid',
239+
},
226240
],
227241
},
228242
{
@@ -606,13 +620,20 @@ function getFullCustomCommand(customCommand: string, pkgInfo?: PkgInfo) {
606620

607621
return (
608622
customCommand
609-
.replace(/^npm create /, () => {
623+
.replace(/^npm create (?:-- )?/, () => {
610624
// `bun create` uses it's own set of templates,
611625
// the closest alternative is using `bun x` directly on the package
612626
if (pkgManager === 'bun') {
613627
return 'bun x create-'
614628
}
615-
return `${pkgManager} create `
629+
// pnpm doesn't support the -- syntax
630+
if (pkgManager === 'pnpm') {
631+
return 'pnpm create '
632+
}
633+
// For other package managers, preserve the original format
634+
return customCommand.startsWith('npm create -- ')
635+
? `${pkgManager} create -- `
636+
: `${pkgManager} create `
616637
})
617638
// Only Yarn 1.x doesn't support `@version` in the `create` command
618639
.replace('@latest', () => (isYarn1 ? '' : '@latest'))

0 commit comments

Comments
 (0)