Skip to content

Commit

Permalink
chore: refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
snitin315 committed Apr 6, 2020
1 parent bd2f917 commit 73ade44
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions packages/webpack-cli/lib/groups/HelpGroup.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const chalk = require('chalk');
const logger = require('../utils/logger');
const commandLineUsage = require('command-line-usage');

class HelpGroup {
Expand Down Expand Up @@ -41,9 +42,12 @@ class HelpGroup {

outputVersion(externalPkg) {
if (externalPkg && externalPkg.name) {
const ExternalPkgJson = require('../../../' + externalPkg.name + '/package.json');
const { name, version } = ExternalPkgJson;
process.stdout.write(`\n${name} ${version}`);
try {
const { name, version } = require(`../../../${externalPkg.name}/package.json`);
process.stdout.write(`\n${name} ${version}`);
} catch (e) {
logger.error('Error, external package not found.');
}
}
const pkgJSON = require('../../package.json');
const webpack = require('webpack');
Expand Down

0 comments on commit 73ade44

Please sign in to comment.