Skip to content

Commit 52a4778

Browse files
authored
fix(create): skip hooks prompt in monorepo and enable verbose for remote templates (#764)
- Skip pre-commit hooks prompt when running `vp create` inside a monorepo, since hooks are managed at the monorepo root - Enable verbose mode by default for non-builtin templates (e.g.,` ``@tanstack/create-start`, custom templates) so their interactive CLI output is visible - Skip git init prompt in monorepo template when running in silent mode closes VP-238
1 parent 5d087b7 commit 52a4778

2 files changed

Lines changed: 12 additions & 3 deletions

File tree

packages/cli/src/create/bin.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ function showCreateSummary(options: {
346346

347347
async function main() {
348348
const { templateName, options, templateArgs } = parseArgs();
349-
const compactOutput = !options.verbose;
349+
let compactOutput = !options.verbose;
350350

351351
// #region Handle help flag
352352
if (options.help) {
@@ -513,6 +513,13 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
513513
}
514514

515515
const isBuiltinTemplate = selectedTemplateName.startsWith('vite:');
516+
517+
// Remote templates (e.g., @tanstack/create-start, custom templates) run their own
518+
// interactive CLI, so verbose mode is needed to show their output.
519+
if (!isBuiltinTemplate) {
520+
compactOutput = false;
521+
}
522+
516523
if (targetDir && !isBuiltinTemplate) {
517524
cancelAndExit('The --directory option is only available for builtin templates', 1);
518525
}
@@ -687,7 +694,9 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
687694
onCancel: () => cancelAndExit(),
688695
}));
689696

690-
shouldSetupHooks = await promptGitHooks(options);
697+
if (!isMonorepo) {
698+
shouldSetupHooks = await promptGitHooks(options);
699+
}
691700

692701
const createProgress =
693702
options.interactive && compactOutput ? prompts.spinner({ indicator: 'timer' }) : undefined;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export async function executeMonorepoTemplate(
3232

3333
// Ask user to init git repository before creation starts.
3434
let initGit = true; // Default to yes
35-
if (interactive) {
35+
if (interactive && !options?.silent) {
3636
const selected = await prompts.confirm({
3737
message: `Initialize git repository:`,
3838
initialValue: true,

0 commit comments

Comments
 (0)