File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -82,7 +82,7 @@ function initOpts () {
82
82
prompt : {
83
83
message : 'Author:' ,
84
84
default : ( promptInput , allInput ) => {
85
- return allInput . author || git . author ( { cwd : allInput . cwd } )
85
+ return allInput . author
86
86
}
87
87
}
88
88
} ,
@@ -239,12 +239,24 @@ async function readPackageJson (options, { log } = {}) {
239
239
// ignore if missing or unreadable
240
240
}
241
241
242
+ let author
243
+ if ( ! pkg || ! pkg . author ) {
244
+ const gitAuthor = await git . author ( { cwd : opts . cwd } )
245
+ if ( gitAuthor ) {
246
+ author = gitAuthor
247
+ }
248
+ } else if ( pkg && typeof pkg . author === 'string' ) {
249
+ author = pkg . author
250
+ } else if ( pkg && typeof pkg . author !== 'undefined' ) {
251
+ author = `${ pkg . author . name } ${ pkg . author . email ? ` <${ pkg . author . email } >` : '' } `
252
+ }
253
+
242
254
// Set defaults from the package.json
243
255
options . defaults ( {
244
256
version : pkg . version ,
245
257
name : pkg . name ,
246
258
type : pkg . type ,
247
- author : pkg . author ,
259
+ author : author ,
248
260
description : pkg . description ,
249
261
repository : pkg . repository ,
250
262
keywords : pkg . keywords ,
You can’t perform that action at this time.
0 commit comments