chore: tweak command messages

This commit is contained in:
Evan You
2018-01-14 17:57:49 -05:00
parent 1daeadb76d
commit aa43bec35f
3 changed files with 16 additions and 11 deletions

View File

@@ -1,5 +1,6 @@
const fs = require('fs')
const path = require('path')
const chalk = require('chalk')
const Service = require('@vue/cli-service')
const { toPlugin, findExisting } = require('./lib/util')
@@ -18,11 +19,14 @@ function createService (entry) {
])
if (!entry) {
throw new Error(`Cannot infer entry file in ${context}. Please specify an entry.`)
console.log(chalk.red(`Failed to locate entry file in ${chalk.yellow(context)}.`))
console.log(chalk.red(`Valid entry file should be one of: main.js, index.js, App.vue or app.vue.`))
process.exit(1)
}
if (!fs.existsSync(path.join(context, entry))) {
throw new Error(`Entry file ${entry} does not exist.`)
console.log(chalk.red(`Entry file ${chalk.yellow(entry)} does not exist.`))
process.exit(1)
}
return new Service(context, {

View File

@@ -21,10 +21,11 @@
},
"homepage": "https://github.com/vuejs/vue-cli/packages/@vue/cli-build#readme",
"dependencies": {
"@vue/cli-service": "^3.0.0-alpha.1",
"@vue/cli-plugin-babel": "^3.0.0-alpha.1",
"@vue/babel-preset-app": "^3.0.0-alpha.1",
"@vue/cli-plugin-babel": "^3.0.0-alpha.1",
"@vue/cli-plugin-eslint": "^3.0.0-alpha.1",
"@vue/cli-service": "^3.0.0-alpha.1",
"chalk": "^2.3.0",
"eslint-plugin-vue": "^4.2.0",
"vue": "^2.5.13"
}

View File

@@ -42,13 +42,6 @@ program
require('../lib/create')(name, cleanArgs(cmd))
})
program
.command('init <template> <app-name>')
.description('generate a project from a remote template (requires @vue/cli-init)')
.action(() => {
loadCommand('init', '@vue/cli-init')
})
program
.command('serve [entry]')
.description('serve a .js or vue file in development mode with zero config')
@@ -64,6 +57,13 @@ program
loadCommand('build', '@vue/cli-service-global').build(entry, cleanArgs(cmd))
})
program
.command('init <template> <app-name>')
.description('generate a project from a remote template (legacy API, requires @vue/cli-init)')
.action(() => {
loadCommand('init', '@vue/cli-init')
})
// add some useful info on help
program.on('--help', () => {
console.log()