File tree 3 files changed +16
-11
lines changed
3 files changed +16
-11
lines changed Original file line number Diff line number Diff line change 1
1
const fs = require ( 'fs' )
2
2
const path = require ( 'path' )
3
+ const chalk = require ( 'chalk' )
3
4
const Service = require ( '@vue/cli-service' )
4
5
const { toPlugin, findExisting } = require ( './lib/util' )
5
6
@@ -18,11 +19,14 @@ function createService (entry) {
18
19
] )
19
20
20
21
if ( ! entry ) {
21
- throw new Error ( `Cannot infer entry file in ${ context } . Please specify an entry.` )
22
+ console . log ( chalk . red ( `Failed to locate entry file in ${ chalk . yellow ( context ) } .` ) )
23
+ console . log ( chalk . red ( `Valid entry file should be one of: main.js, index.js, App.vue or app.vue.` ) )
24
+ process . exit ( 1 )
22
25
}
23
26
24
27
if ( ! fs . existsSync ( path . join ( context , entry ) ) ) {
25
- throw new Error ( `Entry file ${ entry } does not exist.` )
28
+ console . log ( chalk . red ( `Entry file ${ chalk . yellow ( entry ) } does not exist.` ) )
29
+ process . exit ( 1 )
26
30
}
27
31
28
32
return new Service ( context , {
Original file line number Diff line number Diff line change 21
21
},
22
22
"homepage" : " https://github.com/vuejs/vue-cli/packages/@vue/cli-build#readme" ,
23
23
"dependencies" : {
24
- "@vue/cli-service" : " ^3.0.0-alpha.1" ,
25
- "@vue/cli-plugin-babel" : " ^3.0.0-alpha.1" ,
26
24
"@vue/babel-preset-app" : " ^3.0.0-alpha.1" ,
25
+ "@vue/cli-plugin-babel" : " ^3.0.0-alpha.1" ,
27
26
"@vue/cli-plugin-eslint" : " ^3.0.0-alpha.1" ,
27
+ "@vue/cli-service" : " ^3.0.0-alpha.1" ,
28
+ "chalk" : " ^2.3.0" ,
28
29
"eslint-plugin-vue" : " ^4.2.0" ,
29
30
"vue" : " ^2.5.13"
30
31
}
Original file line number Diff line number Diff line change @@ -42,13 +42,6 @@ program
42
42
require ( '../lib/create' ) ( name , cleanArgs ( cmd ) )
43
43
} )
44
44
45
- program
46
- . command ( 'init <template> <app-name>' )
47
- . description ( 'generate a project from a remote template (requires @vue/cli-init)' )
48
- . action ( ( ) => {
49
- loadCommand ( 'init' , '@vue/cli-init' )
50
- } )
51
-
52
45
program
53
46
. command ( 'serve [entry]' )
54
47
. description ( 'serve a .js or vue file in development mode with zero config' )
@@ -64,6 +57,13 @@ program
64
57
loadCommand ( 'build' , '@vue/cli-service-global' ) . build ( entry , cleanArgs ( cmd ) )
65
58
} )
66
59
60
+ program
61
+ . command ( 'init <template> <app-name>' )
62
+ . description ( 'generate a project from a remote template (legacy API, requires @vue/cli-init)' )
63
+ . action ( ( ) => {
64
+ loadCommand ( 'init' , '@vue/cli-init' )
65
+ } )
66
+
67
67
// add some useful info on help
68
68
program . on ( '--help' , ( ) => {
69
69
console . log ( )
You can’t perform that action at this time.
0 commit comments