Skip to content

Commit cd4dfe7

Browse files
committed
fix(cli): respect --no-git flag when scaffolding monorepo
* #1484 (comment)
1 parent 6232ecf commit cd4dfe7

3 files changed

Lines changed: 4 additions & 4 deletions

File tree

packages/cli/snap-tests-global/new-vite-monorepo-bun/snap.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ No pnpm-workspace.yaml
4949
No .yarnrc.yml
5050

5151
> test -d vite-plus-monorepo/.git && echo 'Git initialized' || echo 'No git' # check git init
52-
Git initialized
52+
No git
5353

5454
> ls vite-plus-monorepo/apps # check apps directory
5555
website

packages/cli/snap-tests-global/new-vite-monorepo/snap.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ peerDependencyRules:
7575
No .yarnrc.yml
7676

7777
> test -d vite-plus-monorepo/.git && echo 'Git initialized' || echo 'No git' # check git init
78-
Git initialized
78+
No git
7979

8080
> ls vite-plus-monorepo/apps # check apps directory created
8181
website

packages/cli/src/create/bin.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -834,7 +834,7 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
834834
// #region Handle monorepo template
835835
if (templateInfo.command === BuiltinTemplate.monorepo || isBundledMonorepo) {
836836
// Ask up-front so the prompt isn't buried under scaffold output.
837-
let shouldInitGit = true;
837+
let shouldInitGit = shouldSetupGit;
838838
if (options.interactive && !compactOutput) {
839839
pauseCreateProgress();
840840
const selected = await prompts.confirm({
@@ -848,7 +848,7 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
848848
} else {
849849
shouldInitGit = selected;
850850
}
851-
} else if (!compactOutput) {
851+
} else if (shouldInitGit && !compactOutput) {
852852
prompts.log.info('Initializing git repository (default: yes)');
853853
}
854854

0 commit comments

Comments
 (0)