Repository: jhipster/jhipster-lite
Pull request #9733 (2024-05-05 18:47:01)

React: improve generated template
Before
```
  <React.StrictMode>
<NextUIProvider>
    <App />
</NextUIProvider>
  </React.StrictMode>
```

After
```
  <React.StrictMode>
    <NextUIProvider>
      <App />
    </NextUIProvider>
  </React.StrictMode>
```


Patch:
diff --git a/src/main/java/tech/jhipster/lite/generator/client/react/security/jwt/domain/ReactJwtModuleFactory.java b/src/main/java/tech/jhipster/lite/generator/client/react/security/jwt/domain/ReactJwtModuleFactory.java
index 864a37e2b..e4e4db0f0 100644
--- a/src/main/java/tech/jhipster/lite/generator/client/react/security/jwt/domain/ReactJwtModuleFactory.java
+++ b/src/main/java/tech/jhipster/lite/generator/client/react/security/jwt/domain/ReactJwtModuleFactory.java
@@ -12,6 +12,8 @@ import tech.jhipster.lite.shared.error.domain.Assert;
 
 public class ReactJwtModuleFactory {
 
+  private static final String APP = "<App />";
+
   private static final JHipsterSource ROOT = from("client/react");
 
   private static final JHipsterSource SOURCE = from("client/react/src");
@@ -85,8 +87,9 @@ public class ReactJwtModuleFactory {
           .and()
         .in(path("src/main/webapp/app/index.tsx"))
           .add(lineBeforeText("import { createRoot } from 'react-dom/client';"), "import { NextUIProvider } from '@nextui-org/react';")
-          .add(lineBeforeText("<App />"), "<NextUIProvider>")
-          .add(lineBeforeText("</React.StrictMode>"), "</NextUIProvider>")
+          .add(lineBeforeText(APP), properties.indentation().times(2) + "<NextUIProvider>")
+          .add(lineBeforeText("</React.StrictMode>"), properties.indentation().times(2) + "</NextUIProvider>")
+          .add(text(APP), properties.indentation().times(1) + APP)
           .and()
         .in(path("src/main/webapp/app/index.css"))
           .add(lineBeforeText("body {"), "@tailwind base;" + LINE_BREAK + "@tailwind components;" + LINE_BREAK + "@tailwind utilities;" + LINE_BREAK)
diff --git a/src/main/java/tech/jhipster/lite/generator/server/javatool/protobuf/domain/ProtobufModuleFactory.java b/src/main/java/tech/jhipster/lite/generator/server/javatool/protobuf/domain/ProtobufModuleFactory.java
index b96eced6c..d8052c1b2 100644
--- a/src/main/java/tech/jhipster/lite/generator/server/javatool/protobuf/domain/ProtobufModuleFactory.java
+++ b/src/main/java/tech/jhipster/lite/generator/server/javatool/protobuf/domain/ProtobufModuleFactory.java
@@ -99,9 +99,6 @@ public class ProtobufModuleFactory {
   public JHipsterModule buildProtobufBackwardsCompatibilityCheckModule(JHipsterModuleProperties properties) {
     //@formatter:off
     return moduleBuilder(properties)
-      .files()
-        .add(MAIN_SOURCE.append("proto.lock"), to("src/main/proto/proto.lock"))
-        .and()
       .mavenPlugins()
         .pluginManagement(protoBackwardsCompatibilityMavenPluginManagement())
         .plugin(protoBackwardsCompatibilityMavenPluginBuilder().build())
diff --git a/src/main/resources/generator/server/javatool/protobuf/main/proto.lock b/src/main/resources/generator/server/javatool/protobuf/main/proto.lock
deleted file mode 100644
index 9e26dfeeb..000000000
--- a/src/main/resources/generator/server/javatool/protobuf/main/proto.lock
+++ /dev/null
@@ -1,1 +0,0 @@
-{}
\ No newline at end of file


Test patch:
diff --git a/src/test/java/tech/jhipster/lite/generator/client/react/security/jwt/domain/ReactJwtModuleFactoryTest.java b/src/test/java/tech/jhipster/lite/generator/client/react/security/jwt/domain/ReactJwtModuleFactoryTest.java
index 561c7d0b0..b681acbb7 100644
--- a/src/test/java/tech/jhipster/lite/generator/client/react/security/jwt/domain/ReactJwtModuleFactoryTest.java
+++ b/src/test/java/tech/jhipster/lite/generator/client/react/security/jwt/domain/ReactJwtModuleFactoryTest.java
@@ -33,6 +33,17 @@ class ReactJwtModuleFactoryTest {
           justify-content:center;
           align-items: center;
         """
+      )
+      .and()
+      .hasFile("src/main/webapp/app/index.tsx")
+      .containing(
+        """
+          <React.StrictMode>
+            <NextUIProvider>
+              <App />
+            </NextUIProvider>
+          </React.StrictMode>,
+        """
       );
   }
 
diff --git a/src/test/java/tech/jhipster/lite/generator/server/javatool/protobuf/domain/ProtobufModuleFactoryTest.java b/src/test/java/tech/jhipster/lite/generator/server/javatool/protobuf/domain/ProtobufModuleFactoryTest.java
index a23ce8c2f..f2d13c707 100644
--- a/src/test/java/tech/jhipster/lite/generator/server/javatool/protobuf/domain/ProtobufModuleFactoryTest.java
+++ b/src/test/java/tech/jhipster/lite/generator/server/javatool/protobuf/domain/ProtobufModuleFactoryTest.java
@@ -174,10 +174,7 @@ class ProtobufModuleFactoryTest {
                   <artifactId>proto-backwards-compatibility</artifactId>
                 </plugin>
           """
-        )
-        .and()
-        .hasFile("src/main/proto/proto.lock")
-        .containing("{}");
+        );
     }
   }
 }