Skip to content

Commit

Permalink
chore(plugins.ts): added if-stmt for native plugins
Browse files Browse the repository at this point in the history
Added if stmt for not doing anything when native plugins comes-in
Also Changed the test
  • Loading branch information
anikethsaha committed May 27, 2019
1 parent 7d83453 commit fc9e259
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/generators/__tests__/add-generator.test.ts
Expand Up @@ -8,7 +8,7 @@ describe("generatePluginName", () => {

it("should return webpack Standard Plugin Name for Name : webpack.DefinePlugin", () => {
const pluginName = generatePluginName("webpack.DefinePlugin");
expect(pluginName).toEqual("Webpack.DefinePlugin");
expect(pluginName).toEqual("webpack.DefinePlugin");
});
});

7 changes: 5 additions & 2 deletions packages/generators/utils/plugins.ts
Expand Up @@ -43,8 +43,11 @@ export const replaceAt = (str: string, index: number, replace: string) : string
export const generatePluginName = (rawPluginName: string): string => {
let myPluginNameArray : string[];
myPluginNameArray = rawPluginName.split("-");
for (let i = 0; i < myPluginNameArray.length; i++) {
myPluginNameArray[i] = replaceAt(myPluginNameArray[i], 0, myPluginNameArray[i].charAt(0).toUpperCase());
if( myPluginNameArray.length <= 1 ){}
else{
for (let i = 0; i < myPluginNameArray.length; i++) {
myPluginNameArray[i] = replaceAt(myPluginNameArray[i], 0, myPluginNameArray[i].charAt(0).toUpperCase());
}
}
return myPluginNameArray.join("")
}

0 comments on commit fc9e259

Please sign in to comment.