From dda81fe69b7789b9cfe6f32039717edbfb50cb2d Mon Sep 17 00:00:00 2001 From: Marcelo Shima Date: Mon, 5 Aug 2024 09:11:14 -0300 Subject: [PATCH 1/2] don't sort maven pom imports --- generators/maven/internal/pom-sort.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/generators/maven/internal/pom-sort.ts b/generators/maven/internal/pom-sort.ts index 518d4433c501..f2c1d56c5e85 100644 --- a/generators/maven/internal/pom-sort.ts +++ b/generators/maven/internal/pom-sort.ts @@ -18,7 +18,7 @@ */ import sortKeys from 'sort-keys'; -import { MavenArtifact, MavenProfile } from '../types.js'; +import { MavenDependency, MavenProfile } from '../types.js'; export const formatPomFirstLevel = content => content.replace( @@ -97,8 +97,14 @@ const comparator = (order: string[]) => (a: string, b: string) => sortWithTempla const sortProperties = properties => sortKeys(properties, { compare: comparator(propertiesOrder) }); -const sortArtifacts = (artifacts: MavenArtifact[]) => - artifacts.sort((a: MavenArtifact, b: MavenArtifact) => { +const sortArtifacts = (artifacts: MavenDependency[]) => + artifacts.sort((a: MavenDependency, b: MavenDependency) => { + if (a.scope === 'import' || b.scope === 'import') { + if (a.scope === b.scope) { + return 1; + } + return a.scope === 'import' ? -1 : 1; + } if (a.groupId !== b.groupId) { if (a.groupId === undefined) { return -1; From dae92d623a3f89872a9b5ee351cda30f35aea9f8 Mon Sep 17 00:00:00 2001 From: Marcelo Shima Date: Mon, 5 Aug 2024 09:01:59 -0300 Subject: [PATCH 2/2] add jhipster 7 behavior change --- generators/base/support/jhipster7-context.js | 34 +++++++++++++++++--- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/generators/base/support/jhipster7-context.js b/generators/base/support/jhipster7-context.js index ce1efc630eea..971ace70b13a 100644 --- a/generators/base/support/jhipster7-context.js +++ b/generators/base/support/jhipster7-context.js @@ -18,6 +18,30 @@ import { upperFirstCamelCase } from './string.js'; const { BYTES, BYTE_BUFFER } = fieldTypes.RelationalOnlyDBTypes; export const jhipster7deprecatedProperties = { + devDatabaseType: { + behaviorOnlyReason: 'v8: devDatabaseType is only used in jhipster:spring-data-relational generator', + get: ({ data }) => { + if (data.devDatabaseType === undefined) return data.devDatabaseType; + const fallbackValue = data.prodDatabaseType ?? data.databaseType; + // eslint-disable-next-line no-console + console.log( + `JHipster v8 behavior change(devDatabaseType is only used in jhipster:spring-data-relational generator): devDatabaseType is not set, using fallback: ${fallbackValue}`, + ); + return fallbackValue; + }, + }, + prodDatabaseType: { + behaviorOnlyReason: 'v8: prodDatabaseType is only used in jhipster:spring-data-relational generator', + get: ({ data }) => data.prodDatabaseType ?? data.databaseType, + get: ({ data }) => { + if (data.prodDatabaseType === undefined) return data.prodDatabaseType; + // eslint-disable-next-line no-console + console.log( + `JHipster v8 behavior change(prodDatabaseType is only used in jhipster:spring-data-relational generator): devDatabaseType is not set, using fallback: ${data.databaseType}`, + ); + return data.databaseType; + }, + }, GRADLE_VERSION: { replacement: 'gradleVersion', get: ({ data }) => data.gradleVersion, @@ -300,12 +324,14 @@ const getPropertBuilder = const { generator, data } = context; const value = prop in data ? data[prop] : undefined; if (prop in jhipster7deprecatedProperties) { - const { replacement, get } = jhipster7deprecatedProperties[prop]; + const { replacement, get, behaviorOnlyReason } = jhipster7deprecatedProperties[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}`, - ); + if (!behaviorOnlyReason) { + log( + `Template data ${chalk.yellow(String(prop))} was removed and should be replaced with ${chalk.yellow(replacement)}. ${valueDesc}FallbackValue: ${fallBackValue}`, + ); + } return value ?? fallBackValue; } if (prop?.startsWith?.('DOCKER_')) {