generator-jhipster-yellowbricks-angular-contextpath 1.1.3 → 2.0.0
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 +9 -2
- package/generators/angular/generator.js +19 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# generator-jhipster-yellowbricks-angular-contextpath
|
|
2
2
|
|
|
3
|
-
One of [](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 [](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 [
|
|
12
|
-
-
|
|
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": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "JHipster blueprint to configure Angular application baseHref via a custom context path",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"yeoman-generator",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"vitest": "vitest"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"generator-jhipster": "9.0.0
|
|
41
|
+
"generator-jhipster": "9.0.0"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@semantic-release/commit-analyzer": "^13.0.1",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"yeoman-test": ">=10"
|
|
63
63
|
},
|
|
64
64
|
"engines": {
|
|
65
|
-
"generator-jhipster": "9.0.0
|
|
65
|
+
"generator-jhipster": "9.0.0",
|
|
66
66
|
"node": "^22.18.0 || >=24.11.0"
|
|
67
67
|
}
|
|
68
68
|
}
|