File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -82,7 +82,7 @@ function initOpts () {
8282 prompt : {
8383 message : 'Author:' ,
8484 default : ( promptInput , allInput ) => {
85- return allInput . author || git . author ( { cwd : allInput . cwd } )
85+ return allInput . author
8686 }
8787 }
8888 } ,
@@ -239,12 +239,24 @@ async function readPackageJson (options, { log } = {}) {
239239 // ignore if missing or unreadable
240240 }
241241
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+
242254 // Set defaults from the package.json
243255 options . defaults ( {
244256 version : pkg . version ,
245257 name : pkg . name ,
246258 type : pkg . type ,
247- author : pkg . author ,
259+ author : author ,
248260 description : pkg . description ,
249261 repository : pkg . repository ,
250262 keywords : pkg . keywords ,
You can’t perform that action at this time.
0 commit comments