File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,8 @@ const git = require('simple-git/promise')
33const { readJson } = require ( './utils' )
44
55
6+ const gitUrlRegexp = / ( ( g i t | s s h | h t t p ( s ) ? ) | ( g i t @ [ \w . ] + ) ) ( : ( \/ \/ ) ? ) ( [ \w . @ : / \- ~ ] + ) ( \. g i t ) ( \/ ) ? $ /
7+
68module . exports = async path => {
79 const view = { }
810
@@ -11,9 +13,14 @@ module.exports = async path => {
1113 view . name = config . name ,
1214 view . version = config . version
1315 view . description = config . description
14- view . repository = config . repository
1516 view . keywords = config . keywords
1617 view . author = config . author
18+
19+ if ( typeof config . repository === 'string' && gitUrlRegexp . test ( config . repository ) ) {
20+ view . repository = { url : config . repository }
21+ } else if ( typeof config . repository === 'object' ) {
22+ view . repository = config . repository
23+ }
1724 } catch ( e ) {
1825 // NOTE: don't care
1926 }
You can’t perform that action at this time.
0 commit comments