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
4 changes: 2 additions & 2 deletions packages/cli/snap-tests-global/new-check/snap.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ Vite+ Built-in Templates:

Popular Templates (shorthand):
vite Official Vite templates (create-vite)
@tanstack/start TanStack applications (@tanstack/create-start)
@tanstack/start TanStack applications (@tanstack/cli create)
next-app Next.js application (create-next-app)
nuxt Nuxt application (create-nuxt)
react-router React Router application (create-react-router)
Expand All @@ -79,7 +79,7 @@ Popular Templates (shorthand):
Examples:
vp create # interactive mode
vp create vite # shorthand for create-vite
vp create @tanstack/start # shorthand for @tanstack/create-start
vp create @tanstack/start # shorthand for @tanstack/cli create
vp create <template> -- <options> # pass options to the template

Tip:
Expand Down
6 changes: 3 additions & 3 deletions packages/cli/src/create/__tests__/discovery.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ describe('expandCreateShorthand', () => {
});

it('should expand scoped names to @scope/create-* packages', () => {
expect(expandCreateShorthand('@tanstack/start')).toBe('@tanstack/create-start');
expect(expandCreateShorthand('@tanstack/start')).toBe('@tanstack/cli');
expect(expandCreateShorthand('@my-org/app')).toBe('@my-org/create-app');
});

it('should expand scoped names with version', () => {
expect(expandCreateShorthand('@tanstack/start@latest')).toBe('@tanstack/create-start@latest');
expect(expandCreateShorthand('@tanstack/start@1.0.0')).toBe('@tanstack/create-start@1.0.0');
expect(expandCreateShorthand('@tanstack/start@latest')).toBe('@tanstack/cli@latest');
expect(expandCreateShorthand('@tanstack/start@1.0.0')).toBe('@tanstack/cli@1.0.0');
});

it('should not expand names already starting with create-', () => {
Expand Down
6 changes: 3 additions & 3 deletions packages/cli/src/create/bin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ const listTemplatesMessage = renderCliDoc({
{ label: 'vite', description: 'Official Vite templates (create-vite)' },
{
label: '@tanstack/start',
description: 'TanStack applications (@tanstack/create-start)',
description: 'TanStack applications (@tanstack/cli create)',
},
{ label: 'next-app', description: 'Next.js application (create-next-app)' },
{ label: 'nuxt', description: 'Nuxt application (create-nuxt)' },
Expand All @@ -169,7 +169,7 @@ const listTemplatesMessage = renderCliDoc({
lines: [
` ${accent('vp create')} ${muted('# interactive mode')}`,
` ${accent('vp create vite')} ${muted('# shorthand for create-vite')}`,
` ${accent('vp create @tanstack/start')} ${muted('# shorthand for @tanstack/create-start')}`,
` ${accent('vp create @tanstack/start')} ${muted('# shorthand for @tanstack/cli create')}`,
` ${accent('vp create <template> -- <options>')} ${muted('# pass options to the template')}`,
],
},
Expand Down Expand Up @@ -455,7 +455,7 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h

const isBuiltinTemplate = selectedTemplateName.startsWith('vite:');

// Remote templates (e.g., @tanstack/create-start, custom templates) run their own
// Remote templates (e.g., @tanstack/cli, custom templates) run their own
// interactive CLI, so verbose mode is needed to show their output.
if (!isBuiltinTemplate) {
compactOutput = false;
Expand Down
10 changes: 8 additions & 2 deletions packages/cli/src/create/discovery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,11 @@ export function discoverTemplate(
* This follows the same convention as `npm create` / `pnpm create`:
* - `vite` → `create-vite`
* - `vite@latest` → `create-vite@latest`
* - `@tanstack/start` → `@tanstack/create-start`
* - `@tanstack/start@latest` → `@tanstack/create-start@latest`
*
* Special cases for packages where the convention doesn't work:
* - `nitro` → `create-nitro-app` (create-nitro is abandoned)
* - `svelte` → `sv`
* - `@tanstack/start` → `@tanstack/cli` (@tanstack/create-start is deprecated)
*
* Skips expansion for:
* - Builtin templates (`vite:*`)
Expand Down Expand Up @@ -186,6 +186,12 @@ export function expandCreateShorthand(templateName: string): string {
if (name.startsWith('create-')) {
return templateName;
}

// Special cases where the default convention doesn't apply
if (scope === '@tanstack' && name === 'start') {
return `@tanstack/cli${version}`;
}

return `${scope}/create-${name}${version}`;
}

Expand Down
12 changes: 8 additions & 4 deletions packages/cli/src/create/templates/remote.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export async function executeRemoteTemplate(
// TODO: prompt for project name if not provided for degit
// Template not found - use package manager runner (npx/pnpm dlx/etc.)
if (!isGitHubTemplate) {
// templateInfo.command is the npm package name (e.g. "create-vite", "@tanstack/create-start")
// templateInfo.command is the npm package name (e.g. "create-vite", "@tanstack/cli")
const packageExists = await checkNpmPackageExists(templateInfo.command);
if (!packageExists) {
if (!silent) {
Expand Down Expand Up @@ -106,7 +106,7 @@ export async function runRemoteTemplateCommand(
}

function autoFixRemoteTemplateCommand(templateInfo: TemplateInfo, workspaceInfo: WorkspaceInfo) {
// @tanstack/create-start@latest, create-vite@latest
// @tanstack/cli@latest, create-vite@latest
let packageName = templateInfo.command;
const indexOfAt = packageName.indexOf('@', 2);
if (indexOfAt !== -1) {
Expand All @@ -118,7 +118,11 @@ function autoFixRemoteTemplateCommand(templateInfo: TemplateInfo, workspaceInfo:
templateInfo.args.push('--no-immediate');
// don't present rolldown option to users
templateInfo.args.push('--no-rolldown');
} else if (packageName === '@tanstack/create-start') {
} else if (packageName === '@tanstack/cli') {
// 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');
// don't setup toolchain automatically
Expand All @@ -136,7 +140,7 @@ function autoFixRemoteTemplateCommand(templateInfo: TemplateInfo, workspaceInfo:
// don't run git init on monorepo
if (packageName === 'create-nuxt') {
templateInfo.args.push('--no-gitInit');
} else if (packageName === '@tanstack/create-start') {
} else if (packageName === '@tanstack/cli') {
templateInfo.args.push('--no-git');
}
}
Expand Down
Loading