Skip to content

Commit b68b042

Browse files
committed
Merge remote-tracking branch 'origin/main' into pr-2009
2 parents baaecc9 + 36535c3 commit b68b042

8 files changed

Lines changed: 7 additions & 77 deletions

File tree

packages/cli/snap-tests-global/command-create-help/snap.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Options:
1919
--no-agent Skip writing coding agent instructions
2020
--editor NAME Write editor config files for the specified editor.
2121
--no-editor Skip writing editor config files
22-
--git Initialize a git repository with an initial commit
22+
--git Initialize a git repository
2323
--no-git Skip git repository initialization
2424
--hooks Set up pre-commit hooks (default in non-interactive mode)
2525
--no-hooks Skip pre-commit hooks setup
@@ -85,7 +85,7 @@ Options:
8585
--no-agent Skip writing coding agent instructions
8686
--editor NAME Write editor config files for the specified editor.
8787
--no-editor Skip writing editor config files
88-
--git Initialize a git repository with an initial commit
88+
--git Initialize a git repository
8989
--no-git Skip git repository initialization
9090
--hooks Set up pre-commit hooks (default in non-interactive mode)
9191
--no-hooks Skip pre-commit hooks setup
@@ -151,7 +151,7 @@ Options:
151151
--no-agent Skip writing coding agent instructions
152152
--editor NAME Write editor config files for the specified editor.
153153
--no-editor Skip writing editor config files
154-
--git Initialize a git repository with an initial commit
154+
--git Initialize a git repository
155155
--no-git Skip git repository initialization
156156
--hooks Set up pre-commit hooks (default in non-interactive mode)
157157
--no-hooks Skip pre-commit hooks setup

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Options:
1919
--no-agent Skip writing coding agent instructions
2020
--editor NAME Write editor config files for the specified editor.
2121
--no-editor Skip writing editor config files
22-
--git Initialize a git repository with an initial commit
22+
--git Initialize a git repository
2323
--no-git Skip git repository initialization
2424
--hooks Set up pre-commit hooks (default in non-interactive mode)
2525
--no-hooks Skip pre-commit hooks setup

packages/cli/snap-tests/create-git-commit-fail/hooks/pre-commit

Lines changed: 0 additions & 3 deletions
This file was deleted.

packages/cli/snap-tests/create-git-commit-fail/snap.txt

Lines changed: 0 additions & 11 deletions
This file was deleted.

packages/cli/snap-tests/create-git-commit-fail/steps.json

Lines changed: 0 additions & 11 deletions
This file was deleted.

packages/cli/src/create/bin.ts

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ import {
3636
resolveApproveBuildTargets,
3737
} from '../utils/approve-builds.ts';
3838
import { detectExistingEditors, selectEditors, writeEditorConfigs } from '../utils/editor.ts';
39-
import { createInitialCommit, initGitRepository } from '../utils/git.ts';
39+
import { initGitRepository } from '../utils/git.ts';
4040
import { renderCliDoc } from '../utils/help.ts';
4141
import { readJsonFile } from '../utils/json.ts';
4242
import { displayRelative } from '../utils/path.ts';
@@ -128,7 +128,7 @@ const helpMessage = renderCliDoc({
128128
description: 'Write editor config files for the specified editor.',
129129
},
130130
{ label: '--no-editor', description: 'Skip writing editor config files' },
131-
{ label: '--git', description: 'Initialize a git repository with an initial commit' },
131+
{ label: '--git', description: 'Initialize a git repository' },
132132
{ label: '--no-git', description: 'Skip git repository initialization' },
133133
{
134134
label: '--hooks',
@@ -1135,16 +1135,6 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
11351135
await handleIgnoredBuilds(fullPath, fullPath, installSummary);
11361136
updateCreateProgress('Formatting code');
11371137
await runViteFmt(fullPath, options.interactive, undefined, { silent: compactOutput });
1138-
if (shouldSetupGit) {
1139-
updateCreateProgress('Creating initial commit');
1140-
const commitResult = await createInitialCommit(fullPath);
1141-
if (!commitResult.success) {
1142-
prompts.log.warn('Initial commit failed');
1143-
if (commitResult.output) {
1144-
prompts.log.info(commitResult.output);
1145-
}
1146-
}
1147-
}
11481138
clearCreateProgress();
11491139
showCreateSummary({
11501140
description: describeScaffold(selectedTemplateName, selectedTemplateArgs),
@@ -1459,16 +1449,6 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
14591449
await handleIgnoredBuilds(fullPath, fullPath, installSummary);
14601450
updateCreateProgress('Formatting code');
14611451
await runViteFmt(fullPath, options.interactive, undefined, { silent: compactOutput });
1462-
if (shouldSetupGit) {
1463-
updateCreateProgress('Creating initial commit');
1464-
const commitResult = await createInitialCommit(fullPath);
1465-
if (!commitResult.success) {
1466-
prompts.log.warn('Initial commit failed');
1467-
if (commitResult.output) {
1468-
prompts.log.info(commitResult.output);
1469-
}
1470-
}
1471-
}
14721452
}
14731453

14741454
clearCreateProgress();

packages/cli/src/utils/git.ts

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -9,28 +9,3 @@ export async function initGitRepository(cwd: string): Promise<boolean> {
99
});
1010
return result.exitCode === 0;
1111
}
12-
13-
export interface InitialCommitResult {
14-
success: boolean;
15-
/** Combined stdout/stderr from `git commit`, for diagnosing failures (e.g. a failing pre-commit hook). */
16-
output: string;
17-
}
18-
19-
export async function createInitialCommit(cwd: string): Promise<InitialCommitResult> {
20-
await runCommandSilently({
21-
command: 'git',
22-
args: ['add', '-A'],
23-
cwd,
24-
envs: process.env,
25-
});
26-
const result = await runCommandSilently({
27-
command: 'git',
28-
args: ['commit', '-m', 'Initial commit from Vite+'],
29-
cwd,
30-
envs: process.env,
31-
});
32-
return {
33-
success: result.exitCode === 0,
34-
output: `${result.stdout.toString()}${result.stderr.toString()}`.trim(),
35-
};
36-
}

packages/cli/src/utils/prompts.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ export async function promptGitInit(options: {
260260
}
261261
if (options.interactive) {
262262
const selected = await prompts.confirm({
263-
message: 'Initialize a git repository with an initial commit?',
263+
message: 'Initialize a git repository?',
264264
initialValue: true,
265265
});
266266
if (prompts.isCancel(selected)) {

0 commit comments

Comments
 (0)