File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -91,7 +91,7 @@ function initOpts () {
9191 prompt : {
9292 message : 'Repository:' ,
9393 default : ( promptInput , allInput ) => {
94- return allInput . repository || git . remote ( { cwd : allInput . cwd } )
94+ return allInput . repository
9595 }
9696 }
9797 } ,
@@ -251,14 +251,26 @@ async function readPackageJson (options, { log } = {}) {
251251 author = `${ pkg . author . name } ${ pkg . author . email ? ` <${ pkg . author . email } >` : '' } `
252252 }
253253
254+ let repo
255+ if ( ! pkg || ! pkg . repository ) {
256+ const gitRemote = await git . remote ( { cwd : opts . cwd } )
257+ if ( gitRemote ) {
258+ repo = gitRemote
259+ }
260+ } else if ( pkg && typeof pkg . repository === 'string' ) {
261+ repo = pkg . repository
262+ } else if ( pkg && typeof pkg . repository !== 'undefined' && pkg . repository . url ) {
263+ repo = pkg . repository . url
264+ }
265+
254266 // Set defaults from the package.json
255267 options . defaults ( {
256268 version : pkg . version ,
257269 name : pkg . name ,
258270 type : pkg . type ,
259271 author : author ,
260272 description : pkg . description ,
261- repository : pkg . repository ,
273+ repository : repo ,
262274 keywords : pkg . keywords ,
263275 scripts : pkg . scripts ,
264276 license : pkg . license
You can’t perform that action at this time.
0 commit comments