From e22b0b50ad6c6e7663700b1b96475262502898b4 Mon Sep 17 00:00:00 2001 From: Marcelo Shima Date: Sat, 15 Jun 2024 14:54:10 -0300 Subject: [PATCH 1/8] set __override__ as false at applicationDefaults --- generators/base-application/generator.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generators/base-application/generator.ts b/generators/base-application/generator.ts index c914734190be..71344364da5c 100644 --- a/generators/base-application/generator.ts +++ b/generators/base-application/generator.ts @@ -391,7 +391,7 @@ export default class BaseApplicationGenerator< if ([PREPARING, LOADING].includes(priorityName)) { return { application, - applicationDefaults: data => mutateData(application, data), + applicationDefaults: data => mutateData(application, { __override__: false, ...data }), }; } if (LOADING_ENTITIES === priorityName) { From 3cba7d34b006399bb06504701fdc903ba82356d7 Mon Sep 17 00:00:00 2001 From: Marcelo Shima Date: Sat, 15 Jun 2024 14:55:36 -0300 Subject: [PATCH 2/8] adjust to useNpmWrapper --- generators/bootstrap-application/generator.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generators/bootstrap-application/generator.ts b/generators/bootstrap-application/generator.ts index edc7eff7aa8e..1278a1c9121e 100644 --- a/generators/bootstrap-application/generator.ts +++ b/generators/bootstrap-application/generator.ts @@ -66,7 +66,7 @@ export default class BootstrapApplicationGenerator extends BaseApplicationGenera } applicationDefaults({ - useNpmWrapper: application => application.clientFrameworkAny && application.backendTypeSpringBoot, + useNpmWrapper: application => application.clientFrameworkAny && application.backendTypeJavaAny, documentationArchiveUrl: ({ jhipsterVersion }) => `${JHIPSTER_DOCUMENTATION_URL}${JHIPSTER_DOCUMENTATION_ARCHIVE_PATH}v${jhipsterVersion}`, }); From 904a9fce760bae55231998327c961ac6e37c2285 Mon Sep 17 00:00:00 2001 From: Marcelo Boveto Shima Date: Mon, 17 Jun 2024 14:24:32 -0300 Subject: [PATCH 3/8] force override properties if __override__ is true --- generators/base/support/config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generators/base/support/config.ts b/generators/base/support/config.ts index ce4954a7aaad..0f2c837f0b5f 100644 --- a/generators/base/support/config.ts +++ b/generators/base/support/config.ts @@ -90,7 +90,7 @@ export const mutateData = ( if (override !== false || context[key] === undefined) { context[key] = value(context); } - } else if (context[key] === undefined) { + } else if (context[key] === undefined || override === true) { context[key] = value; } } From 9659680b899ebfdab512bacca73c59d1e6ebd182 Mon Sep 17 00:00:00 2001 From: Marcelo Shima Date: Sat, 15 Jun 2024 14:58:23 -0300 Subject: [PATCH 4/8] skip some operations for falsy backendTypeJavaAny --- generators/java/generators/bootstrap/generator.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/generators/java/generators/bootstrap/generator.ts b/generators/java/generators/bootstrap/generator.ts index 10fc66af45d1..f60a22221e23 100644 --- a/generators/java/generators/bootstrap/generator.ts +++ b/generators/java/generators/bootstrap/generator.ts @@ -134,7 +134,7 @@ export default class BootstrapGenerator extends BaseApplicationGenerator { (application as any).domains = entityPackages; }, generatedAnnotation({ application }) { - if (this.jhipsterConfig.withGeneratedFlag) { + if (this.jhipsterConfig.withGeneratedFlag && application.backendTypeJavaAny) { this.queueTransformStream( { name: 'adding @GeneratedByJHipster annotations', @@ -146,6 +146,8 @@ export default class BootstrapGenerator extends BaseApplicationGenerator { } }, generatedPackageInfo({ application }) { + if (!application.backendTypeJavaAny) return; + const { srcMainJava } = application; if (this.packageInfoFile && srcMainJava) { const mainPackageMatch = matchMainJavaFiles(srcMainJava!); @@ -188,6 +190,8 @@ export default class BootstrapGenerator extends BaseApplicationGenerator { get writing() { return this.asWritingTaskGroup({ async writing({ application }) { + if (!application.backendTypeJavaAny) return; + await this.writeFiles({ blocks: [ javaMainPackageTemplatesBlock({ From 4472e5883db4a1b07f3a5e80bcdad4d289d4e5c2 Mon Sep 17 00:00:00 2001 From: Marcelo Shima Date: Sun, 16 Jun 2024 16:08:43 -0300 Subject: [PATCH 5/8] add sortMavenPom option --- generators/ci-cd/generator.js | 2 +- generators/heroku/generator.js | 2 +- .../java/generators/build-tool/command.ts | 4 +-- generators/languages/generator.js | 1 + generators/maven/command.ts | 36 +++++++++++++++++++ generators/maven/generator.ts | 6 +++- generators/maven/index.ts | 1 + generators/maven/internal/xml-store.ts | 5 ++- generators/maven/support/pom-store.ts | 9 ++--- 9 files changed, 56 insertions(+), 10 deletions(-) create mode 100644 generators/maven/command.ts diff --git a/generators/ci-cd/generator.js b/generators/ci-cd/generator.js index f80435c1e665..3d9d9be66813 100644 --- a/generators/ci-cd/generator.js +++ b/generators/ci-cd/generator.js @@ -171,7 +171,7 @@ export default class CiCdGenerator extends BaseApplicationGenerator { postWriting({ application }) { if (application.ciCdIntegrations.includes('deploy')) { if (application.buildToolMaven) { - createPomStorage(this).addDistributionManagement({ + createPomStorage(this, { sortFile: false }).addDistributionManagement({ releasesId: application.artifactoryReleasesId, releasesUrl: application.artifactoryReleasesUrl, snapshotsId: application.artifactorySnapshotsId, diff --git a/generators/heroku/generator.js b/generators/heroku/generator.js index c89b4f8f2b3a..5d3ff385924a 100644 --- a/generators/heroku/generator.js +++ b/generators/heroku/generator.js @@ -530,7 +530,7 @@ export default class HerokuGenerator extends BaseGenerator { * @param {string} other - explicit other thing: build, dependencies... */ addMavenProfile(profileId, other) { - createPomStorage(this).addProfile({ id: profileId, content: other }); + createPomStorage(this, { sortFile: false }).addProfile({ id: profileId, content: other }); } /** diff --git a/generators/java/generators/build-tool/command.ts b/generators/java/generators/build-tool/command.ts index 880c07694f0a..eee4d7155901 100644 --- a/generators/java/generators/build-tool/command.ts +++ b/generators/java/generators/build-tool/command.ts @@ -18,7 +18,7 @@ */ import { buildToolTypes } from '../../../../jdl/index.js'; import type { JHipsterCommandDefinition } from '../../../base/api.js'; -import { GENERATOR_GRADLE } from '../../../generator-list.js'; +import { GENERATOR_GRADLE, GENERATOR_MAVEN } from '../../../generator-list.js'; const { GRADLE, MAVEN } = buildToolTypes; @@ -43,7 +43,7 @@ const command: JHipsterCommandDefinition = { scope: 'storage', }, }, - import: [GENERATOR_GRADLE], + import: [GENERATOR_GRADLE, GENERATOR_MAVEN], }; export default command; diff --git a/generators/languages/generator.js b/generators/languages/generator.js index aa6fe4fd38c1..d229051ce17e 100644 --- a/generators/languages/generator.js +++ b/generators/languages/generator.js @@ -342,6 +342,7 @@ export default class LanguagesGenerator extends BaseApplicationGenerator { application.enableTranslation && application.generateUserManagement && !application.skipServer && + application.backendTypeJavaAny && application.backendTypeSpringBoot ) { updateLanguagesInJava.call(this, { application, control }); diff --git a/generators/maven/command.ts b/generators/maven/command.ts new file mode 100644 index 000000000000..2ada75a961a8 --- /dev/null +++ b/generators/maven/command.ts @@ -0,0 +1,36 @@ +/** + * Copyright 2013-2024 the original author or authors from the JHipster project. + * + * This file is part of the JHipster project, see https://www.jhipster.tech/ + * for more information. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { JHipsterCommandDefinition } from '../base/api.js'; + +const command: JHipsterCommandDefinition = { + options: {}, + configs: { + sortMavenPom: { + description: 'Sort the pom.xml file', + cli: { + type: Boolean, + hide: true, + }, + scope: 'generator', + }, + }, + import: [], +}; + +export default command; diff --git a/generators/maven/generator.ts b/generators/maven/generator.ts index 0ad870d0ee15..a1cfa87a0326 100644 --- a/generators/maven/generator.ts +++ b/generators/maven/generator.ts @@ -29,6 +29,7 @@ import { createPomStorage, type PomStorage } from './support/index.js'; export default class MavenGenerator extends BaseApplicationGenerator { pomStorage!: PomStorage; + sortMavenPom!: boolean; async beforeQueue() { if (!this.fromBlueprint) { @@ -42,8 +43,11 @@ export default class MavenGenerator extends BaseApplicationGenerator = { }; export default class XmlStorage { - sortFile: boolean = true; + sortFile: boolean; protected readonly saveFile: (string) => void; protected readonly loadFile: () => string; @@ -54,11 +54,13 @@ export default class XmlStorage { loadFile, xmlParserOptions, xmlBuildOptions, + sortFile, }: { saveFile: (string) => void; loadFile: () => string; xmlParserOptions?: Partial; xmlBuildOptions?: Partial; + sortFile?: boolean; }) { assert(saveFile, 'saveFile callback is required to create a storage'); assert(loadFile, 'loadFile callback is required to create a storage'); @@ -68,6 +70,7 @@ export default class XmlStorage { this.saveFile = saveFile; this.loadFile = loadFile; + this.sortFile = sortFile ?? true; } public clearCache() { diff --git a/generators/maven/support/pom-store.ts b/generators/maven/support/pom-store.ts index 352fd1e25b2f..3a556ca9a8fc 100644 --- a/generators/maven/support/pom-store.ts +++ b/generators/maven/support/pom-store.ts @@ -160,7 +160,7 @@ const sortArtifacts = (artifacts: MavenArtifact[]) => return a.artifactId.localeCompare(b.artifactId); }); -const sortProfiles = (profiles: MavenProfile[]) => profiles.sort((a, b) => a.id.localeCompare(b.id)); +const sortProfiles = (profiles: MavenProfile[]) => profiles.sort((a, b) => a.id?.localeCompare(b.id) ?? 1); const ensureChildPath = (node: any, childPath) => { let child = get(node, childPath); @@ -206,8 +206,8 @@ const reorderDependency = }: Dependency): Dependency => ({ inProfile, groupId, artifactId, version, type, scope, classifier, ...rest }) as Dependency; export default class PomStorage extends XmlStorage { - constructor({ saveFile, loadFile }: { saveFile: (string) => void; loadFile: () => string }) { - super({ saveFile, loadFile }); + constructor({ saveFile, loadFile, sortFile }: { saveFile: (string) => void; loadFile: () => string; sortFile?: boolean }) { + super({ saveFile, loadFile, sortFile }); } public addProperty({ inProfile, property, value = null }: MavenProperty) { @@ -354,11 +354,12 @@ const emptyPomFile = ` `; -export const createPomStorage = (generator: CoreGenerator) => { +export const createPomStorage = (generator: CoreGenerator, { sortFile }: { sortFile?: boolean } = {}) => { const loadFile = () => generator.readDestination('pom.xml', { defaults: emptyPomFile })?.toString() ?? ''; const pomStorage = new PomStorage({ loadFile, saveFile: content => generator.writeDestination('pom.xml', formatFirstXmlLevel(content)), + sortFile, }); generator.fs.store.on('change', filename => { if (filename === generator.destinationPath('pom.xml')) { From 3419467442ed58382eb8d71cb4286b88da7e0209 Mon Sep 17 00:00:00 2001 From: Marcelo Shima Date: Sat, 15 Jun 2024 12:50:02 -0300 Subject: [PATCH 6/8] improve migration --- generators/base-core/generator.ts | 6 +- generators/base/support/jhipster7-context.js | 263 +++++++++++++------ 2 files changed, 190 insertions(+), 79 deletions(-) diff --git a/generators/base-core/generator.ts b/generators/base-core/generator.ts index a39745c9f149..a03bfeed147c 100644 --- a/generators/base-core/generator.ts +++ b/generators/base-core/generator.ts @@ -836,8 +836,10 @@ templates: ${JSON.stringify(existingTemplates, null, 2)}`; cache: false, }; const copyOptions = { noGlob: true }; - // TODO drop for v8 final release - const data = (this as any).jhipster7Migration ? createJHipster7Context(this, context, { ignoreWarnings: true }) : context; + const { jhipster7Migration } = this as any; + const data = jhipster7Migration + ? createJHipster7Context(this, context, { log: jhipster7Migration === 'verbose' ? msg => this.log.info(msg) : () => {} }) + : context; if (useAsync) { await (this as any).renderTemplateAsync(sourceFileFrom, targetFile, data, renderOptions, copyOptions); } else { diff --git a/generators/base/support/jhipster7-context.js b/generators/base/support/jhipster7-context.js index 3d3b49e55ca8..ac5af58a7f03 100644 --- a/generators/base/support/jhipster7-context.js +++ b/generators/base/support/jhipster7-context.js @@ -1,5 +1,21 @@ /* eslint-disable no-console */ import chalk from 'chalk'; +import { camelCase } from 'lodash-es'; + +import { isReservedTableName } from '../../../jdl/jhipster/reserved-keywords.js'; +import { upperFirstCamelCase } from './string.js'; +import { + getJavaValueGeneratorForType, + getJoinTableName, + getPrimaryKeyValue, + getSpecificationBuildForType, + hibernateSnakeCase, +} from '../../server/support/index.js'; +import { getDBCExtraOption } from '../../spring-data-relational/support/database-data.js'; +import { getJdbcUrl, getR2dbcUrl } from '../../spring-data-relational/support/database-url.js'; +import { fieldTypes } from '../../../jdl/index.js'; + +const { BYTES, BYTE_BUFFER } = fieldTypes.RelationalOnlyDBTypes; const deprecatedProperties = { GRADLE_VERSION: { @@ -18,6 +34,18 @@ const deprecatedProperties = { replacement: 'jhipsterDependenciesVersion', get: ({ data }) => data.jhipsterDependenciesVersion, }, + JAVA_VERSION: { + replacement: 'javaVersion', + get: ({ data }) => data.javaVersion, + }, + JAVA_COMPATIBLE_VERSIONS: { + replacement: 'javaCompatibleVersions', + get: ({ data }) => data.javaCompatibleVersions, + }, + SPRING_BOOT_VERSION: { + replacement: "javaDependencies['spring-boot']", + get: ({ data }) => data.javaDependencies['spring-boot'], + }, DOCKER_DIR: { replacement: 'dockerServicesDir', get: ({ data }) => data.dockerServicesDir, @@ -124,7 +152,7 @@ const deprecatedProperties = { }, dependabotPackageJson: { replacement: 'nodeDependencies', - get: ({ data }) => data.nodeDependencies, + get: ({ data }) => ({ dependencies: data.nodeDependencies, devDependencies: data.nodeDependencies }), }, cacheManagerIsAvailable: { replacement: 'cacheProviderAny', @@ -158,91 +186,172 @@ const deprecatedProperties = { replacement: 'prodDatabaseTypeMssql', get: ({ data }) => data.prodDatabaseTypeMssql, }, + cacheProviderEhCache: { + replacement: 'cacheProviderEhcache', + get: ({ data }) => data.cacheProviderEhcache, + }, + + getJDBCUrl: { + replacement: '(prod/dev)(Jdbc/Liquibase)Url or this.getJDBCUrl', + get: () => getJdbcUrl, + }, + getR2DBCUrl: { + replacement: '(prod/dev)R2dbcUrl of this.getR2DBCUrl', + get: () => getR2dbcUrl, + }, + getDBCExtraOption: { + replacement: '???', + get: () => getDBCExtraOption, + }, + getPrimaryKeyValue: { + replacement: 'current generator this.getPrimaryKeyValue', + get: () => getPrimaryKeyValue, + }, + getJoinTableName: { + replacement: 'joinTable property', + get: () => getJoinTableName, + }, + getJavaValueGeneratorForType: { + replacement: 'javaValueGenerator property', + get: () => type => getJavaValueGeneratorForType(type).replace('longCount', 'count'), + }, + asEntity: { + replacement: 'persistClass property', + get: + ({ data }) => + name => + `${name}${data.entitySuffix}`, + }, + asDto: { + replacement: 'restClass property', + get: + ({ data }) => + name => + `${name}${data.dtoSuffix}`, + }, + upperFirstCamelCase: { + replacement: 'upperFirstCamelCase* property alternative', + get: () => upperFirstCamelCase, + }, + hasOauthUser: { + replacement: 'authenticationTypeOauth2 && generateBuiltInUserEntity', + get: ({ data }) => data.authenticationTypeOauth2 && data.generateBuiltInUserEntity, + }, + getPrettierExtensions: { + replacement: 'prettierExtensions', + get: + ({ data }) => + () => + data.prettierExtensions, + }, + _generateSqlSafeName: { + replacement: 'relationshipSqlSafeName', + get: () => name => (isReservedTableName(name, 'sql') ? `e_${name}` : name), + }, + isFilterableType: { + replacement: 'filterableField property', + get: () => fieldType => ![BYTES, BYTE_BUFFER].includes(fieldType), + }, + getSpecificationBuilder: { + replacement: 'field.fieldJavaBuildSpecification || primaryKey.javaBuildSpecification', + get: () => getSpecificationBuildForType, + }, + getColumnName: { + replacement: 'entityTableName || relationship.columnName', + get: () => hibernateSnakeCase, + }, }; const ejsBuiltInProperties = ['__append', '__line', 'escapeFn', 'include', 'undefined']; const javascriptBuiltInProperties = ['parseInt', 'Boolean', 'JSON', 'Object', 'toString']; -const getProperty = (context, prop) => { - if (typeof prop === 'symbol') { - return undefined; - } - if (prop in deprecatedProperties) { - const { replacement, get } = deprecatedProperties[prop]; - const value = get(context); - console.log( - `Template data ${chalk.yellow(String(prop))} was removed and should be replaced with ${chalk.yellow(replacement)}. Value: ${value}`, - ); - return value; - } - if (prop?.startsWith?.('DOCKER_')) { - console.log( - `Template data ${chalk.yellow(String(prop))} was removed and should be replaced with ${chalk.yellow( - // eslint-disable-next-line no-template-curly-in-string - 'dockerContainers.${dockerImage}', - )}.`, - ); - } - const { generator, data } = context; - if (prop in data) { - return data[prop]; - } - if (prop in generator) { - console.log(`Template data ${chalk.yellow(String(prop))} is a generator property.`); - console.log(`Change the template to '${chalk.yellow(`this.${String(prop)}`)}'`); - return generator[prop]; - } - // console.log(`Template data '${chalk.yellow(String(prop))}' not found. Check your data.`); - // throw new Error(`Template data '${chalk.yellow(String(prop))}' not found. Check your data.`); - if (prop === 'undefined') { - throw new Error('Check your data'); - } - return undefined; -}; +const getPropertBuilder = + ({ log = msg => console.log(msg) } = {}) => + (context, prop) => { + if (typeof prop === 'symbol') { + return undefined; + } -const createHandler = ({ ignoreWarnings = false } = {}) => ({ - ...Object.fromEntries( - [ - 'apply', - 'construct', - 'defineProperty', - 'deleteProperty', - 'getOwnPropertyDescriptor', - 'getPrototypeOf', - 'isExtensible', - 'ownKeys', - 'preventExtensions', - 'setPrototypeOf', - 'set', - ].map(method => [method, (...args) => console.log(`Fixme: template data called ${method}(${args?.pop() ?? ''})`)]), - ), - ownKeys: ({ data }) => { - return Reflect.ownKeys(data); - }, - getPrototypeOf: ({ data }) => { - return Object.getPrototypeOf(data); - }, - getOwnPropertyDescriptor: ({ data }, prop) => { - return Object.getOwnPropertyDescriptor(data, prop); - }, - has: (context, prop) => { - if (ejsBuiltInProperties.includes(prop)) { - return false; + const { generator, data } = context; + const value = prop in data ? data[prop] : undefined; + if (prop in deprecatedProperties) { + const { replacement, get } = deprecatedProperties[prop]; + const fallBackValue = get(context); + const valueDesc = prop in data ? `Value: ${value}, ` : ''; + log( + `Template data ${chalk.yellow(String(prop))} was removed and should be replaced with ${chalk.yellow(replacement)}. ${valueDesc}FallbackValue: ${fallBackValue}`, + ); + return value ?? fallBackValue; } - if (javascriptBuiltInProperties.includes(prop)) { - if (!ignoreWarnings) { - console.log(`${chalk.yellow(prop)} is a javascript built in symbol, its use is discouraged inside templates`); - } - return false; + if (prop?.startsWith?.('DOCKER_')) { + const container = camelCase(prop.replace('DOCKER_', '').replace('_CONTAINER', '')); + log( + `Template data ${chalk.yellow(String(prop))} was removed and should be replaced with ${chalk.yellow( + `dockerContainers.${container}`, + )}.`, + ); + return value ?? data.dockerContainers[container]; } - const propValue = getProperty(context, prop); - if (propValue === undefined) { - return prop in context.data; + if (prop in data) { + return value; } - return propValue !== undefined; - }, - get: getProperty, -}); + if (prop in generator) { + log(`Template data ${chalk.yellow(String(prop))} is a generator property.`); + log(`Change the template to '${chalk.yellow(`this.${String(prop)}`)}'`); + return generator[prop]; + } + // console.log(`Template data '${chalk.yellow(String(prop))}' not found. Check your data.`); + // throw new Error(`Template data '${chalk.yellow(String(prop))}' not found. Check your data.`); + if (prop === 'undefined') { + throw new Error('Check your data'); + } + return undefined; + }; + +const createHandler = ({ log } = {}) => { + const getProperty = getPropertBuilder({ log }); + return { + ...Object.fromEntries( + [ + 'apply', + 'construct', + 'defineProperty', + 'deleteProperty', + 'getOwnPropertyDescriptor', + 'getPrototypeOf', + 'isExtensible', + 'ownKeys', + 'preventExtensions', + 'setPrototypeOf', + 'set', + ].map(method => [method, (...args) => console.log(`Fixme: template data called ${method}(${args?.pop() ?? ''})`)]), + ), + ownKeys: ({ data }) => { + return Reflect.ownKeys(data); + }, + getPrototypeOf: ({ data }) => { + return Object.getPrototypeOf(data); + }, + getOwnPropertyDescriptor: ({ data }, prop) => { + return Object.getOwnPropertyDescriptor(data, prop); + }, + has: (context, prop) => { + if (ejsBuiltInProperties.includes(prop)) { + return false; + } + if (javascriptBuiltInProperties.includes(prop)) { + log(`${chalk.yellow(prop)} is a javascript built in symbol, its use is discouraged inside templates`); + return false; + } + const propValue = getProperty(context, prop); + if (propValue === undefined) { + return prop in context.data; + } + return propValue !== undefined; + }, + get: getProperty, + }; +}; export default function createJHipster7Context(generator, data, options) { return new Proxy({ generator, data }, createHandler(options)); From 3c23184dd99a2bcb60f0d7d912d769285ac808ad Mon Sep 17 00:00:00 2001 From: Marcelo Shima Date: Tue, 18 Jun 2024 00:41:18 -0300 Subject: [PATCH 7/8] support false ignoreApplication to regenerate application using entities jdl --- generators/jdl/generator.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/generators/jdl/generator.ts b/generators/jdl/generator.ts index 0329855f21ca..d59daeb2cf93 100644 --- a/generators/jdl/generator.ts +++ b/generators/jdl/generator.ts @@ -196,7 +196,7 @@ export default class JdlGenerator extends BaseGenerator { const generatorOptions: any = { defaults: true, reproducible: this.options.reproducible ?? this.reproducible, force: this.force }; - if (this.ignoreApplication || this.applications.length === 0) { + if (this.ignoreApplication !== false && (this.ignoreApplication || this.applications.length === 0)) { if (this.applications.length === 0) { const entities = this.exportedEntities; await this.composeWithJHipster(this.entitiesGenerator, { @@ -214,10 +214,7 @@ export default class JdlGenerator extends BaseGenerator { }); } } - } else if (this.applications.length === 1) { - this.log.info('Generating 1 application'); - await this.composeWithJHipster(this.entrypointGenerator, { generatorOptions }); - } else { + } else if (this.applications.length > 1) { this.log.info(`Generating ${this.applications.length} applications`); await this.composeWithJHipster(this.workspacesGenerator, { generatorOptions: { @@ -225,6 +222,9 @@ export default class JdlGenerator extends BaseGenerator { generateApplications: async () => this.runNonInteractive(this.applications, generatorOptions), } as any, }); + } else { + this.log.info('Generating 1 application'); + await this.composeWithJHipster(this.entrypointGenerator, { generatorOptions }); } }, }); From b5d084f19720692824f46b819b714e9eddd9a85c Mon Sep 17 00:00:00 2001 From: Marcelo Shima Date: Tue, 18 Jun 2024 11:49:33 -0300 Subject: [PATCH 8/8] adjust getJoinTableName --- generators/base/support/jhipster7-context.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/generators/base/support/jhipster7-context.js b/generators/base/support/jhipster7-context.js index ac5af58a7f03..d2fa7abe4109 100644 --- a/generators/base/support/jhipster7-context.js +++ b/generators/base/support/jhipster7-context.js @@ -209,7 +209,10 @@ const deprecatedProperties = { }, getJoinTableName: { replacement: 'joinTable property', - get: () => getJoinTableName, + get: + () => + (...args) => + getJoinTableName(...args).value, }, getJavaValueGeneratorForType: { replacement: 'javaValueGenerator property',