Skip to content

Commit f40e01e

Browse files
jong-kyungfengmk2
andauthored
fix(create): replace deprecated @tanstack/create-start with @tanstack/cli (#1259)
## Summary - Replace deprecated `@tanstack/create-start` with `@tanstack/cli create` when running `vp create @tanstack/start` - Add `create` subcommand prepend in `autoFixRemoteTemplateCommand` (following existing `sv` pattern) - Keep `--no-install`, `--no-toolchain`, `--no-git` (monorepo) auto-fix flags Closes #1238 Co-authored-by: MK (fengmk2) <fengmk2@gmail.com>
1 parent d0790a8 commit f40e01e

5 files changed

Lines changed: 24 additions & 14 deletions

File tree

packages/cli/snap-tests-global/new-check/snap.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ Vite+ Built-in Templates:
6969

7070
Popular Templates (shorthand):
7171
vite Official Vite templates (create-vite)
72-
@tanstack/start TanStack applications (@tanstack/create-start)
72+
@tanstack/start TanStack applications (@tanstack/cli create)
7373
next-app Next.js application (create-next-app)
7474
nuxt Nuxt application (create-nuxt)
7575
react-router React Router application (create-react-router)
@@ -79,7 +79,7 @@ Popular Templates (shorthand):
7979
Examples:
8080
vp create # interactive mode
8181
vp create vite # shorthand for create-vite
82-
vp create @tanstack/start # shorthand for @tanstack/create-start
82+
vp create @tanstack/start # shorthand for @tanstack/cli create
8383
vp create <template> -- <options> # pass options to the template
8484

8585
Tip:

packages/cli/src/create/__tests__/discovery.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ describe('expandCreateShorthand', () => {
2121
});
2222

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

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

3333
it('should not expand names already starting with create-', () => {

packages/cli/src/create/bin.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ const listTemplatesMessage = renderCliDoc({
155155
{ label: 'vite', description: 'Official Vite templates (create-vite)' },
156156
{
157157
label: '@tanstack/start',
158-
description: 'TanStack applications (@tanstack/create-start)',
158+
description: 'TanStack applications (@tanstack/cli create)',
159159
},
160160
{ label: 'next-app', description: 'Next.js application (create-next-app)' },
161161
{ label: 'nuxt', description: 'Nuxt application (create-nuxt)' },
@@ -169,7 +169,7 @@ const listTemplatesMessage = renderCliDoc({
169169
lines: [
170170
` ${accent('vp create')} ${muted('# interactive mode')}`,
171171
` ${accent('vp create vite')} ${muted('# shorthand for create-vite')}`,
172-
` ${accent('vp create @tanstack/start')} ${muted('# shorthand for @tanstack/create-start')}`,
172+
` ${accent('vp create @tanstack/start')} ${muted('# shorthand for @tanstack/cli create')}`,
173173
` ${accent('vp create <template> -- <options>')} ${muted('# pass options to the template')}`,
174174
],
175175
},
@@ -455,7 +455,7 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
455455

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

458-
// Remote templates (e.g., @tanstack/create-start, custom templates) run their own
458+
// Remote templates (e.g., @tanstack/cli, custom templates) run their own
459459
// interactive CLI, so verbose mode is needed to show their output.
460460
if (!isBuiltinTemplate) {
461461
compactOutput = false;

packages/cli/src/create/discovery.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,11 +133,11 @@ export function discoverTemplate(
133133
* This follows the same convention as `npm create` / `pnpm create`:
134134
* - `vite` → `create-vite`
135135
* - `vite@latest` → `create-vite@latest`
136-
* - `@tanstack/start` → `@tanstack/create-start`
137-
* - `@tanstack/start@latest` → `@tanstack/create-start@latest`
138136
*
139137
* Special cases for packages where the convention doesn't work:
140138
* - `nitro` → `create-nitro-app` (create-nitro is abandoned)
139+
* - `svelte` → `sv`
140+
* - `@tanstack/start` → `@tanstack/cli` (@tanstack/create-start is deprecated)
141141
*
142142
* Skips expansion for:
143143
* - Builtin templates (`vite:*`)
@@ -186,6 +186,12 @@ export function expandCreateShorthand(templateName: string): string {
186186
if (name.startsWith('create-')) {
187187
return templateName;
188188
}
189+
190+
// Special cases where the default convention doesn't apply
191+
if (scope === '@tanstack' && name === 'start') {
192+
return `@tanstack/cli${version}`;
193+
}
194+
189195
return `${scope}/create-${name}${version}`;
190196
}
191197

packages/cli/src/create/templates/remote.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export async function executeRemoteTemplate(
4242
// TODO: prompt for project name if not provided for degit
4343
// Template not found - use package manager runner (npx/pnpm dlx/etc.)
4444
if (!isGitHubTemplate) {
45-
// templateInfo.command is the npm package name (e.g. "create-vite", "@tanstack/create-start")
45+
// templateInfo.command is the npm package name (e.g. "create-vite", "@tanstack/cli")
4646
const packageExists = await checkNpmPackageExists(templateInfo.command);
4747
if (!packageExists) {
4848
if (!silent) {
@@ -106,7 +106,7 @@ export async function runRemoteTemplateCommand(
106106
}
107107

108108
function autoFixRemoteTemplateCommand(templateInfo: TemplateInfo, workspaceInfo: WorkspaceInfo) {
109-
// @tanstack/create-start@latest, create-vite@latest
109+
// @tanstack/cli@latest, create-vite@latest
110110
let packageName = templateInfo.command;
111111
const indexOfAt = packageName.indexOf('@', 2);
112112
if (indexOfAt !== -1) {
@@ -118,7 +118,11 @@ function autoFixRemoteTemplateCommand(templateInfo: TemplateInfo, workspaceInfo:
118118
templateInfo.args.push('--no-immediate');
119119
// don't present rolldown option to users
120120
templateInfo.args.push('--no-rolldown');
121-
} else if (packageName === '@tanstack/create-start') {
121+
} else if (packageName === '@tanstack/cli') {
122+
// ensure create command is used
123+
if (templateInfo.args[0] !== 'create') {
124+
templateInfo.args.unshift('create');
125+
}
122126
// don't run npm install after project creation
123127
templateInfo.args.push('--no-install');
124128
// don't setup toolchain automatically
@@ -136,7 +140,7 @@ function autoFixRemoteTemplateCommand(templateInfo: TemplateInfo, workspaceInfo:
136140
// don't run git init on monorepo
137141
if (packageName === 'create-nuxt') {
138142
templateInfo.args.push('--no-gitInit');
139-
} else if (packageName === '@tanstack/create-start') {
143+
} else if (packageName === '@tanstack/cli') {
140144
templateInfo.args.push('--no-git');
141145
}
142146
}

0 commit comments

Comments
 (0)