File tree Expand file tree Collapse file tree 1 file changed +14
-6
lines changed Expand file tree Collapse file tree 1 file changed +14
-6
lines changed Original file line number Diff line number Diff line change 1
1
#!/usr/bin/env node
2
2
3
3
'use strict' ;
4
+
4
5
require ( 'v8-compile-cache' ) ;
6
+
5
7
const importLocal = require ( 'import-local' ) ;
6
8
const runCLI = require ( '../lib/bootstrap' ) ;
7
9
const { yellow } = require ( 'colorette' ) ;
8
10
const { error, success } = require ( '../lib/utils/logger' ) ;
9
11
const { packageExists } = require ( '../lib/utils/package-exists' ) ;
10
12
const { promptInstallation } = require ( '../lib/utils/prompt-installation' ) ;
11
13
12
- // Prefer the local installation of webpack-cli
14
+ // Prefer the local installation of ` webpack-cli`
13
15
if ( importLocal ( __filename ) ) {
14
16
return ;
15
17
}
18
+
16
19
process . title = 'webpack' ;
17
20
21
+ const [ , , ...rawArgs ] = process . argv ;
22
+
18
23
if ( packageExists ( 'webpack' ) ) {
19
- const [ , , ...rawArgs ] = process . argv ;
20
24
runCLI ( rawArgs ) ;
21
25
} else {
22
- promptInstallation ( 'webpack' , ( ) => {
26
+ promptInstallation ( 'webpack -W ' , ( ) => {
23
27
error ( `It looks like ${ yellow ( 'webpack' ) } is not installed.` ) ;
24
28
} )
25
- . then ( ( ) => success ( `${ yellow ( 'webpack' ) } was installed sucessfully.` ) )
29
+ . then ( ( ) => {
30
+ success ( `${ yellow ( 'webpack' ) } was installed sucessfully.` ) ;
31
+
32
+ runCLI ( rawArgs ) ;
33
+ } )
26
34
. catch ( ( ) => {
27
- process . exitCode = 2 ;
28
35
error ( `Action Interrupted, Please try once again or install ${ yellow ( 'webpack' ) } manually.` ) ;
36
+
37
+ process . exit ( 2 ) ;
29
38
} ) ;
30
- return ;
31
39
}
You can’t perform that action at this time.
0 commit comments