Skip to content

Commit 5063ac5

Browse files
committed
only check local fs if template name contains slash (fix vuejs#8)
1 parent 90f5d5e commit 5063ac5

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

bin/vue-init

+3-2
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ process.on('exit', function () {
5555
*/
5656

5757
var template = program.args[0]
58+
var hasSlash = template.indexOf('/') > -1
5859
var name = program.args[1]
5960
var dir = program.directory
6061
var to = resolve(name)
@@ -64,7 +65,7 @@ if (exists(to)) logger.fatal('"%s" already exists.', name)
6465
* Detect if template on file system.
6566
*/
6667

67-
if (exists(template)) {
68+
if (hasSlash && exists(template)) {
6869
generate(template, to, function (err) {
6970
if (err) logger.fatal(err)
7071
console.log()
@@ -75,7 +76,7 @@ if (exists(template)) {
7576
* Detect official template.
7677
*/
7778

78-
if (!~template.indexOf('/')) {
79+
if (!hasSlash) {
7980
template = 'vuejs-templates/' + template
8081
}
8182

0 commit comments

Comments
 (0)