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 @@ -91,7 +91,7 @@ function initOpts () {
91
91
prompt : {
92
92
message : 'Repository:' ,
93
93
default : ( promptInput , allInput ) => {
94
- return allInput . repository || git . remote ( { cwd : allInput . cwd } )
94
+ return allInput . repository
95
95
}
96
96
}
97
97
} ,
@@ -251,14 +251,26 @@ async function readPackageJson (options, { log } = {}) {
251
251
author = `${ pkg . author . name } ${ pkg . author . email ? ` <${ pkg . author . email } >` : '' } `
252
252
}
253
253
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
+
254
266
// Set defaults from the package.json
255
267
options . defaults ( {
256
268
version : pkg . version ,
257
269
name : pkg . name ,
258
270
type : pkg . type ,
259
271
author : author ,
260
272
description : pkg . description ,
261
- repository : pkg . repository ,
273
+ repository : repo ,
262
274
keywords : pkg . keywords ,
263
275
scripts : pkg . scripts ,
264
276
license : pkg . license
You can’t perform that action at this time.
0 commit comments