Skip to content

Commit aa3c1f2

Browse files
zigomiryyx990803
authored andcommitted
Warn user about Vue 2.x template. (vuejs#162)
* Warn user about Vue 2.x template. - don't warn for webpack template since it's not yet in master/dist branch. * Extract to vue2-version-warn file. * Bump version and use inPlace for better message.
1 parent 435ceb6 commit aa3c1f2

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

bin/vue-init

+8-3
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ var request = require('request')
1313
var logger = require('../lib/logger')
1414
var generate = require('../lib/generate')
1515
var checkVersion = require('../lib/check-version')
16+
var vue2VersionWarn = require('../lib/vue2-version-warn')
1617

1718
/**
1819
* Usage.
@@ -100,11 +101,15 @@ function run () {
100101
checkVersion(function () {
101102
if (!hasSlash) {
102103
// use official templates
103-
template = 'vuejs-templates/' + template
104+
var officialTemplate = 'vuejs-templates/' + template
104105
if (template.indexOf('#') !== -1) {
105-
downloadAndGenerate(template)
106+
downloadAndGenerate(officialTemplate)
106107
} else {
107-
checkDistBranch(template, downloadAndGenerate)
108+
// until official webpack template for Vue 2.0 is released in master/dist branch
109+
if (template !== 'webpack') {
110+
vue2VersionWarn(template, inPlace ? '' : name)
111+
}
112+
checkDistBranch(officialTemplate, downloadAndGenerate)
108113
}
109114
} else {
110115
downloadAndGenerate(template)

lib/vue2-version-warn.js

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
var chalk = require('chalk')
2+
3+
module.exports = function (template, name) {
4+
var vue1InitCommand = 'vue init ' + template + '#1.0' + ' ' + name
5+
6+
console.log(chalk.red(' This will install Vue 2.x version of template.'))
7+
console.log()
8+
console.log(chalk.yellow(' For Vue 1.x use: ') + chalk.green(vue1InitCommand))
9+
console.log()
10+
}

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vue-cli",
3-
"version": "2.2.0",
3+
"version": "2.3.0",
44
"description": "A simple CLI for scaffolding Vue.js projects.",
55
"preferGlobal": true,
66
"bin": {

0 commit comments

Comments
 (0)