generator-jhipster-yellowbricks-angular-contextpath 1.1.3 → 1.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # generator-jhipster-yellowbricks-angular-contextpath
2
2
 
3
- One of [![Yellow Bricks Badge](https://img.shields.io/badge/YELLOWBRICKS--yellow?style=for-the-badge&labelColor=black)](https://github.com/idNoRD/generator-jhipster-yellowbricks) - a [JHipster](https://www.jhipster.tech/) blueprint that sets the Angular `baseHref` in `angular.json` to a configurable context path.
3
+ One of [![Yellow Bricks Badge](https://img.shields.io/badge/YELLOWBRICKS--yellow?style=for-the-badge&labelColor=black)](https://github.com/idNoRD/generator-jhipster-yellowbricks) - a [JHipster](https://www.jhipster.tech/) blueprint that sets the Angular `baseHref` in `angular.json` and prefixes the proxy routes in `proxy.config.mjs` to a configurable context path.
4
4
 
5
5
  [![NPM version][npm-image]][npm-url]
6
6
  [![Generator][github-generator-image]][github-generator-url]
@@ -9,7 +9,7 @@ One of [![Yellow Bricks Badge](https://img.shields.io/badge/YELLOWBRICKS--yellow
9
9
  ## JHipster source
10
10
 
11
11
  - Generator: [`generators/angular`](https://github.com/jhipster/generator-jhipster/tree/main/generators/angular)
12
- - Template: [`angular.json.ejs`](https://github.com/jhipster/generator-jhipster/blob/main/generators/angular/templates/angular.json.ejs)
12
+ - Templates: [`angular.json.ejs`](https://github.com/jhipster/generator-jhipster/blob/main/generators/angular/templates/angular.json.ejs), [`proxy.config.mjs.ejs`](https://github.com/jhipster/generator-jhipster/blob/main/generators/angular/templates/proxy.config.mjs.ejs)
13
13
 
14
14
  ## What it does
15
15
 
@@ -24,6 +24,13 @@ Patches `angular.json` during generation to insert `baseHref` as the first key i
24
24
  ...
25
25
  ```
26
26
 
27
+ Patches `proxy.config.mjs` to prefix the proxy route pattern with the context path so that dev-server requests are forwarded correctly:
28
+
29
+ ```diff
30
+ - '^/(api|management|v3/api-docs...)': {
31
+ + '^/jh/(api|management|v3/api-docs...)': {
32
+ ```
33
+
27
34
  The value is configurable — any context path can be used.
28
35
 
29
36
  ## Prerequisites
@@ -93,6 +93,25 @@ export default class extends BaseApplicationGenerator {
93
93
  return;
94
94
  }
95
95
 
96
+ this.editFile('proxy.config.mjs', { ignoreNonExisting: true }, content => {
97
+ const updatedPattern = `'^${contextPath}(`;
98
+
99
+ if (content.includes(updatedPattern)) {
100
+ return content;
101
+ }
102
+
103
+ const originalPattern = `'^/(`;
104
+ if (!content.includes(originalPattern)) {
105
+ this.log.warn(
106
+ `[yellowbricks-angular-contextpath] proxy.config.mjs: expected pattern ${originalPattern} not found — manual intervention needed`,
107
+ );
108
+ return content;
109
+ }
110
+
111
+ this.log.info(`[yellowbricks-angular-contextpath] proxy.config.mjs: proxy path prefix set to "${contextPath}"`);
112
+ return content.replace(originalPattern, updatedPattern);
113
+ });
114
+
96
115
  this.editFile('angular.json', { ignoreNonExisting: true }, content => {
97
116
  const json = JSON.parse(content);
98
117
  const projectName = Object.keys(json.projects ?? {})[0];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "generator-jhipster-yellowbricks-angular-contextpath",
3
- "version": "1.1.3",
3
+ "version": "1.1.4",
4
4
  "description": "JHipster blueprint to configure Angular application baseHref via a custom context path",
5
5
  "keywords": [
6
6
  "yeoman-generator",