Skip to content

Commit

Permalink
move options to spring-boot generator
Browse files Browse the repository at this point in the history
  • Loading branch information
mshima committed Apr 3, 2024
1 parent 2d3eb07 commit 28ce4a2
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 27 deletions.
27 changes: 0 additions & 27 deletions generators/server/command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,33 +134,6 @@ const command: JHipsterCommandDefinition = {
},
],
},
feignClient: {
description: 'Generate a feign client',
cli: {
type: Boolean,
},
prompt: {
type: 'confirm',
message: 'Do you want to generate a feign client?',
when: currentAnswer =>
currentAnswer.applicationType === APPLICATION_TYPE_MICROSERVICE &&
currentAnswer.reactive !== undefined &&
!currentAnswer.reactive,
},
default: false,
},
syncUserWithIdp: {
description: 'Allow relationships with User for oauth2 applications',
cli: {
type: Boolean,
},
prompt: gen => ({
type: 'confirm',
message: 'Do you want to allow relationships with User entity?',
when: ({ authenticationType }) => (authenticationType ?? gen.jhipsterConfigWithDefaults.authenticationType) === 'oauth2',
}),
default: false,
},
},
import: [GENERATOR_COMMON, GENERATOR_SPRING_BOOT],
};
Expand Down
30 changes: 30 additions & 0 deletions generators/spring-boot/command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/
import { JHipsterCommandDefinition } from '../base/api.js';
import { GENERATOR_JAVA, GENERATOR_LIQUIBASE, GENERATOR_SPRING_DATA_RELATIONAL } from '../generator-list.js';
import { APPLICATION_TYPE_MICROSERVICE } from '../../jdl/index.js';

const command: JHipsterCommandDefinition = {
options: {
Expand All @@ -29,6 +30,35 @@ const command: JHipsterCommandDefinition = {
hide: true,
},
},
configs: {
feignClient: {
description: 'Generate a feign client',
cli: {
type: Boolean,
},
prompt: {
type: 'confirm',
message: 'Do you want to generate a feign client?',
when: currentAnswer =>
currentAnswer.applicationType === APPLICATION_TYPE_MICROSERVICE &&
currentAnswer.reactive !== undefined &&
!currentAnswer.reactive,
},
default: false,
},
syncUserWithIdp: {
description: 'Allow relationships with User for oauth2 applications',
cli: {
type: Boolean,
},
prompt: gen => ({
type: 'confirm',
message: 'Do you want to allow relationships with User entity?',
when: ({ authenticationType }) => (authenticationType ?? gen.jhipsterConfigWithDefaults.authenticationType) === 'oauth2',
}),
default: false,
},
},
import: [GENERATOR_JAVA, GENERATOR_LIQUIBASE, GENERATOR_SPRING_DATA_RELATIONAL],
};

Expand Down
13 changes: 13 additions & 0 deletions generators/spring-boot/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,19 @@ export default class SpringBootGenerator extends BaseApplicationGenerator {
return this.delegateTasksToBlueprint(() => this.initializing);
}

get prompting() {
return this.asPromptingTaskGroup({
async promptCommand({ control }) {
if (control.existingProject && this.options.askAnswered !== true) return;
await this.promptCurrentJHipsterCommand();
},
});
}

get [BaseApplicationGenerator.PROMPTING]() {
return this.delegateTasksToBlueprint(() => this.prompting);
}

get configuring() {
return this.asConfiguringTaskGroup({
forceReactiveGateway() {
Expand Down

0 comments on commit 28ce4a2

Please sign in to comment.