Skip to content

Commit f7489fd

Browse files
698: Added to remove substring the module from module name. Added prefix the "module-" for composerPackageName.
1 parent 5686ead commit f7489fd

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/com/magento/idea/magento2plugin/actions/generation/dialog/NewModuleDialog.java

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ public class NewModuleDialog extends AbstractDialog implements ListSelectionList
107107
private final ModuleIndex moduleIndex;
108108
private final CamelCaseToHyphen camelCaseToHyphen;
109109
private static final String MAGENTO_BEFORE_DECLARATIVE_SCHEMA_VERSION = "2.2.11";
110+
private static final String DEFAULT_MODULE_PREFIX = "module";
110111

111112
/**
112113
* Constructor.
@@ -246,7 +247,18 @@ public String getPackageName() {
246247
}
247248

248249
public String getModuleName() {
249-
return this.moduleName.getText().trim();
250+
return this.removeSubstringFormString(DEFAULT_MODULE_PREFIX, this.moduleName.getText().trim());
251+
}
252+
253+
/**
254+
*
255+
* @param target String
256+
* @param replacement String
257+
* @return String
258+
*/
259+
private String removeSubstringFormString(@NotNull String target, @NotNull String replacement) {
260+
String moduleRegex = "(?i)" + target;
261+
return replacement.replaceAll(moduleRegex, "");
250262
}
251263

252264
/**
@@ -332,6 +344,7 @@ public static void open(
332344
private String getComposerPackageName() {
333345
return camelCaseToHyphen.convert(getPackageName())
334346
.concat("/")
347+
.concat(DEFAULT_MODULE_PREFIX + "-")
335348
.concat(camelCaseToHyphen.convert(getModuleName()));
336349
}
337350

0 commit comments

Comments
 (0)