diff --git a/generators/angular/generator.mts b/generators/angular/generator.mts index d6e0734de28c..688c2fdf3a53 100644 --- a/generators/angular/generator.mts +++ b/generators/angular/generator.mts @@ -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) }, + }); + }, }); } @@ -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) }, - }); - }, }); } diff --git a/generators/common/generator.mjs b/generators/common/generator.mjs index 98f4ab64ce23..1e683584525d 100644 --- a/generators/common/generator.mjs +++ b/generators/common/generator.mjs @@ -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 { @@ -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({ diff --git a/generators/react/generator.mjs b/generators/react/generator.mjs index 43032bef3df9..d3fc6bb9dba1 100644 --- a/generators/react/generator.mjs +++ b/generators/react/generator.mjs @@ -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() { @@ -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), { @@ -120,6 +118,17 @@ export default class ReactGenerator extends BaseApplicationGenerator { }); } }, + }); + } + + get [BaseApplicationGenerator.DEFAULT]() { + return this.delegateTasksToBlueprint(() => this.default); + } + + get writing() { + return { + cleanupOldFilesTask, + writeFiles, }; } diff --git a/generators/vue/generator.mjs b/generators/vue/generator.mjs index 87dd4a3f4bc1..47adff8e1b62 100644 --- a/generators/vue/generator.mjs +++ b/generators/vue/generator.mjs @@ -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, @@ -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) }, - }); - } - }, }); }