Skip to content
Open
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
11 changes: 5 additions & 6 deletions generators/app/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,22 @@
import chalk from 'chalk';
import { camelCase } from 'lodash-es';

import { APPLICATION_TYPE_MICROSERVICE } from '../../lib/core/application-types.ts';
import BaseApplicationGenerator from '../base-application/index.ts';
import type { Application as CommonApplication, Config as CommonConfig, Entity as CommonEntity } from '../common/types.ts';
import { GENERATOR_CLIENT, GENERATOR_COMMON, GENERATOR_SERVER } from '../generator-list.ts';
import { GENERATOR_APP, GENERATOR_CLIENT, GENERATOR_COMMON, GENERATOR_SERVER } from '../generator-list.ts';
import { getDefaultAppName } from '../project-name/support/index.ts';

import cleanupOldFilesTask from './cleanup.ts';
import { checkNode } from './support/index.ts';
import type { Application, Config, Entity } from './types.d.ts';

export default class AppGenerator extends BaseApplicationGenerator<CommonEntity, CommonApplication, CommonConfig> {
export default class AppGenerator extends BaseApplicationGenerator<Entity, Application, Config> {
async beforeQueue() {
if (!this.fromBlueprint) {
await this.composeWithBlueprints();
}

if (!this.delegateToBlueprint) {
await this.dependsOnBootstrap('app');
await this.dependsOnBootstrap(GENERATOR_APP);
}
}

Expand Down Expand Up @@ -70,7 +69,7 @@ export default class AppGenerator extends BaseApplicationGenerator<CommonEntity,
get configuring() {
return this.asConfiguringTaskGroup({
setup() {
if (this.jhipsterConfig.applicationType === APPLICATION_TYPE_MICROSERVICE) {
if (this.jhipsterConfig.applicationType === 'microservice') {
this.jhipsterConfig.skipUserManagement = true;
}
},
Expand Down
7 changes: 3 additions & 4 deletions generators/app/generators/bootstrap/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ import assert from 'node:assert';
import { validations } from '../../../../lib/jhipster/index.ts';
import BaseApplicationGenerator from '../../../base-application/index.ts';
import { stringifyApplicationData } from '../../../base-application/support/index.ts';
import type { Application as CommonApplication, Entity as CommonEntity, Field as CommonField } from '../../../common/types.ts';
import type { Application, Entity, Field } from '../../types.d.ts';

const {
Validations: { MAX, MIN, MAXLENGTH, MINLENGTH, MAXBYTES, MINBYTES, PATTERN },
SUPPORTED_VALIDATION_RULES,
} = validations;

export default class BootstrapApplicationGenerator extends BaseApplicationGenerator<CommonEntity, CommonApplication> {
export default class BootstrapApplicationGenerator extends BaseApplicationGenerator<Entity, Application> {
async beforeQueue() {
if (!this.fromBlueprint) {
await this.composeWithBlueprints();
Expand Down Expand Up @@ -63,7 +63,6 @@ export default class BootstrapApplicationGenerator extends BaseApplicationGenera
if (!application.skipServer) {
prettierExtensions = `${prettierExtensions},java`;
}

applicationDefaults({
// TODO remove prettierExtensions, moved to prettier generator
prettierExtensions,
Expand All @@ -83,7 +82,7 @@ export default class BootstrapApplicationGenerator extends BaseApplicationGenera
entityConfig.name = entityName;
}

entityConfig.fields!.forEach((field: CommonField) => {
entityConfig.fields!.forEach((field: Field) => {
const { fieldName, fieldType, fieldValidateRules } = field;

assert(fieldName, `fieldName is missing in .jhipster/${entityName}.json for field ${stringifyApplicationData(field)}`);
Expand Down
14 changes: 12 additions & 2 deletions generators/app/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,22 @@
* limitations under the License.
*/
import type { HandleCommandTypes } from '../../lib/command/types.ts';
import type { Config as BaseApplicationConfig, Options as BaseApplicationOptions } from '../base-application/types.ts';
import type { Options as BaseApplicationOptions } from '../base-application/types.ts';
import type {
Application as CommonApplication,
Config as CommonConfig,
Entity as CommonEntity,
Field as CommonField,
} from '../common/types.d.ts';

import type command from './command.ts';

type Command = HandleCommandTypes<typeof command>;

export type Config = Command['Config'] & BaseApplicationConfig;
export type Config = Command['Config'] & CommonConfig;

export type Options = Command['Options'] & BaseApplicationOptions;

export type { CommonEntity as Entity };
export type { CommonApplication as Application };
export type { CommonField as Field };
Loading