Skip to content

Commit

Permalink
refactor: use arrow functions
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesgeorge007 committed Oct 10, 2020
1 parent 271b0eb commit fe342f6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
8 changes: 3 additions & 5 deletions packages/webpack-cli/lib/bootstrap.js
Expand Up @@ -13,11 +13,9 @@ process.title = 'webpack-cli';
// Create a new instance of the CLI object
const cli = new WebpackCLI();

function parseArgs(args) {
return argParser(core, args, true, process.title);
}
const parseArgs = (args) => argParser(core, args, true, process.title);

async function runCLI(cliArgs) {
const runCLI = async (cliArgs) => {
let args;

const commandIsUsed = isCommandUsed(cliArgs);
Expand Down Expand Up @@ -108,6 +106,6 @@ async function runCLI(cliArgs) {
return;
}
}
}
};

module.exports = runCLI;
4 changes: 2 additions & 2 deletions packages/webpack-cli/lib/utils/arg-parser.js
Expand Up @@ -13,7 +13,7 @@ const { defaultCommands } = require('./commands');
* @param {boolean} argsOnly false if all of process.argv has been provided, true if
* args is only a subset of process.argv that removes the first couple elements
*/
function argParser(options, args, argsOnly = false, name = '') {
const argParser = (options, args, argsOnly = false, name = '') => {
const parser = new commander.Command();
// Set parser name
parser.name(name);
Expand Down Expand Up @@ -155,6 +155,6 @@ function argParser(options, args, argsOnly = false, name = '') {
unknownArgs,
opts,
};
}
};

module.exports = argParser;
8 changes: 4 additions & 4 deletions packages/webpack-cli/lib/utils/cli-executer.js
Expand Up @@ -3,7 +3,7 @@ const { cyan } = require('colorette');
const logger = require('./logger');
const cliArgs = require('./cli-flags').core;

async function prompter() {
const prompter = async () => {
const args = [];

const typePrompt = new MultiSelect({
Expand Down Expand Up @@ -48,9 +48,9 @@ async function prompter() {
}

return [...args, ...boolArgs];
}
};

async function run() {
const run = async () => {
try {
const args = await prompter();
logger.info('\nExecuting CLI\n');
Expand All @@ -59,6 +59,6 @@ async function run() {
logger.error(`${err} Action Interrupted, use ${cyan('webpack-cli help')} to see possible options.`);
process.exit(1);
}
}
};

module.exports = run;

0 comments on commit fe342f6

Please sign in to comment.