Skip to content

Commit beb49b3

Browse files
committed
fix(create): context-aware hint on the built-in escape-hatch entry
The escape-hatch entry's hint read "Use defaults (monorepo / application / library / generator)" in all contexts. Two problems inside an existing monorepo: - `vite:monorepo` gets refused at scaffold time ("Cannot create a monorepo inside an existing monorepo", bin.ts:468-472). - `vite:generator` is never part of `getInitialTemplateOptions` — it's only reachable via an explicit `vp create vite:generator`. So the hint was over-promising. Now it mirrors what `getInitialTemplateOptions(isMonorepo)` actually offers: - outside a monorepo: "Use defaults (monorepo / application / library)" - inside a monorepo: "Use defaults (application / library)" RFC examples updated to match, plus a one-sentence note explaining that the hint is context-aware.
1 parent 71dd73f commit beb49b3

2 files changed

Lines changed: 15 additions & 3 deletions

File tree

packages/cli/src/create/org-picker.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,16 @@ export async function pickOrgTemplate(
4444
label: entry.name,
4545
hint: entry.description,
4646
}));
47+
// Mirror `getInitialTemplateOptions(isMonorepo)`: `monorepo` is hidden
48+
// inside an existing monorepo (and would be rejected at scaffold time
49+
// anyway); `generator` isn't part of the builtin picker at all.
50+
const builtinHint = opts.isMonorepo
51+
? 'Use defaults (application / library)'
52+
: 'Use defaults (monorepo / application / library)';
4753
options.push({
4854
value: BUILTIN_ESCAPE_VALUE,
4955
label: 'Vite+ built-in templates',
50-
hint: 'Use defaults (monorepo / application / library / generator)',
56+
hint: builtinHint,
5157
});
5258

5359
const picked = await prompts.select({

rfcs/create-org-default-templates.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -395,9 +395,15 @@ templates" entry. Selecting it drops the user into the existing
395395
server Server template (Node + Fastify)
396396
library TypeScript library template
397397
──────────────────
398-
› Vite+ built-in templates Use defaults (monorepo / application / library / generator)
398+
› Vite+ built-in templates Use defaults (monorepo / application / library)
399399
```
400400

401+
The hint trailing "Vite+ built-in templates" matches what
402+
`getInitialTemplateOptions` actually offers for the current workspace
403+
context — inside an existing monorepo the hint reads "Use defaults
404+
(application / library)" since `vite:monorepo` is filtered out and
405+
`vite:generator` isn't part of the picker.
406+
401407
Rules:
402408

403409
- The escape-hatch entry is appended by Vite+, not by the org manifest. It
@@ -449,7 +455,7 @@ below), followed by a trailing **Vite+ built-in templates** entry (see
449455
server Server template (Node + Fastify)
450456
library TypeScript library template
451457
──────────────────
452-
› Vite+ built-in templates Use defaults (monorepo / application / library / generator)
458+
› Vite+ built-in templates Use defaults (monorepo / application / library)
453459
```
454460

455461
### Context-aware filtering

0 commit comments

Comments
 (0)