Skip to content

Commit

Permalink
change info to extend BaseApplicationGenerator
Browse files Browse the repository at this point in the history
  • Loading branch information
mshima committed Jan 30, 2023
1 parent 90b2b13 commit c9d7912
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions generators/info/generator.mts
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,15 @@
import chalk from 'chalk';
import type { ExecaReturnValue } from 'execa';

import BaseGenerator from '../base/index.mjs';
import BaseApplicationGenerator from '../base-application/index.mjs';
import JSONToJDLEntityConverter from '../../jdl/converters/json-to-jdl-entity-converter.js';
import JSONToJDLOptionConverter from '../../jdl/converters/json-to-jdl-option-converter.js';
import type { JHipsterGeneratorFeatures, JHipsterGeneratorOptions } from '../base/api.mjs';
import { getEntitiesFromDir } from '../base-application/support/entities.mjs';
import { JHIPSTER_CONFIG_DIR } from '../generator-constants.mjs';
import { type BaseApplication } from '../base-application/types.mjs';

export default class InfoGenerator extends BaseGenerator {
export default class InfoGenerator extends BaseApplicationGenerator<BaseApplication> {
constructor(args: string | string[], options: JHipsterGeneratorOptions, features: JHipsterGeneratorFeatures) {
super(args, options, { unique: 'namespace', ...features });

Expand All @@ -45,7 +46,7 @@ export default class InfoGenerator extends BaseGenerator {
this.env.options.skipInstall = true;
}

get [BaseGenerator.INITIALIZING]() {
get [BaseApplicationGenerator.INITIALIZING]() {
return this.asInitializingTaskGroup({
sayHello() {
this.logger.info(chalk.white('Welcome to the JHipster Information Sub-Generator\n'));
Expand Down Expand Up @@ -115,9 +116,8 @@ export default class InfoGenerator extends BaseGenerator {
let jdlObject;
const entities = new Map();
try {
const entityNames = getEntitiesFromDir(this.destinationPath(JHIPSTER_CONFIG_DIR));
entityNames.forEach(entityName => {
entities.set(entityName, this.readDestinationJSON(`${JHIPSTER_CONFIG_DIR}/${entityName}.json`));
this.getExistingEntities().forEach(entity => {
entities.set(entity.name, entity.definition);
});
jdlObject = JSONToJDLEntityConverter.convertEntitiesToJDL({
entities,
Expand Down

0 comments on commit c9d7912

Please sign in to comment.