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 11#!/usr/bin/env node
22
33'use strict' ;
4+
45require ( 'v8-compile-cache' ) ;
6+
57const importLocal = require ( 'import-local' ) ;
68const runCLI = require ( '../lib/bootstrap' ) ;
79const { yellow } = require ( 'colorette' ) ;
810const { error, success } = require ( '../lib/utils/logger' ) ;
911const { packageExists } = require ( '../lib/utils/package-exists' ) ;
1012const { promptInstallation } = require ( '../lib/utils/prompt-installation' ) ;
1113
12- // Prefer the local installation of webpack-cli
14+ // Prefer the local installation of ` webpack-cli`
1315if ( importLocal ( __filename ) ) {
1416 return ;
1517}
18+
1619process . title = 'webpack' ;
1720
21+ const [ , , ...rawArgs ] = process . argv ;
22+
1823if ( packageExists ( 'webpack' ) ) {
19- const [ , , ...rawArgs ] = process . argv ;
2024 runCLI ( rawArgs ) ;
2125} else {
22- promptInstallation ( 'webpack' , ( ) => {
26+ promptInstallation ( 'webpack -W ' , ( ) => {
2327 error ( `It looks like ${ yellow ( 'webpack' ) } is not installed.` ) ;
2428 } )
25- . then ( ( ) => success ( `${ yellow ( 'webpack' ) } was installed sucessfully.` ) )
29+ . then ( ( ) => {
30+ success ( `${ yellow ( 'webpack' ) } was installed sucessfully.` ) ;
31+
32+ runCLI ( rawArgs ) ;
33+ } )
2634 . catch ( ( ) => {
27- process . exitCode = 2 ;
2835 error ( `Action Interrupted, Please try once again or install ${ yellow ( 'webpack' ) } manually.` ) ;
36+
37+ process . exit ( 2 ) ;
2938 } ) ;
30- return ;
3139}
You can’t perform that action at this time.
0 commit comments