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 {
26
26
27
27
const {
28
28
log,
29
+ warn,
29
30
error,
30
31
hasGit,
31
32
hasYarn,
@@ -158,14 +159,19 @@ module.exports = class Creator {
158
159
}
159
160
160
161
// commit initial state
162
+ let gitCommitFailed = false
161
163
if ( shouldInitGit ) {
162
164
await run ( 'git add -A' )
163
165
if ( isTestOrDebug ) {
164
166
await run ( 'git' , [ 'config' , 'user.name' , 'test' ] )
165
167
await run ( 'git' , [ 'config' , 'user.email' , 'test@test.com' ] )
166
168
}
167
169
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
+ }
169
175
}
170
176
171
177
// log instructions
@@ -179,6 +185,13 @@ module.exports = class Creator {
179
185
)
180
186
log ( )
181
187
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
+
182
195
generator . printExitLogs ( )
183
196
}
184
197
You can’t perform that action at this time.
0 commit comments