File tree 2 files changed +33
-0
lines changed
2 files changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -54,6 +54,14 @@ program
54
54
require ( '../lib/invoke' ) ( plugin , minimist ( process . argv . slice ( 3 ) ) )
55
55
} )
56
56
57
+ program
58
+ . command ( 'inspect [paths...]' )
59
+ . option ( '--mode <mode>' )
60
+ . description ( 'inspect the webpack config in a project with vue-cli-service' )
61
+ . action ( ( paths , cmd ) => {
62
+ require ( '../lib/inspect' ) ( paths , cmd . mode )
63
+ } )
64
+
57
65
program
58
66
. command ( 'serve [entry]' )
59
67
. description ( 'serve a .js or .vue file in development mode with zero config' )
Original file line number Diff line number Diff line change
1
+ const fs = require ( 'fs' )
2
+ const path = require ( 'path' )
3
+ const execa = require ( 'execa' )
4
+ const resolve = require ( 'resolve' )
5
+
6
+ module . exports = function inspect ( paths , mode ) {
7
+ const cwd = process . cwd ( )
8
+ let servicePath
9
+ try {
10
+ servicePath = resolve . sync ( '@vue/cli-service' , { cwd } )
11
+ } catch ( e ) {
12
+ const { error } = require ( '@vue/cli-shared-utils' )
13
+ error ( `Failed to locate @vue/cli-service. Make sure you are in the right directory.` )
14
+ process . exit ( 1 )
15
+ }
16
+ const binPath = path . resolve ( servicePath , '../../bin/vue-cli-service.js' )
17
+ if ( fs . existsSync ( binPath ) ) {
18
+ execa ( 'node' , [
19
+ binPath ,
20
+ 'inspect' ,
21
+ ...( mode ? [ '--mode' , mode ] : [ ] ) ,
22
+ ...paths
23
+ ] , { cwd, stdio : 'inherit' } )
24
+ }
25
+ }
You can’t perform that action at this time.
0 commit comments