Skip to content

Commit 564279e

Browse files
fix: run CLI after webpack installation (#1951)
1 parent 92ad475 commit 564279e

File tree

1 file changed

+14
-6
lines changed
  • packages/webpack-cli/bin

1 file changed

+14
-6
lines changed

packages/webpack-cli/bin/cli.js

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,39 @@
11
#!/usr/bin/env node
22

33
'use strict';
4+
45
require('v8-compile-cache');
6+
57
const importLocal = require('import-local');
68
const runCLI = require('../lib/bootstrap');
79
const { yellow } = require('colorette');
810
const { error, success } = require('../lib/utils/logger');
911
const { packageExists } = require('../lib/utils/package-exists');
1012
const { promptInstallation } = require('../lib/utils/prompt-installation');
1113

12-
// Prefer the local installation of webpack-cli
14+
// Prefer the local installation of `webpack-cli`
1315
if (importLocal(__filename)) {
1416
return;
1517
}
18+
1619
process.title = 'webpack';
1720

21+
const [, , ...rawArgs] = process.argv;
22+
1823
if (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
}

0 commit comments

Comments
 (0)