Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/guide/create.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Vite+ ships with these built-in templates:

`vp create` is not limited to the built-in templates.

- Use shorthand templates like `vite`, `@tanstack/start`, `next-app`, `nuxt`, `react-router`, and `vue`
- Use shorthand templates like `vite`, `@tanstack/start`, `svelte`, `next-app`, `nuxt`, `react-router`, and `vue`
- Use full package names like `create-vite` or `create-next-app`
- Use local templates such as `./tools/create-ui-component` or `@acme/generator-*`
- Use remote templates such as `github:user/repo` or `https://github.com/user/template-repo`
Expand Down Expand Up @@ -76,6 +76,7 @@ vp create vite:generator
# Use shorthand community templates
vp create vite
vp create @tanstack/start
vp create svelte

# Use full package names
vp create create-vite
Expand Down
3 changes: 3 additions & 0 deletions packages/cli/snap-tests-global/command-create-help/snap.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ Examples:
# Use existing templates (shorthand expands to create-* packages)
vp create vite
vp create @tanstack/start
vp create svelte
vp create vite -- --template react-ts

# Full package names also work
Expand Down Expand Up @@ -87,6 +88,7 @@ Examples:
# Use existing templates (shorthand expands to create-* packages)
vp create vite
vp create @tanstack/start
vp create svelte
vp create vite -- --template react-ts

# Full package names also work
Expand Down Expand Up @@ -141,6 +143,7 @@ Examples:
# Use existing templates (shorthand expands to create-* packages)
vp create vite
vp create @tanstack/start
vp create svelte
vp create vite -- --template react-ts

# Full package names also work
Expand Down
2 changes: 2 additions & 0 deletions packages/cli/snap-tests-global/new-check/snap.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ Examples:
# Use existing templates (shorthand expands to create-* packages)
vp create vite
vp create @tanstack/start
vp create svelte
vp create vite -- --template react-ts

# Full package names also work
Expand Down Expand Up @@ -71,6 +72,7 @@ Popular Templates (shorthand):
next-app Next.js application (create-next-app)
nuxt Nuxt application (create-nuxt)
react-router React Router application (create-react-router)
svelte Svelte application (sv create)
vue Vue application (create-vue)

Examples:
Expand Down
2 changes: 2 additions & 0 deletions packages/cli/src/create/__tests__/discovery.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ describe('expandCreateShorthand', () => {
it('should handle special cases where default convention does not apply', () => {
expect(expandCreateShorthand('nitro')).toBe('create-nitro-app');
expect(expandCreateShorthand('nitro@latest')).toBe('create-nitro-app@latest');
expect(expandCreateShorthand('svelte')).toBe('sv');
expect(expandCreateShorthand('svelte@latest')).toBe('sv@latest');
});
});

Expand Down
2 changes: 2 additions & 0 deletions packages/cli/src/create/bin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ const helpMessage = renderCliDoc({
` ${muted('# Use existing templates (shorthand expands to create-* packages)')}`,
` ${accent('vp create vite')}`,
` ${accent('vp create @tanstack/start')}`,
` ${accent('vp create svelte')}`,
` ${accent('vp create vite -- --template react-ts')}`,
'',
` ${muted('# Full package names also work')}`,
Expand Down Expand Up @@ -156,6 +157,7 @@ const listTemplatesMessage = renderCliDoc({
{ label: 'next-app', description: 'Next.js application (create-next-app)' },
{ label: 'nuxt', description: 'Nuxt application (create-nuxt)' },
{ label: 'react-router', description: 'React Router application (create-react-router)' },
{ label: 'svelte', description: 'Svelte application (sv create)' },
{ label: 'vue', description: 'Vue application (create-vue)' },
],
},
Expand Down
3 changes: 3 additions & 0 deletions packages/cli/src/create/discovery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,9 @@ export function expandCreateShorthand(templateName: string): string {
if (name === 'nitro') {
return `create-nitro-app${version}`;
}
if (name === 'svelte') {
return `sv${version}`;
}

return `create-${name}${version}`;
}
Expand Down
7 changes: 7 additions & 0 deletions packages/cli/src/create/templates/remote.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,13 @@ function autoFixRemoteTemplateCommand(templateInfo: TemplateInfo, workspaceInfo:
templateInfo.args.push('--no-install');
// don't setup toolchain automatically
templateInfo.args.push('--no-toolchain');
} else if (packageName === 'sv') {
// ensure create command is used
if (templateInfo.args[0] !== 'create') {
templateInfo.args.unshift('create');
}
// don't run npm install after project creation
templateInfo.args.push('--no-install');
}

if (workspaceInfo.isMonorepo) {
Expand Down
Loading