nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: jhipster/jhipster-lite
Pull request #11872 (2025-02-07 11:12:09)

improve regex to patch react i18n files to be more flexible


Patch:
diff --git a/src/main/java/tech/jhipster/lite/generator/client/react/i18n/domain/ReactI18nModuleFactory.java b/src/main/java/tech/jhipster/lite/generator/client/react/i18n/domain/ReactI18nModuleFactory.java
index a5badc7e0..ddf36d8cb 100644
--- a/src/main/java/tech/jhipster/lite/generator/client/react/i18n/domain/ReactI18nModuleFactory.java
+++ b/src/main/java/tech/jhipster/lite/generator/client/react/i18n/domain/ReactI18nModuleFactory.java
@@ -60,13 +60,13 @@ public class ReactI18nModuleFactory {
           .add(text(".use(LanguageDetector)"), ".use(initReactI18next).use(LanguageDetector)")
         .and()
         .in(path(INDEX + "home/infrastructure/primary/HomePage.tsx"))
-          .add(lineAfterText("import ReactLogo from '@assets/ReactLogo.png';"), "import { useTranslation } from 'react-i18next';")
+          .add(lineBeforeText("function HomePage"), "import { useTranslation } from 'react-i18next';" + LINE_BREAK)
           .add(lineBeforeText("return ("), properties.indentation().times(1) + "const { t } = useTranslation();" + LINE_BREAK)
           .add(lineAfterText("</h1>"), LINE_BREAK +
             properties.indentation().times(4) + "<p>{t('home.translationEnabled')}</p>")
           .and()
         .in(path(INDEX + "index.tsx"))
-          .add(lineAfterText("import './index.css';"), "import './i18n';" + LINE_BREAK)
+          .add(lineBeforeText("const container = document.getElementById('root');"), "import './i18n';" + LINE_BREAK)
           .and()
         .in(path(INDEX_TEST + "webapp/unit/home/infrastructure/primary/HomePage.spec.tsx"))
           .add(append(), LINE_BREAK + """


Test patch:
diff --git a/src/test/resources/tech/jhipster/lite/generator/client/react/i18n/domain/ReactI18nModuleFactoryTest.shouldBuildI18nModule.HomePage.tsx.approved.txt b/src/test/resources/tech/jhipster/lite/generator/client/react/i18n/domain/ReactI18nModuleFactoryTest.shouldBuildI18nModule.HomePage.tsx.approved.txt
index 4f532fd97..14b0ad551 100644
--- a/src/test/resources/tech/jhipster/lite/generator/client/react/i18n/domain/ReactI18nModuleFactoryTest.shouldBuildI18nModule.HomePage.tsx.approved.txt
+++ b/src/test/resources/tech/jhipster/lite/generator/client/react/i18n/domain/ReactI18nModuleFactoryTest.shouldBuildI18nModule.HomePage.tsx.approved.txt
@@ -2,6 +2,7 @@ import './HomePage.css';
 
 import JHipsterLiteNeonBlue from '@assets/JHipster-Lite-neon-blue.png';
 import ReactLogo from '@assets/ReactLogo.png';
+
 import { useTranslation } from 'react-i18next';
 
 function HomePage() {
Repository: jhipster/jhipster-lite
Pull request #11876 (2025-02-08 16:35:10)

Display invalid project folder in logs


Patch:
diff --git a/src/main/java/tech/jhipster/lite/module/infrastructure/primary/InvalidProjectFolderException.java b/src/main/java/tech/jhipster/lite/module/infrastructure/primary/InvalidProjectFolderException.java
index 44e7ceb64..b5001840c 100644
--- a/src/main/java/tech/jhipster/lite/module/infrastructure/primary/InvalidProjectFolderException.java
+++ b/src/main/java/tech/jhipster/lite/module/infrastructure/primary/InvalidProjectFolderException.java
@@ -7,7 +7,7 @@ import tech.jhipster.lite.shared.error.domain.GeneratorException;
 @ResponseStatus(value = HttpStatus.BAD_REQUEST)
 class InvalidProjectFolderException extends GeneratorException {
 
-  public InvalidProjectFolderException() {
-    super(badRequest(ProjectFolderErrorKey.INVALID_FOLDER).message("Project folder is not valid"));
+  public InvalidProjectFolderException(String folder) {
+    super(badRequest(ProjectFolderErrorKey.INVALID_FOLDER).message("Project folder is not valid: " + folder));
   }
 }
diff --git a/src/main/java/tech/jhipster/lite/module/infrastructure/primary/RestJHipsterModuleProperties.java b/src/main/java/tech/jhipster/lite/module/infrastructure/primary/RestJHipsterModuleProperties.java
index fa1367722..5fb8383d6 100644
--- a/src/main/java/tech/jhipster/lite/module/infrastructure/primary/RestJHipsterModuleProperties.java
+++ b/src/main/java/tech/jhipster/lite/module/infrastructure/primary/RestJHipsterModuleProperties.java
@@ -34,7 +34,7 @@ class RestJHipsterModuleProperties {
 
   private void assertValidProjectFolder(ProjectFolder jHipsterProjectFolderFactory) {
     if (jHipsterProjectFolderFactory.isInvalid(projectFolder)) {
-      throw new InvalidProjectFolderException();
+      throw new InvalidProjectFolderException(projectFolder);
     }
   }
 


Test patch:
diff --git a/src/test/java/tech/jhipster/lite/module/infrastructure/primary/InvalidProjectFolderExceptionTest.java b/src/test/java/tech/jhipster/lite/module/infrastructure/primary/InvalidProjectFolderExceptionTest.java
index 2f02fe756..baea14ccb 100644
--- a/src/test/java/tech/jhipster/lite/module/infrastructure/primary/InvalidProjectFolderExceptionTest.java
+++ b/src/test/java/tech/jhipster/lite/module/infrastructure/primary/InvalidProjectFolderExceptionTest.java
@@ -11,9 +11,9 @@ class InvalidProjectFolderExceptionTest {
 
   @Test
   void shouldGetExceptionInformation() {
-    InvalidProjectFolderException exception = new InvalidProjectFolderException();
+    InvalidProjectFolderException exception = new InvalidProjectFolderException("/chips");
 
-    assertThat(exception.getMessage()).isEqualTo("Project folder is not valid");
+    assertThat(exception.getMessage()).isEqualTo("Project folder is not valid: /chips");
     assertThat(exception.status()).isEqualTo(ErrorStatus.BAD_REQUEST);
     assertThat(exception.key()).isEqualTo(ProjectFolderErrorKey.INVALID_FOLDER);
   }
Repository: jhipster/jhipster-lite
Pull request #11899 (2025-02-12 20:13:41)

feat(liquibase): configure a default dedicated liquibase context for tests


Patch:
diff --git a/src/main/java/tech/jhipster/lite/generator/server/springboot/dbmigration/liquibase/domain/LiquibaseModuleFactory.java b/src/main/java/tech/jhipster/lite/generator/server/springboot/dbmigration/liquibase/domain/LiquibaseModuleFactory.java
index 36ebd0f5d..db020dc5c 100644
--- a/src/main/java/tech/jhipster/lite/generator/server/springboot/dbmigration/liquibase/domain/LiquibaseModuleFactory.java
+++ b/src/main/java/tech/jhipster/lite/generator/server/springboot/dbmigration/liquibase/domain/LiquibaseModuleFactory.java
@@ -43,6 +43,9 @@ public class LiquibaseModuleFactory {
       .springMainProperties()
         .set(propertyKey("spring.liquibase.change-log"), propertyValue("classpath:config/liquibase/master.xml"))
         .and()
+      .springTestProperties()
+        .set(propertyKey("spring.liquibase.contexts"), propertyValue("test"))
+        .and()
       .files()
         .add(SOURCE.file("resources/master.xml"), to("src/main/resources/config/liquibase/master.xml"))
         .add(SOURCE.file("resources/0000000000_example.xml"), to("src/main/resources/config/liquibase/changelog/0000000000_example.xml"))


Test patch:
diff --git a/src/test/java/tech/jhipster/lite/generator/server/springboot/dbmigration/liquibase/domain/LiquibaseModuleFactoryTest.java b/src/test/java/tech/jhipster/lite/generator/server/springboot/dbmigration/liquibase/domain/LiquibaseModuleFactoryTest.java
index a434ab291..ffd5a8557 100644
--- a/src/test/java/tech/jhipster/lite/generator/server/springboot/dbmigration/liquibase/domain/LiquibaseModuleFactoryTest.java
+++ b/src/test/java/tech/jhipster/lite/generator/server/springboot/dbmigration/liquibase/domain/LiquibaseModuleFactoryTest.java
@@ -57,6 +57,15 @@ class LiquibaseModuleFactoryTest {
             liquibase:
               change-log: classpath:config/liquibase/master.xml
           """
+        )
+        .and()
+        .hasFile("src/test/resources/config/application-test.yml")
+        .containing(
+          """
+          spring:
+            liquibase:
+              contexts: test
+          """
         );
     }
   }
