feat(cli): Initialize a git repository and create an initial commit on scaffold#1484
feat(cli): Initialize a git repository and create an initial commit on scaffold#1484ryohidaka wants to merge 4 commits into
Conversation
✅ Deploy Preview for viteplus-preview canceled.
|
5daa636 to
d1fb08e
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 37a56e2176
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| await initGitRepository(workspaceInfo.rootDir); | ||
| await createInitialCommit(workspaceInfo.rootDir); |
There was a problem hiding this comment.
Limit initial commits to generated files
In an existing monorepo, opting into --git runs the commit from workspaceInfo.rootDir; createInitialCommit does git add -A, which stages every tracked/untracked change in that repo (confirmed via git add -h). If the user has unrelated dirty work anywhere in the monorepo, vp create ... --git will include it in the scaffold's "Initial commit" rather than only the new project/workspace edits.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
I think that no action is required about this either, for the reasons below.
| if (shouldSetupGit) { | ||
| updateCreateProgress('Creating initial commit'); | ||
| await createInitialCommit(fullPath); |
There was a problem hiding this comment.
Surface failed initial commits
createInitialCommit returns whether git commit succeeded, but this result is ignored here, so a common failure such as missing user.name/user.email or a failing pre-commit hook leaves the scaffold without the promised initial commit while the command still prints the normal success summary. Check the return value and show the captured git error or fail the command when --git was requested.
Useful? React with 👍 / 👎.
| await runViteFmt(fullPath, options.interactive, undefined, { silent: compactOutput }); | ||
| if (shouldSetupGit) { | ||
| updateCreateProgress('Creating initial commit'); | ||
| await createInitialCommit(fullPath); |
There was a problem hiding this comment.
Skip committing when setup steps failed
The initial commit is created even when the preceding install or formatter step failed; runViteInstall records status: 'failed' and runViteFmt returns a failed summary, but neither result gates this block. When vp install or vp fmt --write fails for a generated template, --git still commits the broken or partially generated state as the initial commit, making the user unwind that commit before fixing the scaffold.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
The return values of runViteInstall and runViteFmt are not checked anywhere else in the codebase, so restricting commits based on them would be inconsistent with existing patterns.
I will skip this part.
39a7bbc to
9512eeb
Compare
fengmk2
left a comment
There was a problem hiding this comment.
@ryohidaka Nice job! I will test it before merge. Thanks!
|
@ryohidaka can you take a look at the review comments from the codex? |
a4baf73 to
7918e74
Compare
a968afd to
e7e3570
Compare
e7e3570 to
5e3e3e4
Compare
5e3e3e4 to
fb9a6f4
Compare
fb9a6f4 to
9e56dfc
Compare
9e56dfc to
ecaaefe
Compare
ecaaefe to
cd4dfe7
Compare
cd4dfe7 to
c46b8be
Compare
0abc641 to
9ef2832
Compare
Summary
Add a
--git/--no-gitflag tovp create.git initbefore installing dependencies,then
git add -A && git commit -m "Initial commit from Vite+"after formatting completesTesting
snap-tests-globalbootstrap-cliand confirm that it worksCloses #1483