Repository: jhipster/jhipster-lite
Pull request #10668 (2024-08-25 12:27:06)

React resources reorg
Reorg of the resources of the different react modules, see https://github.com/jhipster/jhipster-lite/pull/10639#discussion_r1729515184


Patch:
diff --git a/src/main/java/tech/jhipster/lite/generator/client/react/core/domain/ReactCoreModulesFactory.java b/src/main/java/tech/jhipster/lite/generator/client/react/core/domain/ReactCoreModulesFactory.java
index 7d1acad06..1ea8a003e 100644
--- a/src/main/java/tech/jhipster/lite/generator/client/react/core/domain/ReactCoreModulesFactory.java
+++ b/src/main/java/tech/jhipster/lite/generator/client/react/core/domain/ReactCoreModulesFactory.java
@@ -11,7 +11,7 @@ import tech.jhipster.lite.module.domain.properties.JHipsterModuleProperties;
 
 public class ReactCoreModulesFactory {
 
-  private static final JHipsterSource SOURCE = from("client/react");
+  private static final JHipsterSource SOURCE = from("client/react/core");
   private static final JHipsterSource SOURCE_COMMON = from("client/common");
 
   private static final JHipsterSource WEBAPP_SOURCE = SOURCE.append("src/main/webapp");
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 62cf2bfcf..2215293a7 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
@@ -16,9 +16,9 @@ public class ReactJwtModuleFactory {
 
   private static final String APP = "<App />";
 
-  private static final JHipsterSource ROOT = from("client/react");
+  private static final JHipsterSource ROOT = from("client/react/security/jwt");
 
-  private static final JHipsterSource SOURCE = from("client/react/src");
+  private static final JHipsterSource SOURCE = ROOT.append("src");
 
   private static final JHipsterSource APP_SOURCE = SOURCE.append("main/webapp/app");
   private static final JHipsterSource TEST_JAVASCRIPT_SOURCE = SOURCE.append("test/webapp/unit");
diff --git a/src/main/resources/generator/client/common/reacti18n/src/main/webapp/app/i18n.ts.mustache b/src/main/resources/generator/client/common/reacti18n/src/main/webapp/app/i18n.ts.mustache
deleted file mode 100644
index 738c25d73..000000000
--- a/src/main/resources/generator/client/common/reacti18n/src/main/webapp/app/i18n.ts.mustache
+++ /dev/null
@@ -1,24 +0,0 @@
-import i18n from 'i18next';
-import { initReactI18next } from 'react-i18next';
-
-import Backend from 'i18next-http-backend';
-import LanguageDetector from 'i18next-browser-languagedetector';
-
-i18n
-  .use(Backend)
-  .use(LanguageDetector)
-  .use(initReactI18next)
-
-  .init({
-    fallbackLng: 'en',
-    debug: false,
-
-    interpolation: {
-      escapeValue: false,
-    },
-    backend: {
-      loadPath: '../assets/locales/{{ lng }}/{{ ns }}.json',
-    },
-  });
-
-export default i18n;
diff --git a/src/main/resources/generator/client/common/reacti18n/src/main/webapp/assets/english.json.mustache b/src/main/resources/generator/client/common/reacti18n/src/main/webapp/assets/english.json.mustache
deleted file mode 100644
index 1d2914710..000000000
--- a/src/main/resources/generator/client/common/reacti18n/src/main/webapp/assets/english.json.mustache
+++ /dev/null
@@ -1,3 +0,0 @@
-{
-  "translationEnabled": "Internationalization enabled"
-}
diff --git a/src/main/resources/generator/client/common/reacti18n/src/main/webapp/assets/french.json.mustache b/src/main/resources/generator/client/common/reacti18n/src/main/webapp/assets/french.json.mustache
deleted file mode 100644
index f4c3ffcea..000000000
--- a/src/main/resources/generator/client/common/reacti18n/src/main/webapp/assets/french.json.mustache
+++ /dev/null
@@ -1,3 +0,0 @@
-{
-  "translationEnabled": "Internationalisation activée"
-}


Test patch:
diff --git a/src/main/resources/generator/client/react/.eslintrc.cjs b/src/main/resources/generator/client/react/core/.eslintrc.cjs
similarity index 100%
rename from src/main/resources/generator/client/react/.eslintrc.cjs
rename to src/main/resources/generator/client/react/core/.eslintrc.cjs
diff --git a/src/main/resources/generator/client/react/src/main/webapp/app/common/primary/app/App.css.mustache b/src/main/resources/generator/client/react/core/src/main/webapp/app/common/primary/app/App.css.mustache
similarity index 100%
rename from src/main/resources/generator/client/react/src/main/webapp/app/common/primary/app/App.css.mustache
rename to src/main/resources/generator/client/react/core/src/main/webapp/app/common/primary/app/App.css.mustache
diff --git a/src/main/resources/generator/client/react/src/main/webapp/app/common/primary/app/App.tsx.mustache b/src/main/resources/generator/client/react/core/src/main/webapp/app/common/primary/app/App.tsx.mustache
similarity index 100%
rename from src/main/resources/generator/client/react/src/main/webapp/app/common/primary/app/App.tsx.mustache
rename to src/main/resources/generator/client/react/core/src/main/webapp/app/common/primary/app/App.tsx.mustache
diff --git a/src/main/resources/generator/client/react/src/main/webapp/app/index.css.mustache b/src/main/resources/generator/client/react/core/src/main/webapp/app/index.css.mustache
similarity index 100%
rename from src/main/resources/generator/client/react/src/main/webapp/app/index.css.mustache
rename to src/main/resources/generator/client/react/core/src/main/webapp/app/index.css.mustache
diff --git a/src/main/resources/generator/client/react/src/main/webapp/app/index.tsx.mustache b/src/main/resources/generator/client/react/core/src/main/webapp/app/index.tsx.mustache
similarity index 100%
rename from src/main/resources/generator/client/react/src/main/webapp/app/index.tsx.mustache
rename to src/main/resources/generator/client/react/core/src/main/webapp/app/index.tsx.mustache
diff --git a/src/main/resources/generator/client/react/src/main/webapp/app/vite-env.d.ts.mustache b/src/main/resources/generator/client/react/core/src/main/webapp/app/vite-env.d.ts.mustache
similarity index 100%
rename from src/main/resources/generator/client/react/src/main/webapp/app/vite-env.d.ts.mustache
rename to src/main/resources/generator/client/react/core/src/main/webapp/app/vite-env.d.ts.mustache
diff --git a/src/main/resources/generator/client/react/src/main/webapp/assets/JHipster-Lite-neon-blue.png b/src/main/resources/generator/client/react/core/src/main/webapp/assets/JHipster-Lite-neon-blue.png
similarity index 100%
rename from src/main/resources/generator/client/react/src/main/webapp/assets/JHipster-Lite-neon-blue.png
rename to src/main/resources/generator/client/react/core/src/main/webapp/assets/JHipster-Lite-neon-blue.png
diff --git a/src/main/resources/generator/client/react/src/main/webapp/assets/ReactLogo.png b/src/main/resources/generator/client/react/core/src/main/webapp/assets/ReactLogo.png
similarity index 100%
rename from src/main/resources/generator/client/react/src/main/webapp/assets/ReactLogo.png
rename to src/main/resources/generator/client/react/core/src/main/webapp/assets/ReactLogo.png
diff --git a/src/main/resources/generator/client/react/src/main/webapp/index.html.mustache b/src/main/resources/generator/client/react/core/src/main/webapp/index.html.mustache
similarity index 100%
rename from src/main/resources/generator/client/react/src/main/webapp/index.html.mustache
rename to src/main/resources/generator/client/react/core/src/main/webapp/index.html.mustache
diff --git a/src/main/resources/generator/client/react/src/test/webapp/unit/common/primary/app/App.spec.tsx.mustache b/src/main/resources/generator/client/react/core/src/test/webapp/unit/common/primary/app/App.spec.tsx.mustache
similarity index 100%
rename from src/main/resources/generator/client/react/src/test/webapp/unit/common/primary/app/App.spec.tsx.mustache
rename to src/main/resources/generator/client/react/core/src/test/webapp/unit/common/primary/app/App.spec.tsx.mustache
diff --git a/src/main/resources/generator/client/react/src/test/webapp/unit/common/primary/app/App.test.tsx.mustache b/src/main/resources/generator/client/react/core/src/test/webapp/unit/common/primary/app/App.test.tsx.mustache
similarity index 100%
rename from src/main/resources/generator/client/react/src/test/webapp/unit/common/primary/app/App.test.tsx.mustache
rename to src/main/resources/generator/client/react/core/src/test/webapp/unit/common/primary/app/App.test.tsx.mustache
diff --git a/src/main/resources/generator/client/react/tsconfig.json b/src/main/resources/generator/client/react/core/tsconfig.json
similarity index 100%
rename from src/main/resources/generator/client/react/tsconfig.json
rename to src/main/resources/generator/client/react/core/tsconfig.json
diff --git a/src/main/resources/generator/client/react/vite.config.ts.mustache b/src/main/resources/generator/client/react/core/vite.config.ts.mustache
similarity index 100%
rename from src/main/resources/generator/client/react/vite.config.ts.mustache
rename to src/main/resources/generator/client/react/core/vite.config.ts.mustache
diff --git a/src/main/resources/generator/client/react/vitest.config.ts.mustache b/src/main/resources/generator/client/react/core/vitest.config.ts.mustache
similarity index 100%
rename from src/main/resources/generator/client/react/vitest.config.ts.mustache
rename to src/main/resources/generator/client/react/core/vitest.config.ts.mustache
diff --git a/src/main/resources/generator/client/react/postcss.config.js b/src/main/resources/generator/client/react/security/jwt/postcss.config.js
similarity index 100%
rename from src/main/resources/generator/client/react/postcss.config.js
rename to src/main/resources/generator/client/react/security/jwt/postcss.config.js
diff --git a/src/main/resources/generator/client/react/src/main/webapp/app/common/primary/app/LoginApp.tsx.mustache b/src/main/resources/generator/client/react/security/jwt/src/main/webapp/app/common/primary/app/LoginApp.tsx.mustache
similarity index 100%
rename from src/main/resources/generator/client/react/src/main/webapp/app/common/primary/app/LoginApp.tsx.mustache
rename to src/main/resources/generator/client/react/security/jwt/src/main/webapp/app/common/primary/app/LoginApp.tsx.mustache
diff --git a/src/main/resources/generator/client/react/src/main/webapp/app/common/services/storage.ts.mustache b/src/main/resources/generator/client/react/security/jwt/src/main/webapp/app/common/services/storage.ts.mustache
similarity index 100%
rename from src/main/resources/generator/client/react/src/main/webapp/app/common/services/storage.ts.mustache
rename to src/main/resources/generator/client/react/security/jwt/src/main/webapp/app/common/services/storage.ts.mustache
diff --git a/src/main/resources/generator/client/react/src/main/webapp/app/login/primary/loginForm/index.tsx.mustache b/src/main/resources/generator/client/react/security/jwt/src/main/webapp/app/login/primary/loginForm/index.tsx.mustache
similarity index 100%
rename from src/main/resources/generator/client/react/src/main/webapp/app/login/primary/loginForm/index.tsx.mustache
rename to src/main/resources/generator/client/react/security/jwt/src/main/webapp/app/login/primary/loginForm/index.tsx.mustache
diff --git a/src/main/resources/generator/client/react/src/main/webapp/app/login/primary/loginModal/EyeFilledIcon.tsx.mustache b/src/main/resources/generator/client/react/security/jwt/src/main/webapp/app/login/primary/loginModal/EyeFilledIcon.tsx.mustache
similarity index 100%
rename from src/main/resources/generator/client/react/src/main/webapp/app/login/primary/loginModal/EyeFilledIcon.tsx.mustache
rename to src/main/resources/generator/client/react/security/jwt/src/main/webapp/app/login/primary/loginModal/EyeFilledIcon.tsx.mustache
diff --git a/src/main/resources/generator/client/react/src/main/webapp/app/login/primary/loginModal/EyeSlashFilledIcon.tsx.mustache b/src/main/resources/generator/client/react/security/jwt/src/main/webapp/app/login/primary/loginModal/EyeSlashFilledIcon.tsx.mustache
similarity index 100%
rename from src/main/resources/generator/client/react/src/main/webapp/app/login/primary/loginModal/EyeSlashFilledIcon.tsx.mustache
rename to src/main/resources/generator/client/react/security/jwt/src/main/webapp/app/login/primary/loginModal/EyeSlashFilledIcon.tsx.mustache
diff --git a/src/main/resources/generator/client/react/src/main/webapp/app/login/primary/loginModal/LoginModal.scss.mustache b/src/main/resources/generator/client/react/security/jwt/src/main/webapp/app/login/primary/loginModal/LoginModal.scss.mustache
similarity index 100%
rename from src/main/resources/generator/client/react/src/main/webapp/app/login/primary/loginModal/LoginModal.scss.mustache
rename to src/main/resources/generator/client/react/security/jwt/src/main/webapp/app/login/primary/loginModal/LoginModal.scss.mustache
diff --git a/src/main/resources/generator/client/react/src/main/webapp/app/login/primary/loginModal/index.tsx.mustache b/src/main/resources/generator/client/react/security/jwt/src/main/webapp/app/login/primary/loginModal/index.tsx.mustache
similarity index 100%
rename from src/main/resources/generator/client/react/src/main/webapp/app/login/primary/loginModal/index.tsx.mustache
rename to src/main/resources/generator/client/react/security/jwt/src/main/webapp/app/login/primary/loginModal/index.tsx.mustache
diff --git a/src/main/resources/generator/client/react/src/main/webapp/app/login/primary/loginModal/interface.d.ts.mustache b/src/main/resources/generator/client/react/security/jwt/src/main/webapp/app/login/primary/loginModal/interface.d.ts.mustache
similarity index 100%
rename from src/main/resources/generator/client/react/src/main/webapp/app/login/primary/loginModal/interface.d.ts.mustache
rename to src/main/resources/generator/client/react/security/jwt/src/main/webapp/app/login/primary/loginModal/interface.d.ts.mustache
diff --git a/src/main/resources/generator/client/react/src/main/webapp/app/login/services/login.ts.mustache b/src/main/resources/generator/client/react/security/jwt/src/main/webapp/app/login/services/login.ts.mustache
similarity index 100%
rename from src/main/resources/generator/client/react/src/main/webapp/app/login/services/login.ts.mustache
rename to src/main/resources/generator/client/react/security/jwt/src/main/webapp/app/login/services/login.ts.mustache
diff --git a/src/main/resources/generator/client/react/src/test/webapp/unit/common/services/storage.test.ts.mustache b/src/main/resources/generator/client/react/security/jwt/src/test/webapp/unit/common/services/storage.test.ts.mustache
similarity index 100%
rename from src/main/resources/generator/client/react/src/test/webapp/unit/common/services/storage.test.ts.mustache
rename to src/main/resources/generator/client/react/security/jwt/src/test/webapp/unit/common/services/storage.test.ts.mustache
diff --git a/src/main/resources/generator/client/react/src/test/webapp/unit/login/primary/loginForm/index.test.tsx.mustache b/src/main/resources/generator/client/react/security/jwt/src/test/webapp/unit/login/primary/loginForm/index.test.tsx.mustache
similarity index 100%
rename from src/main/resources/generator/client/react/src/test/webapp/unit/login/primary/loginForm/index.test.tsx.mustache
rename to src/main/resources/generator/client/react/security/jwt/src/test/webapp/unit/login/primary/loginForm/index.test.tsx.mustache
diff --git a/src/main/resources/generator/client/react/src/test/webapp/unit/login/primary/loginModal/index.test.tsx.mustache b/src/main/resources/generator/client/react/security/jwt/src/test/webapp/unit/login/primary/loginModal/index.test.tsx.mustache
similarity index 100%
rename from src/main/resources/generator/client/react/src/test/webapp/unit/login/primary/loginModal/index.test.tsx.mustache
rename to src/main/resources/generator/client/react/security/jwt/src/test/webapp/unit/login/primary/loginModal/index.test.tsx.mustache
diff --git a/src/main/resources/generator/client/react/src/test/webapp/unit/login/services/login.test.ts.mustache b/src/main/resources/generator/client/react/security/jwt/src/test/webapp/unit/login/services/login.test.ts.mustache
similarity index 100%
rename from src/main/resources/generator/client/react/src/test/webapp/unit/login/services/login.test.ts.mustache
rename to src/main/resources/generator/client/react/security/jwt/src/test/webapp/unit/login/services/login.test.ts.mustache
diff --git a/src/main/resources/generator/client/react/tailwind.config.js b/src/main/resources/generator/client/react/security/jwt/tailwind.config.js
similarity index 100%
rename from src/main/resources/generator/client/react/tailwind.config.js
rename to src/main/resources/generator/client/react/security/jwt/tailwind.config.js
diff --git a/src/test/features/client/reacti18n.feature b/src/test/features/client/react-i18n.feature
similarity index 100%
rename from src/test/features/client/reacti18n.feature
rename to src/test/features/client/react-i18n.feature
diff --git a/src/test/java/tech/jhipster/lite/generator/client/react/i18n/domain/ReactI18nModuleFactoryTest.java b/src/test/java/tech/jhipster/lite/generator/client/react/i18n/domain/ReactI18nModuleFactoryTest.java
index 6ef3d8264..1eb0e216b 100644
--- a/src/test/java/tech/jhipster/lite/generator/client/react/i18n/domain/ReactI18nModuleFactoryTest.java
+++ b/src/test/java/tech/jhipster/lite/generator/client/react/i18n/domain/ReactI18nModuleFactoryTest.java
@@ -9,12 +9,12 @@ import tech.jhipster.lite.module.domain.JHipsterModule;
 import tech.jhipster.lite.module.domain.JHipsterModulesFixture;
 
 @UnitTest
-public class ReactI18nModuleFactoryTest {
-
-  public static final ReactI18nModuleFactory factory = new ReactI18nModuleFactory();
+class ReactI18nModuleFactoryTest {
 
   private static final String APP_TSX = "src/main/webapp/app/common/primary/app/App.tsx";
 
+  private final ReactI18nModuleFactory factory = new ReactI18nModuleFactory();
+
   @Test
   void shouldBuildI18nModule() {
     JHipsterModule module = factory.buildModule(