Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move queueTransformStream to default step #23941

Merged
merged 1 commit into from
Oct 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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