From 478d48d167d9c28be1c5cd5e2de7d77393d05694 Mon Sep 17 00:00:00 2001 From: Charlie Mordant Date: Thu, 28 Aug 2025 19:06:38 +0200 Subject: [PATCH 1/4] small adjustment on app generator --- generators/app/command.ts | 3 ++- generators/app/generator.ts | 14 ++++---------- .../app/generators/bootstrap/generator.ts | 18 +++++++++++------- generators/app/types.d.ts | 12 +++++++++++- 4 files changed, 28 insertions(+), 19 deletions(-) diff --git a/generators/app/command.ts b/generators/app/command.ts index f42ee64e073a..882e89aad1b3 100644 --- a/generators/app/command.ts +++ b/generators/app/command.ts @@ -18,6 +18,7 @@ */ import type { JHipsterCommandDefinition } from '../../lib/command/index.ts'; import { + GENERATOR_BASE, GENERATOR_BOOTSTRAP, GENERATOR_BOOTSTRAP_APPLICATION_BASE, GENERATOR_CLIENT, @@ -79,7 +80,7 @@ const command = { }, }, import: [ - 'base', + GENERATOR_BASE, GENERATOR_BOOTSTRAP, GENERATOR_BOOTSTRAP_APPLICATION_BASE, 'jhipster:jdl:bootstrap', diff --git a/generators/app/generator.ts b/generators/app/generator.ts index 1ccb5dea07e2..4e7e4544d819 100644 --- a/generators/app/generator.ts +++ b/generators/app/generator.ts @@ -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 { +export default class AppGenerator extends BaseApplicationGenerator { async beforeQueue() { if (!this.fromBlueprint) { await this.composeWithBlueprints(); } if (!this.delegateToBlueprint) { - await this.dependsOnBootstrap('app'); + await this.dependsOnBootstrap(GENERATOR_APP); } } @@ -69,11 +68,6 @@ export default class AppGenerator extends BaseApplicationGenerator { +export default class BootstrapApplicationGenerator extends BaseApplicationGenerator { async beforeQueue() { if (!this.fromBlueprint) { await this.composeWithBlueprints(); @@ -38,14 +39,18 @@ export default class BootstrapApplicationGenerator extends BaseApplicationGenera throw new Error('Only sbs blueprint is supported'); } - await this.dependsOnBootstrap('client'); - await this.dependsOnBootstrap('server'); + await this.dependsOnBootstrap(GENERATOR_CLIENT); + await this.dependsOnBootstrap(GENERATOR_SERVER); } get preparing() { return this.asPreparingTaskGroup({ preparing({ application, applicationDefaults }) { - if (application.authenticationType === 'oauth2' || application.databaseType === 'no') { + if ( + application.authenticationType === 'oauth2' || + application.databaseType === 'no' || + application.applicationType === 'microservice' + ) { application.skipUserManagement = true; } @@ -63,7 +68,6 @@ export default class BootstrapApplicationGenerator extends BaseApplicationGenera if (!application.skipServer) { prettierExtensions = `${prettierExtensions},java`; } - applicationDefaults({ // TODO remove prettierExtensions, moved to prettier generator prettierExtensions, @@ -83,7 +87,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)}`); diff --git a/generators/app/types.d.ts b/generators/app/types.d.ts index 54bfe30e0216..62df35bc90b6 100644 --- a/generators/app/types.d.ts +++ b/generators/app/types.d.ts @@ -18,11 +18,21 @@ */ import type { HandleCommandTypes } from '../../lib/command/types.ts'; import type { Config as BaseApplicationConfig, 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; -export type Config = Command['Config'] & BaseApplicationConfig; +export type Config = Command['Config'] & BaseApplicationConfig & CommonConfig; export type Options = Command['Options'] & BaseApplicationOptions; + +export type { CommonEntity as Entity }; +export type { CommonApplication as Application }; +export type { CommonField as Field }; From c57fa34a8df934f97548a1fe2232b7f7342d0a51 Mon Sep 17 00:00:00 2001 From: Charlie Mordant Date: Thu, 28 Aug 2025 19:15:45 +0200 Subject: [PATCH 2/4] small adjustment on app generator --- generators/app/types.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/generators/app/types.d.ts b/generators/app/types.d.ts index 62df35bc90b6..554c667bcb0d 100644 --- a/generators/app/types.d.ts +++ b/generators/app/types.d.ts @@ -17,7 +17,7 @@ * 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, @@ -29,7 +29,7 @@ import type command from './command.ts'; type Command = HandleCommandTypes; -export type Config = Command['Config'] & BaseApplicationConfig & CommonConfig; +export type Config = Command['Config'] & CommonConfig; export type Options = Command['Options'] & BaseApplicationOptions; From f2a2ad4e30298d94db1bd1808f163c99d1758b8f Mon Sep 17 00:00:00 2001 From: Charlie Mordant Date: Mon, 1 Sep 2025 20:43:22 +0200 Subject: [PATCH 3/4] rollback the use of constant --- generators/app/command.ts | 3 +-- generators/app/generators/bootstrap/generator.ts | 5 ++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/generators/app/command.ts b/generators/app/command.ts index 882e89aad1b3..f42ee64e073a 100644 --- a/generators/app/command.ts +++ b/generators/app/command.ts @@ -18,7 +18,6 @@ */ import type { JHipsterCommandDefinition } from '../../lib/command/index.ts'; import { - GENERATOR_BASE, GENERATOR_BOOTSTRAP, GENERATOR_BOOTSTRAP_APPLICATION_BASE, GENERATOR_CLIENT, @@ -80,7 +79,7 @@ const command = { }, }, import: [ - GENERATOR_BASE, + 'base', GENERATOR_BOOTSTRAP, GENERATOR_BOOTSTRAP_APPLICATION_BASE, 'jhipster:jdl:bootstrap', diff --git a/generators/app/generators/bootstrap/generator.ts b/generators/app/generators/bootstrap/generator.ts index 59cce210b299..2c1cd6e224dd 100644 --- a/generators/app/generators/bootstrap/generator.ts +++ b/generators/app/generators/bootstrap/generator.ts @@ -21,7 +21,6 @@ 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 { GENERATOR_CLIENT, GENERATOR_SERVER } from '../../../generator-list.ts'; import type { Application, Entity, Field } from '../../types.d.ts'; const { @@ -39,8 +38,8 @@ export default class BootstrapApplicationGenerator extends BaseApplicationGenera throw new Error('Only sbs blueprint is supported'); } - await this.dependsOnBootstrap(GENERATOR_CLIENT); - await this.dependsOnBootstrap(GENERATOR_SERVER); + await this.dependsOnBootstrap('client'); + await this.dependsOnBootstrap('server'); } get preparing() { From 54c36a6265e7af41360eeadd040c5ce2850c9781 Mon Sep 17 00:00:00 2001 From: Charlie Mordant Date: Tue, 2 Sep 2025 20:47:47 +0200 Subject: [PATCH 4/4] rollback on app#config.userManagement --- generators/app/generator.ts | 5 +++++ generators/app/generators/bootstrap/generator.ts | 6 +----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/generators/app/generator.ts b/generators/app/generator.ts index 4e7e4544d819..2b8b38f829f3 100644 --- a/generators/app/generator.ts +++ b/generators/app/generator.ts @@ -68,6 +68,11 @@ export default class AppGenerator extends BaseApplicationGenerator