@@ -14,15 +14,13 @@ const formatRepository = repository => {
1414 const matched = repository . match ( gitUrlRegexp )
1515 const [ , , , , , , , links ] = matched
1616 const [ owner , name ] = links . split ( '/' ) . slice ( - 2 )
17- return { type : 'git' , service : 'github' , url : repository , owner, name }
17+ return { type : 'git' , service : 'github' , url : repository , owner, name, path : repository }
1818 }
1919
20- return { type : 'git' , service : 'unknow' , url : repository , owner : null , name : null }
21- } else if ( isAbsolute ( repository ) ) {
22- return { type : 'local' , url : repository , owner : null , name : null }
20+ return { type : 'git' , service : 'unknow' , url : repository , owner : null , name : null , path : repository }
2321 }
2422
25- return { type : 'unknow' , url : repository , owner : null , name : null }
23+ return { type : 'unknow' , url : repository , owner : null , name : null , path : repository }
2624}
2725
2826
@@ -38,11 +36,16 @@ const dirExist = async link => {
3836
3937module . exports = ( link ) => {
4038 const cwd = process . cwd ( )
39+
4140 if ( isRelative ( link ) || isAbsolute ( link ) ) {
42- if ( isAbsolute ( link ) && dirExist ( link ) ) return formatRepository ( link )
41+ if ( isAbsolute ( link ) && dirExist ( link ) ) {
42+ return { type : 'local' , url : link , owner : null , name : null , path : link }
43+ }
4344
44- link = join ( cwd , link )
45- if ( dirExist ( link ) ) return formatRepository ( link )
45+ const url = join ( cwd , link )
46+ if ( dirExist ( url ) ) {
47+ return { type : 'local' , url, owner : null , name : null , path : link }
48+ }
4649
4750 throwError ( 'Template path cannot be found. Ensure it is an exist directory.' )
4851 } else if ( githubSH . test ( link ) ) {
0 commit comments