Repository: jhipster/jhipster-lite (java)

Issue:
Angular: avoid appending the browser folder in the outputPath
When creating an Angular + Spring Boot application, the `browser` folder is being created inside the `outputPath` as described [here](https://github.com/angular/angular-cli/issues/26304). This causes an issue where the generated JAR file cannot access the frontend application because the frontend files are placed inside `classes/static/browser` instead of `classes/static`.

### Solution

To resolve this issue, update the `angular.json` file as follows:

**From:**

```json
"build": {
  "builder": "@angular-devkit/build-angular:application",
  "options": {
    "outputPath": "dist/project",
    "index": "src/main/webapp/index.html",
    "browser": "src/main/webapp/main.ts",
    "polyfills": ["zone.js"],
    "tsConfig": "tsconfig.app.json",
```

**To:**

```json
"build": {
  "builder": "@angular-devkit/build-angular:application",
  "options": {
    "outputPath": {
      "base": "build/classes/static",
      "browser": ""
    },
    "index": "src/main/webapp/index.html",
    "browser": "src/main/webapp/main.ts",
    "polyfills": ["zone.js"],
    "tsConfig": "tsconfig.app.json",
```

Additionally, remove the `--output-path` from the CLI command in `package.json` since it isn't supported yet as mentioned [here](https://github.com/angular/angular-cli/issues/26304#issuecomment-2050076174):

**From:**

```json
"build": "ng build --output-path=build/classes/static",
```

**To:**

```json
"build": "ng build",
```

This adjustment ensures that the frontend files are placed correctly inside `classes/static` for proper access by the Spring Boot application.

Pull request description:
avoid append browser folder at the outputPath directory
Fix #9830

Patch:
diff --git a/src/main/java/tech/jhipster/lite/generator/client/angular/core/domain/AngularModuleFactory.java b/src/main/java/tech/jhipster/lite/generator/client/angular/core/domain/AngularModuleFactory.java
index 31cc838c2..d46b3996c 100644
--- a/src/main/java/tech/jhipster/lite/generator/client/angular/core/domain/AngularModuleFactory.java
+++ b/src/main/java/tech/jhipster/lite/generator/client/angular/core/domain/AngularModuleFactory.java
@@ -63,7 +63,7 @@ public class AngularModuleFactory {
         .addDevDependency(packageName("typescript"), ANGULAR)
         .addScript(scriptKey("ng"), scriptCommand("ng"))
         .addScript(scriptKey("start"), scriptCommand("ng serve"))
-        .addScript(scriptKey("build"), scriptCommand("ng build --output-path={{projectBuildDirectory}}/classes/static"))
+        .addScript(scriptKey("build"), scriptCommand("ng build"))
         .addScript(scriptKey("watch"), scriptCommand("ng build --watch --configuration development"))
         .addScript(scriptKey("test"), scriptCommand("npm run test:watch"))
         .addScript(scriptKey("test:coverage"), scriptCommand("ng test --coverage"))
@@ -71,7 +71,7 @@ public class AngularModuleFactory {
         .addScript(scriptKey("lint"), scriptCommand("ng lint"))
         .and()
       .files()
-        .add(SOURCE.file("angular.json"), to("angular.json"))
+        .add(SOURCE.template("angular.json"), to("angular.json"))
         .add(SOURCE.file("tsconfig.json"), to("tsconfig.json"))
         .add(SOURCE.file("tsconfig.app.json"), to("tsconfig.app.json"))
         .add(SOURCE.file(".eslintrc.json"), to(".eslintrc.json"))
diff --git a/src/main/resources/generator/client/angular/core/angular.json b/src/main/resources/generator/client/angular/core/angular.json.mustache
similarity index 95%
rename from src/main/resources/generator/client/angular/core/angular.json
rename to src/main/resources/generator/client/angular/core/angular.json.mustache
index 73fbefdf9..e3253bb48 100644
--- a/src/main/resources/generator/client/angular/core/angular.json
+++ b/src/main/resources/generator/client/angular/core/angular.json.mustache
@@ -12,7 +12,10 @@
         "build": {
           "builder": "@angular-devkit/build-angular:application",
           "options": {
-            "outputPath": "dist/project",
+            "outputPath": {
+              "base": "{{projectBuildDirectory}}/classes/static",
+              "browser": ""
+            },
             "index": "src/main/webapp/index.html",
             "browser": "src/main/webapp/main.ts",
             "polyfills": ["zone.js"],


Test patch:
diff --git a/src/test/java/tech/jhipster/lite/generator/client/angular/core/domain/AngularModuleFactoryTest.java b/src/test/java/tech/jhipster/lite/generator/client/angular/core/domain/AngularModuleFactoryTest.java
index 03980ecef..341eacf6a 100644
--- a/src/test/java/tech/jhipster/lite/generator/client/angular/core/domain/AngularModuleFactoryTest.java
+++ b/src/test/java/tech/jhipster/lite/generator/client/angular/core/domain/AngularModuleFactoryTest.java
@@ -49,7 +49,7 @@ class AngularModuleFactoryTest {
       .containing(nodeScript("ng", "ng"))
       .containing(nodeScript("watch", "ng build --watch --configuration development"))
       .containing(nodeScript("start", "ng serve"))
-      .containing(nodeScript("build", "ng build --output-path=target/classes/static"))
+      .containing(nodeScript("build", "ng build"))
       .containing(nodeScript("test", "npm run test:watch"))
       .containing(nodeScript("test:watch", "ng test --watch"))
       .containing(nodeScript("test:coverage", "ng test --coverage"))