Repository: jhipster/jhipster-lite
Pull request #12084 (2025-03-11 23:09:42)

fix(typescript): add missing @eslint/js dependency


Patch:
diff --git a/src/main/java/tech/jhipster/lite/generator/typescript/core/domain/TypescriptModuleFactory.java b/src/main/java/tech/jhipster/lite/generator/typescript/core/domain/TypescriptModuleFactory.java
index 626e5e8d8..b537ad961 100644
--- a/src/main/java/tech/jhipster/lite/generator/typescript/core/domain/TypescriptModuleFactory.java
+++ b/src/main/java/tech/jhipster/lite/generator/typescript/core/domain/TypescriptModuleFactory.java
@@ -38,6 +38,7 @@ public class TypescriptModuleFactory {
         .addDevDependency(packageName("@vitest/coverage-istanbul"), COMMON)
         .addDevDependency(packageName("eslint"), COMMON)
         .addDevDependency(packageName("eslint-config-prettier"), COMMON)
+        .addDevDependency(packageName("@eslint/js"), COMMON)
         .addDevDependency(packageName("globals"), COMMON)
         .addDevDependency(packageName("npm-run-all2"), COMMON)
         .addDevDependency(packageName("typescript-eslint"), COMMON)
diff --git a/src/main/resources/generator/dependencies/common/package.json b/src/main/resources/generator/dependencies/common/package.json
index 0eed5fbde..9570fcff7 100644
--- a/src/main/resources/generator/dependencies/common/package.json
+++ b/src/main/resources/generator/dependencies/common/package.json
@@ -5,6 +5,7 @@
   "license": "Apache-2.0",
   "dependencies": {
     "@babel/cli": "7.26.4",
+    "@eslint/js": "9.22.0",
     "@playwright/test": "1.51.0",
     "@prettier/plugin-pug": "3.2.1",
     "@prettier/plugin-xml": "3.4.1",


Test patch:
diff --git a/src/test/java/tech/jhipster/lite/generator/typescript/domain/core/TypescriptModuleFactoryTest.java b/src/test/java/tech/jhipster/lite/generator/typescript/domain/core/TypescriptModuleFactoryTest.java
index 02239faeb..d3b72b3f9 100644
--- a/src/test/java/tech/jhipster/lite/generator/typescript/domain/core/TypescriptModuleFactoryTest.java
+++ b/src/test/java/tech/jhipster/lite/generator/typescript/domain/core/TypescriptModuleFactoryTest.java
@@ -45,6 +45,7 @@ class TypescriptModuleFactoryTest {
       .containing(nodeDependency("@vitest/coverage-istanbul"))
       .containing(nodeDependency("eslint"))
       .containing(nodeDependency("eslint-config-prettier"))
+      .containing(nodeDependency("@eslint/js"))
       .containing(nodeDependency("globals"))
       .containing(nodeDependency("typescript-eslint"))
       .containing(nodeDependency("vite-tsconfig-paths"))
Repository: jhipster/jhipster-lite
Pull request #12231 (2025-04-02 21:40:50)

feat(spring-boot): avoid declaring twice the logging level for tests
It was declared in both application-test.yml and logback.xml


Patch:
diff --git a/src/main/java/tech/jhipster/lite/generator/server/springboot/core/domain/SpringBootCoreModuleFactory.java b/src/main/java/tech/jhipster/lite/generator/server/springboot/core/domain/SpringBootCoreModuleFactory.java
index 39c7ba17e..14a113dd4 100644
--- a/src/main/java/tech/jhipster/lite/generator/server/springboot/core/domain/SpringBootCoreModuleFactory.java
+++ b/src/main/java/tech/jhipster/lite/generator/server/springboot/core/domain/SpringBootCoreModuleFactory.java
@@ -100,7 +100,6 @@ public class SpringBootCoreModuleFactory {
         .and()
       .springTestProperties()
         .set(propertyKey("spring.main.banner-mode"), propertyValue("off"))
-        .set(propertyKey(basePackageLoggingLevel), propertyValue("OFF"))
         .set(propertyKey("logging.config"), propertyValue("classpath:logback.xml"))
         .and()
       .optionalReplacements()


Test patch:
diff --git a/src/test/java/tech/jhipster/lite/generator/server/springboot/core/domain/SpringBootCoreModuleFactoryTest.java b/src/test/java/tech/jhipster/lite/generator/server/springboot/core/domain/SpringBootCoreModuleFactoryTest.java
index 714f95174..93f09dc98 100644
--- a/src/test/java/tech/jhipster/lite/generator/server/springboot/core/domain/SpringBootCoreModuleFactoryTest.java
+++ b/src/test/java/tech/jhipster/lite/generator/server/springboot/core/domain/SpringBootCoreModuleFactoryTest.java
@@ -1,6 +1,11 @@
 package tech.jhipster.lite.generator.server.springboot.core.domain;
 
-import static tech.jhipster.lite.module.infrastructure.secondary.JHipsterModulesAssertions.*;
+import static tech.jhipster.lite.module.infrastructure.secondary.JHipsterModulesAssertions.ModuleFile;
+import static tech.jhipster.lite.module.infrastructure.secondary.JHipsterModulesAssertions.assertThatModuleWithFiles;
+import static tech.jhipster.lite.module.infrastructure.secondary.JHipsterModulesAssertions.file;
+import static tech.jhipster.lite.module.infrastructure.secondary.JHipsterModulesAssertions.gradleBuildFile;
+import static tech.jhipster.lite.module.infrastructure.secondary.JHipsterModulesAssertions.gradleLibsVersionFile;
+import static tech.jhipster.lite.module.infrastructure.secondary.JHipsterModulesAssertions.pomFile;
 
 import org.junit.jupiter.api.Nested;
 import org.junit.jupiter.api.Test;
@@ -175,10 +180,6 @@ class SpringBootCoreModuleFactoryTest {
           """
           logging:
             config: classpath:logback.xml
-            level:
-              tech:
-                jhipster:
-                  jhlitest: 'OFF'
           spring:
             main:
               banner-mode: 'off'
Repository: jhipster/jhipster-lite
Pull request #12249 (2025-04-04 19:57:26)

Angular: Fix empty line on environment files
Before
![image](https://github.com/user-attachments/assets/c7eda4f5-e39b-451e-9e14-28c15883565d)

After
![image](https://github.com/user-attachments/assets/f38f2778-7819-4c3e-91c5-75e4af49dee5)



Patch:
diff --git a/src/main/java/tech/jhipster/lite/generator/client/angular/security/oauth2/domain/AngularOauth2ModuleFactory.java b/src/main/java/tech/jhipster/lite/generator/client/angular/security/oauth2/domain/AngularOauth2ModuleFactory.java
index 8f61a1500..b9a06cca3 100644
--- a/src/main/java/tech/jhipster/lite/generator/client/angular/security/oauth2/domain/AngularOauth2ModuleFactory.java
+++ b/src/main/java/tech/jhipster/lite/generator/client/angular/security/oauth2/domain/AngularOauth2ModuleFactory.java
@@ -151,6 +151,7 @@ public class AngularOauth2ModuleFactory {
   }
 
   private String keycloakEnvironment(Indentation indentation) {
-    return KEYCLOAK_ENVIRONMENT.indent(indentation.spacesCount());
+    String keycloakEnvironmentIndent = KEYCLOAK_ENVIRONMENT.indent(indentation.spacesCount());
+    return keycloakEnvironmentIndent.substring(0, keycloakEnvironmentIndent.length() - 1);
   }
 }


Test patch:
diff --git a/src/test/java/tech/jhipster/lite/generator/client/angular/security/oauth2/domain/AngularOauth2ModuleFactoryTest.java b/src/test/java/tech/jhipster/lite/generator/client/angular/security/oauth2/domain/AngularOauth2ModuleFactoryTest.java
index 91fa4c33d..4a6850f29 100644
--- a/src/test/java/tech/jhipster/lite/generator/client/angular/security/oauth2/domain/AngularOauth2ModuleFactoryTest.java
+++ b/src/test/java/tech/jhipster/lite/generator/client/angular/security/oauth2/domain/AngularOauth2ModuleFactoryTest.java
@@ -63,6 +63,7 @@ class AngularOauth2ModuleFactoryTest {
             realm: 'jhipster',
             client_id: 'web_app',
           },
+          production: true,
         """
       )
       .and()