From 39be039df80be708fec4001000abdb79678ffbeb Mon Sep 17 00:00:00 2001 From: Pranshu Chittora Date: Wed, 5 Jun 2019 00:28:44 +0530 Subject: [PATCH] chore(utils): refactors modify config helper minor refactoring in the utils --- packages/utils/modify-config-helper.ts | 36 ++++++++++++-------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/packages/utils/modify-config-helper.ts b/packages/utils/modify-config-helper.ts index d27b37bd608..112d8246e92 100644 --- a/packages/utils/modify-config-helper.ts +++ b/packages/utils/modify-config-helper.ts @@ -48,28 +48,26 @@ export default function modifyHelperUtil( if (action !== "init") { configPath = path.resolve(process.cwd(), configFile); const webpackConfigExists: boolean = fs.existsSync(configPath); + let outputMessage = + "\n" + + logSymbols.error + + chalk.red(" ERROR ") + + chalk.cyan(configFile) + + " not found. Please specify a valid path to your webpack config like \n " + + chalk.white("$ ") + + chalk.cyan(`webpack-cli ${action} webpack.dev.js`) + + "\n"; if (webpackConfigExists) { - process.stdout.write( + outputMessage = "\n" + - logSymbols.success + - chalk.green(" SUCCESS ") + - "Found config " + - chalk.cyan(configFile + "\n") + - "\n" - ); - } else { - process.stdout.write( - "\n" + - logSymbols.error + - chalk.red(" ERROR ") + - chalk.cyan(configFile) + - " not found. Please specify a valid path to your webpack config like \n " + - chalk.white("$ ") + - chalk.cyan(`webpack-cli ${action} webpack.dev.js`) + - "\n" - ); - return; + logSymbols.success + + chalk.green(" SUCCESS ") + + "Found config " + + chalk.cyan(configFile + "\n") + + "\n"; } + process.stdout.write(outputMessage); + return; } const env = yeoman.createEnv("webpack", null);