Repository: jhipster/jhipster-lite (java)

Issue:
Add prettier plugin for pug in tikui module
Following https://github.com/jhipster/jhipster-lite/pull/10935 we should add prettier plugin (and configuration) for pug in tikui module

Pull request:
Add prettier pug plugin on Tikui
Closes #10942 

Patch:
diff --git a/src/main/java/tech/jhipster/lite/generator/client/tikui/domain/TikuiModuleFactory.java b/src/main/java/tech/jhipster/lite/generator/client/tikui/domain/TikuiModuleFactory.java
index ae4f3a72c..8b2b28004 100644
--- a/src/main/java/tech/jhipster/lite/generator/client/tikui/domain/TikuiModuleFactory.java
+++ b/src/main/java/tech/jhipster/lite/generator/client/tikui/domain/TikuiModuleFactory.java
@@ -33,6 +33,7 @@ public class TikuiModuleFactory {
     return moduleBuilder(properties)
       .packageJson()
         .addDependency(packageName("@tikui/core"), COMMON)
+        .addDevDependency(packageName("@prettier/plugin-pug"), COMMON)
         .addDevDependency(packageName("stylelint"), COMMON)
         .addDevDependency(packageName("stylelint-config-concentric-order"), COMMON)
         .addDevDependency(packageName("stylelint-config-standard-scss"), COMMON)
@@ -126,6 +127,9 @@ public class TikuiModuleFactory {
         .in(path("src/main/webapp/index.html"))
           .add(lineBeforeText("</head>"), tikuiLink(properties))
           .and()
+        .in(path(".prettierrc"))
+          .add(lineAfterText("plugins:"), pugPlugin(properties))
+          .and()
         .and()
       .gitIgnore()
         .pattern(".tikui-cache")
@@ -149,6 +153,10 @@ public class TikuiModuleFactory {
     return properties.indentation().times(2) + "<link rel=\"stylesheet\" href=\"/style/tikui.css\" />";
   }
 
+  private String pugPlugin(JHipsterModuleProperties properties) {
+    return properties.indentation().times(1) + "- '@prettier/plugin-pug'";
+  }
+
   private static String newProxyForStyle(JHipsterModuleProperties properties) {
     return new StringBuilder()
       .append(properties.indentation().times(2))
diff --git a/src/main/resources/generator/dependencies/common/package.json b/src/main/resources/generator/dependencies/common/package.json
index a2b495a10..815e9294f 100644
--- a/src/main/resources/generator/dependencies/common/package.json
+++ b/src/main/resources/generator/dependencies/common/package.json
@@ -13,6 +13,7 @@
   "devDependencies": {
     "@babel/cli": "7.25.6",
     "@playwright/test": "1.47.2",
+    "@prettier/plugin-pug": "3.1.0",
     "@prettier/plugin-xml": "3.4.1",
     "@tikui/core": "6.2.0",
     "@tsconfig/recommended": "1.0.7",


Test patch:
diff --git a/src/test/java/tech/jhipster/lite/generator/client/tikui/domain/TikuiModuleFactoryTest.java b/src/test/java/tech/jhipster/lite/generator/client/tikui/domain/TikuiModuleFactoryTest.java
index d143e1c16..4098c579e 100644
--- a/src/test/java/tech/jhipster/lite/generator/client/tikui/domain/TikuiModuleFactoryTest.java
+++ b/src/test/java/tech/jhipster/lite/generator/client/tikui/domain/TikuiModuleFactoryTest.java
@@ -15,6 +15,34 @@ class TikuiModuleFactoryTest {
 
   private static final TikuiModuleFactory factory = new TikuiModuleFactory();
 
+  @Nested
+  class PrettierTest {
+
+    @Test
+    void shouldBuildModuleWithPugFormat() {
+      JHipsterModuleProperties properties = propertiesBuilder(TestFileUtils.tmpDirForTest()).build();
+
+      JHipsterModule module = factory.buildModule(properties);
+
+      assertThatModuleWithFiles(module, packageJsonFile(), prettierConfigFile())
+        .hasFile("package.json")
+        .containing(nodeDependency("@prettier/plugin-pug"))
+        .and()
+        .hasFile(".prettierrc")
+        .containing(prettierConfig());
+    }
+
+    private static ModuleFile prettierConfigFile() {
+      return file("src/main/resources/generator/prettier/.prettierrc.mustache", ".prettierrc");
+    }
+
+    private static String prettierConfig() {
+      return """
+        - '@prettier/plugin-pug'
+      """;
+    }
+  }
+
   @Nested
   class VueTest {