Skip to content

Commit ae74061

Browse files
nekomoyifengmk2
andauthored
fix(cli): use create-nitro-app instead of create-nitro for vp create nitro (#898)
This change explicitly maps `vp create nitro` to the maintained `create-nitro-app` package, fixing the issue where users got an unexpected Express template prompt instead of Nitro. Note: This differs from pnpm's behavior where `npm create nitro` still resolves to the `create-nitro` close #888 Co-authored-by: MK (fengmk2) <fengmk2@gmail.com>
1 parent 6644cee commit ae74061

2 files changed

Lines changed: 14 additions & 0 deletions

File tree

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,11 @@ describe('expandCreateShorthand', () => {
6363
it('should handle scope-only input gracefully', () => {
6464
expect(expandCreateShorthand('@scope')).toBe('@scope');
6565
});
66+
67+
it('should handle special cases where default convention does not apply', () => {
68+
expect(expandCreateShorthand('nitro')).toBe('create-nitro-app');
69+
expect(expandCreateShorthand('nitro@latest')).toBe('create-nitro-app@latest');
70+
});
6671
});
6772

6873
describe('GitHub template helpers', () => {

packages/cli/src/create/discovery.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,9 @@ export function discoverTemplate(
136136
* - `@tanstack/start` → `@tanstack/create-start`
137137
* - `@tanstack/start@latest` → `@tanstack/create-start@latest`
138138
*
139+
* Special cases for packages where the convention doesn't work:
140+
* - `nitro` → `create-nitro-app` (create-nitro is abandoned)
141+
*
139142
* Skips expansion for:
140143
* - Builtin templates (`vite:*`)
141144
* - GitHub URLs
@@ -190,6 +193,12 @@ export function expandCreateShorthand(templateName: string): string {
190193
if (name.startsWith('create-')) {
191194
return templateName;
192195
}
196+
197+
// Special cases where the default convention doesn't apply
198+
if (name === 'nitro') {
199+
return `create-nitro-app${version}`;
200+
}
201+
193202
return `create-${name}${version}`;
194203
}
195204

0 commit comments

Comments
 (0)