From 7fbc3a4b57c81bd7bff2c09c13adca56d7ec081a Mon Sep 17 00:00:00 2001 From: anikethsaha Date: Fri, 24 May 2019 11:23:43 +0530 Subject: [PATCH] chore(add-generator): changed the naming of the plugin in config file Changed the naming of the plugin to better and standard and bug free name in add-generator in plugin question --- packages/generators/add-generator.ts | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/packages/generators/add-generator.ts b/packages/generators/add-generator.ts index bef3c32afd3..a911b75e6ce 100644 --- a/packages/generators/add-generator.ts +++ b/packages/generators/add-generator.ts @@ -395,15 +395,11 @@ export default class AddGenerator extends Generator { (p: boolean): void => { if (p) { this.dependencies.push(answerToAction.actionAnswer); - const normalizePluginName = answerToAction.actionAnswer.replace( - "-webpack-plugin", - "Plugin" - ); - const pluginName = replaceAt( - normalizePluginName, - 0, - normalizePluginName.charAt(0).toUpperCase() - ); + let myPluginNameArray = answerToAction.actionAnswer.split("-") + for (let i = 0; i < myPluginNameArray.length; i++) { + myPluginNameArray[i] = replaceAt(myPluginNameArray[i], 0, myPluginNameArray[i].charAt(0).toUpperCase()); + } + const pluginName = myPluginNameArray.join("") this.configuration.config.topScope.push( `const ${pluginName} = require("${answerToAction.actionAnswer}")` );