File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ const {
2626
2727const {
2828 log,
29+ warn,
2930 error,
3031 hasGit,
3132 hasYarn,
@@ -158,14 +159,19 @@ module.exports = class Creator {
158159 }
159160
160161 // commit initial state
162+ let gitCommitFailed = false
161163 if ( shouldInitGit ) {
162164 await run ( 'git add -A' )
163165 if ( isTestOrDebug ) {
164166 await run ( 'git' , [ 'config' , 'user.name' , 'test' ] )
165167 await run ( 'git' , [ 'config' , 'user.email' , 'test@test.com' ] )
166168 }
167169 const msg = typeof cliOptions . git === 'string' ? cliOptions . git : 'init'
168- await run ( 'git' , [ 'commit' , '-m' , msg ] )
170+ try {
171+ await run ( 'git' , [ 'commit' , '-m' , msg ] )
172+ } catch ( e ) {
173+ gitCommitFailed = true
174+ }
169175 }
170176
171177 // log instructions
@@ -179,6 +185,13 @@ module.exports = class Creator {
179185 )
180186 log ( )
181187
188+ if ( gitCommitFailed ) {
189+ warn (
190+ `Skipped git commit due to missing username and email in git config.\n` +
191+ `You will need to perform the initial commit yourself.\n`
192+ )
193+ }
194+
182195 generator . printExitLogs ( )
183196 }
184197
You can’t perform that action at this time.
0 commit comments