Skip to content

Commit

Permalink
chore: suggesion
Browse files Browse the repository at this point in the history
  • Loading branch information
snitin315 committed Oct 5, 2020
1 parent 6fc2df0 commit 27a2d15
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions packages/webpack-cli/lib/groups/resolveAdvanced.js
@@ -1,12 +1,12 @@
const { packageExists } = require('@webpack-cli/package-utils');
const { packageExists, promptInstallation } = require('@webpack-cli/package-utils');
const { yellow } = require('colorette');
const { error } = require('../utils/logger');
const { error, info } = require('../utils/logger');

/**
* Resolve advanced flags
* @param {args} args - Parsed args passed to CLI
*/
const resolveAdvanced = (args) => {
const resolveAdvanced = async (args) => {
const { target, prefetch, hot, analyze } = args;

const finalOptions = {
Expand Down Expand Up @@ -43,8 +43,14 @@ const resolveAdvanced = (args) => {
finalOptions.options.plugins = [bundleAnalyzerVal];
}
} else {
error(`It looks like ${yellow('webpack-bundle-analyzer')} is not installed.`);
process.exitCode = 2;
await promptInstallation('webpack-bundle-analyzer', () => {
error(`It looks like ${yellow('webpack-bundle-analyzer')} is not installed.`);
})
.then(() => info(`${yellow('webpack-bundle-analyzer')} was installed sucessfully.`))
.catch(() => {
error(`Action Interrupted, Please try once again or install ${yellow('webpack-bundle-analyzer')} manually.`);
process.exit(2);
});
}
}
if (target) {
Expand Down

0 comments on commit 27a2d15

Please sign in to comment.