Skip to content

Commit fc79bf5

Browse files
Charly6596raymondfeng
authored andcommitted
fix: add class name separation to multiple class names output
This commit adds a character defined in artifact-generator.js to be used when the output contains multiple class names fix #3350
1 parent ae86f83 commit fc79bf5

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

packages/cli/generators/repository/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,7 @@ module.exports = class RepositoryGenerator extends ArtifactGenerator {
550550
);
551551

552552
this.artifactInfo.name = this.artifactInfo.modelNameList
553-
? this.artifactInfo.modelNameList.join()
553+
? this.artifactInfo.modelNameList.join(this.classNameSeparator)
554554
: this.artifactInfo.modelName;
555555

556556
await super.end();

packages/cli/lib/artifact-generator.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ module.exports = class ArtifactGenerator extends BaseGenerator {
1515
// Note: arguments and options should be defined in the constructor.
1616
constructor(args, opts) {
1717
super(args, opts);
18+
// how classes are separated when the output contains more than one
19+
this.classNameSeparator = ', ';
1820
}
1921

2022
_setupGenerator() {
@@ -131,12 +133,17 @@ module.exports = class ArtifactGenerator extends BaseGenerator {
131133
if (generationStatus) {
132134
await this._updateIndexFiles();
133135

136+
const classes = this.artifactInfo.name
137+
.split(this.classNameSeparator)
138+
.map(utils.toClassName);
139+
const classesOutput = classes.join(this.classNameSeparator);
140+
134141
// User Output
135142
this.log();
136143
this.log(
137144
utils.toClassName(this.artifactInfo.type),
138-
chalk.yellow(utils.toClassName(this.artifactInfo.name)),
139-
'was created in',
145+
chalk.yellow(classesOutput),
146+
classes.length > 1 ? 'were created in' : 'was created in',
140147
`${this.artifactInfo.relPath}/`,
141148
);
142149
this.log();

0 commit comments

Comments
 (0)