From 2af08013852a95c6f6462c56a9994a4ee28c6ea1 Mon Sep 17 00:00:00 2001 From: Alexander Akait <4567934+alexander-akait@users.noreply.github.com> Date: Sun, 3 Jan 2021 21:26:34 +0300 Subject: [PATCH] feat: allow to pass parseOption to CLI class (#2299) --- packages/webpack-cli/lib/index.js | 12 +++--------- packages/webpack-cli/lib/webpack-cli.js | 4 ++-- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/packages/webpack-cli/lib/index.js b/packages/webpack-cli/lib/index.js index f284f9074db..fa7a933054f 100644 --- a/packages/webpack-cli/lib/index.js +++ b/packages/webpack-cli/lib/index.js @@ -1,13 +1,7 @@ -const WebpackCLI = require('./webpack-cli'); -const { commands } = require('./utils/cli-flags'); +const CLI = require('./webpack-cli'); const logger = require('./utils/logger'); const getPackageManager = require('./utils/get-package-manager'); -module.exports = WebpackCLI; - +module.exports = CLI; // export additional utils used by other packages -module.exports.utils = { - logger, - commands, - getPackageManager, -}; +module.exports.utils = { logger, getPackageManager }; diff --git a/packages/webpack-cli/lib/webpack-cli.js b/packages/webpack-cli/lib/webpack-cli.js index 34e6f406c6e..1401bafca9a 100644 --- a/packages/webpack-cli/lib/webpack-cli.js +++ b/packages/webpack-cli/lib/webpack-cli.js @@ -227,7 +227,7 @@ class WebpackCLI { return flags; } - async run(args) { + async run(args, parseOptions) { // Built-in internal commands const bundleCommandOptions = { name: 'bundle', @@ -712,7 +712,7 @@ class WebpackCLI { await this.program.parseAsync([commandName, ...options], { from: 'user' }); }); - await this.program.parseAsync(args); + await this.program.parseAsync(args, parseOptions); } async resolveConfig(options) {