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

generate-blueprint: migrate tests to blueprint as array #27385

Merged
merged 2 commits into from
Sep 23, 2024
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
5 changes: 4 additions & 1 deletion generators/base/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -540,8 +540,11 @@ export default class JHipsterBaseBlueprintGenerator<TaskTypes extends BaseTaskTy
private async _configureBlueprints() {
let argvBlueprints = this.options.blueprints || '';
// check for old single blueprint declaration
const { blueprint } = this.options;
let { blueprint } = this.options;
if (blueprint) {
if (typeof blueprint === 'string') {
blueprint = [blueprint];
}
this.log.warn('--blueprint option is deprecated. Please use --blueprints instead');
argvBlueprints = union(blueprint, argvBlueprints.split(',')).join(',');
}
Expand Down
9 changes: 9 additions & 0 deletions generators/generate-blueprint/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,15 @@ export default class extends BaseGenerator {

get postWriting() {
return this.asPostWritingTaskGroup({
upgrade() {
if (!this.application[GENERATORS]) return;
if (!this.isJhipsterVersionLessThan('8.7.2')) return;
for (const generator of Object.keys(this.application[GENERATORS])) {
const extension = this.application.js ? 'js' : 'mjs';
const generatorSpec = `${this.application.blueprintsPath}${generator}/generator.spec.${extension}`;
this.editFile(generatorSpec, content => content.replaceAll(/blueprint: '([\w-]*)'/g, "blueprint: ['$1']"));
}
},
packageJson() {
if (this.jhipsterConfig[LOCAL_BLUEPRINT_OPTION]) return;
const { packagejs } = this.application;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ describe('SubGenerator <%= subGenerator %> of <%= application.baseName %> JHipst
.withOptions({
ignoreNeedlesError: true,
<%_ if (!customGenerator) { _%>
blueprint: '<%= application.baseName %>',
blueprint: ['<%= application.baseName %>'],
<%_ } _%>
<%_ if (subGenerator === 'jdl') { _%>
inline: 'application { }',
Expand Down
Loading