Skip to content

Commit 7fbc3a4

Browse files
committedMay 24, 2019
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
1 parent 11554d6 commit 7fbc3a4

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed
 

‎packages/generators/add-generator.ts

+5-9
Original file line numberDiff line numberDiff line change
@@ -395,15 +395,11 @@ export default class AddGenerator extends Generator {
395395
(p: boolean): void => {
396396
if (p) {
397397
this.dependencies.push(answerToAction.actionAnswer);
398-
const normalizePluginName = answerToAction.actionAnswer.replace(
399-
"-webpack-plugin",
400-
"Plugin"
401-
);
402-
const pluginName = replaceAt(
403-
normalizePluginName,
404-
0,
405-
normalizePluginName.charAt(0).toUpperCase()
406-
);
398+
let myPluginNameArray = answerToAction.actionAnswer.split("-")
399+
for (let i = 0; i < myPluginNameArray.length; i++) {
400+
myPluginNameArray[i] = replaceAt(myPluginNameArray[i], 0, myPluginNameArray[i].charAt(0).toUpperCase());
401+
}
402+
const pluginName = myPluginNameArray.join("")
407403
this.configuration.config.topScope.push(
408404
`const ${pluginName} = require("${answerToAction.actionAnswer}")`
409405
);

0 commit comments

Comments
 (0)
Please sign in to comment.