@@ -64,7 +64,6 @@ process.on('exit', function () {
64
64
var template = program . args [ 0 ]
65
65
var hasSlash = template . indexOf ( '/' ) > - 1
66
66
var rawName = program . args [ 1 ]
67
- var templatePath = exists ( template ) ? template : path . normalize ( path . join ( process . cwd ( ) , template ) )
68
67
var inPlace = ! rawName || rawName === '.'
69
68
var name = inPlace ? path . relative ( '../' , process . cwd ( ) ) : rawName
70
69
var to = path . resolve ( rawName || '.' )
@@ -92,12 +91,19 @@ if (exists(to)) {
92
91
93
92
function run ( ) {
94
93
// check if template is local
95
- if ( exists ( templatePath ) ) {
96
- generate ( name , templatePath , to , function ( err ) {
97
- if ( err ) logger . fatal ( err )
98
- console . log ( )
99
- logger . success ( 'Generated "%s".' , name )
100
- } )
94
+ if ( / ^ [ . / ] / . test ( template ) ) {
95
+ var templatePath = template . charAt ( 0 ) === '/'
96
+ ? template
97
+ : path . normalize ( path . join ( process . cwd ( ) , template ) )
98
+ if ( exists ( templatePath ) ) {
99
+ generate ( name , templatePath , to , function ( err ) {
100
+ if ( err ) logger . fatal ( err )
101
+ console . log ( )
102
+ logger . success ( 'Generated "%s".' , name )
103
+ } )
104
+ } else {
105
+ logger . fatal ( 'Local template "%s" not found.' , template )
106
+ }
101
107
} else {
102
108
checkVersion ( function ( ) {
103
109
if ( ! hasSlash ) {
0 commit comments