Skip to content

Commit

Permalink
Merge pull request #23941 from mshima/skip_ci-translation
Browse files Browse the repository at this point in the history
move queueTransformStream to default step
  • Loading branch information
DanielFran authored Oct 22, 2023
2 parents 35c32c7 + e675fcd commit 3611803
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 32 deletions.
12 changes: 6 additions & 6 deletions generators/angular/generator.mts
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,12 @@ export default class AngularGenerator extends BaseApplicationGenerator {
const entities = this.sharedData.getEntities().map(({ entity }) => entity);
this.localEntities = entities.filter(entity => !entity.builtIn && !entity.skipClient);
},
queueTranslateTransform({ control, application }) {
this.queueTransformStream(translateAngularFilesTransform(control.getWebappTranslation, application.enableTranslation), {
name: 'translating webapp',
streamOptions: { filter: file => isFilePending(file) && isTranslatedAngularFile(file) },
});
},
});
}

Expand All @@ -158,12 +164,6 @@ export default class AngularGenerator extends BaseApplicationGenerator {
return this.asWritingTaskGroup({
cleanupOldFilesTask,
writeFiles,
queueTranslateTransform({ control, application }) {
this.queueTransformStream(translateAngularFilesTransform(control.getWebappTranslation, application.enableTranslation), {
name: 'translating webapp',
streamOptions: { filter: file => isFilePending(file) && isTranslatedAngularFile(file) },
});
},
});
}

Expand Down
21 changes: 15 additions & 6 deletions generators/common/generator.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,21 @@ export default class CommonGenerator extends BaseApplicationGenerator {
return this.delegateTasksToBlueprint(() => this.preparing);
}

get default() {
return this.asDefaultTaskGroup({
async formatSonarProperties() {
this.queueTransformStream(await createPrettierTransform.call(this, { extensions: 'properties', prettierProperties: true }), {
name: 'prettifying sonar-project.properties',
streamOptions: { filter: file => isFilePending(file) && file.path.endsWith('sonar-project.properties') },
});
},
});
}

get [BaseApplicationGenerator.DEFAULT]() {
return this.asDefaultTaskGroup(this.delegateTasksToBlueprint(() => this.default));
}

// Public API method used by the getter and also by Blueprints
get writing() {
return {
Expand Down Expand Up @@ -224,12 +239,6 @@ export default class CommonGenerator extends BaseApplicationGenerator {
},
});
},
async formatSonarProperties() {
this.queueTransformStream(await createPrettierTransform.call(this, { extensions: 'properties', prettierProperties: true }), {
name: 'prettifying sonar-project.properties',
streamOptions: { filter: file => isFilePending(file) && file.path.endsWith('sonar-project.properties') },
});
},
addCommitHookDependencies({ application }) {
if (application.skipCommitHook) return;
this.packageJson.merge({
Expand Down
19 changes: 14 additions & 5 deletions generators/react/generator.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export default class ReactGenerator extends BaseApplicationGenerator {
}

get [BaseApplicationGenerator.LOADING]() {
return this.asLoadingTaskGroup(this.delegateTasksToBlueprint(() => this.loading));
return this.delegateTasksToBlueprint(() => this.loading);
}

get preparing() {
Expand Down Expand Up @@ -108,10 +108,8 @@ export default class ReactGenerator extends BaseApplicationGenerator {
return this.asPreparingEachEntityTaskGroup(this.delegateTasksToBlueprint(() => this.preparingEachEntity));
}

get writing() {
return {
cleanupOldFilesTask,
writeFiles,
get default() {
return this.asDefaultTaskGroup({
queueTranslateTransform({ control, application }) {
if (!application.enableTranslation) {
this.queueTransformStream(translateReactFilesTransform(control.getWebappTranslation), {
Expand All @@ -120,6 +118,17 @@ export default class ReactGenerator extends BaseApplicationGenerator {
});
}
},
});
}

get [BaseApplicationGenerator.DEFAULT]() {
return this.delegateTasksToBlueprint(() => this.default);
}

get writing() {
return {
cleanupOldFilesTask,
writeFiles,
};
}

Expand Down
39 changes: 24 additions & 15 deletions generators/vue/generator.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,30 @@ export default class VueGenerator extends BaseApplicationGenerator {
return this.delegateTasksToBlueprint(() => this.preparingEachEntity);
}

get default() {
return this.asDefaultTaskGroup({
async queueTranslateTransform({ control, application }) {
const { enableTranslation, clientSrcDir } = application;
const { getWebappTranslation } = control;
this.queueTransformStream(translateVueFilesTransform.call(this, { enableTranslation, getWebappTranslation }), {
name: 'translating webapp',
streamOptions: { filter: file => isFilePending(file) && isTranslatedVueFile(file) },
});
if (enableTranslation) {
const { transform, isTranslationFile } = convertTranslationsSupport({ clientSrcDir });
this.queueTransformStream(transform, {
name: 'converting translations',
streamOptions: { filter: file => isFilePending(file) && isTranslationFile(file) },
});
}
},
});
}

get [BaseApplicationGenerator.DEFAULT]() {
return this.asDefaultTaskGroup(this.delegateTasksToBlueprint(() => this.default));
}

get writing() {
return this.asWritingTaskGroup({
cleanupOldFilesTask,
Expand All @@ -128,21 +152,6 @@ export default class VueGenerator extends BaseApplicationGenerator {
cleanupEntitiesFiles,
writeEntitiesFiles,
writeEntityFiles,
async queueTranslateTransform({ control, application }) {
const { enableTranslation, clientSrcDir } = application;
const { getWebappTranslation } = control;
this.queueTransformStream(translateVueFilesTransform.call(this, { enableTranslation, getWebappTranslation }), {
name: 'translating webapp',
streamOptions: { filter: file => isFilePending(file) && isTranslatedVueFile(file) },
});
if (enableTranslation) {
const { transform, isTranslationFile } = convertTranslationsSupport({ clientSrcDir });
this.queueTransformStream(transform, {
name: 'converting translations',
streamOptions: { filter: file => isFilePending(file) && isTranslationFile(file) },
});
}
},
});
}

Expand Down

0 comments on commit 3611803

Please sign in to comment.