generator-jhipster-yellowbricks-angular-contextpath 1.1.1 → 1.1.3
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 +13 -25
- package/generators/angular/generator.js +18 -8
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
# generator-jhipster-yellowbricks-angular-contextpath
|
|
2
2
|
|
|
3
|
-
|
|
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.
|
|
4
4
|
|
|
5
5
|
[![NPM version][npm-image]][npm-url]
|
|
6
6
|
[![Generator][github-generator-image]][github-generator-url]
|
|
7
7
|

|
|
8
8
|
|
|
9
|
+
## JHipster source
|
|
10
|
+
|
|
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)
|
|
13
|
+
|
|
9
14
|
## What it does
|
|
10
15
|
|
|
11
16
|
Patches `angular.json` during generation to insert `baseHref` as the first key in `build.options`:
|
|
@@ -34,18 +39,7 @@ npm install -g generator-jhipster-yellowbricks-angular-contextpath
|
|
|
34
39
|
|
|
35
40
|
## Usage
|
|
36
41
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
Run JHipster with this blueprint and pass your desired context path:
|
|
40
|
-
|
|
41
|
-
```bash
|
|
42
|
-
jhipster --blueprints yellowbricks-angular-contextpath \
|
|
43
|
-
--yellowbricks-angular-contextpath-config='{"contextPath":"/jh/"}'
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
### With `import-jdl`
|
|
47
|
-
|
|
48
|
-
`import-jdl` does not support blueprint-specific CLI options. Create a `.yo-rc.json` in your project directory first:
|
|
42
|
+
Create a `.yo-rc.json` in your project directory with the desired context path:
|
|
49
43
|
|
|
50
44
|
```json
|
|
51
45
|
{
|
|
@@ -55,22 +49,16 @@ jhipster --blueprints yellowbricks-angular-contextpath \
|
|
|
55
49
|
}
|
|
56
50
|
```
|
|
57
51
|
|
|
58
|
-
Then run:
|
|
59
|
-
|
|
60
|
-
```bash
|
|
61
|
-
jhipster import-jdl your-app.jdl --blueprints yellowbricks-angular-contextpath
|
|
62
|
-
```
|
|
63
|
-
|
|
64
52
|
Replace `/jh/` with your actual context path. The trailing slash is required.
|
|
65
53
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
To use the latest unreleased version directly from GitHub:
|
|
54
|
+
Then run JHipster with this blueprint:
|
|
69
55
|
|
|
70
56
|
```bash
|
|
71
|
-
|
|
72
|
-
jhipster --blueprints yellowbricks-angular-contextpath
|
|
73
|
-
|
|
57
|
+
# Standard generator
|
|
58
|
+
jhipster --blueprints yellowbricks-angular-contextpath
|
|
59
|
+
|
|
60
|
+
# With JDL
|
|
61
|
+
jhipster import-jdl your-app.jdl --blueprints yellowbricks-angular-contextpath
|
|
74
62
|
```
|
|
75
63
|
|
|
76
64
|
[npm-image]: https://img.shields.io/npm/v/generator-jhipster-yellowbricks-angular-contextpath.svg
|
|
@@ -88,7 +88,7 @@ export default class extends BaseApplicationGenerator {
|
|
|
88
88
|
const contextPath = this.blueprintConfig.contextPath;
|
|
89
89
|
if (!contextPath) {
|
|
90
90
|
this.log.warn(
|
|
91
|
-
'[
|
|
91
|
+
'[yellowbricks-angular-contextpath] contextPath not configured — add {"generator-jhipster-yellowbricks-angular-contextpath":{"contextPath":"/jh/"}} to .yo-rc.json',
|
|
92
92
|
);
|
|
93
93
|
return;
|
|
94
94
|
}
|
|
@@ -102,25 +102,33 @@ export default class extends BaseApplicationGenerator {
|
|
|
102
102
|
const expectedBuilder = '@angular-builders/custom-esbuild:application';
|
|
103
103
|
|
|
104
104
|
if (!build) {
|
|
105
|
-
this.log.warn(
|
|
105
|
+
this.log.warn(
|
|
106
|
+
'[yellowbricks-angular-contextpath] angular.json: architect.build section not found — manual intervention needed',
|
|
107
|
+
);
|
|
106
108
|
return content;
|
|
107
109
|
}
|
|
108
110
|
if (build.builder !== expectedBuilder) {
|
|
109
111
|
this.log.warn(
|
|
110
|
-
`[
|
|
112
|
+
`[yellowbricks-angular-contextpath] angular.json: expected builder "${expectedBuilder}" but found "${build.builder ?? 'undefined'}" — manual intervention needed`,
|
|
111
113
|
);
|
|
112
114
|
return content;
|
|
113
115
|
}
|
|
114
116
|
if (!build.options) {
|
|
115
|
-
this.log.warn(
|
|
117
|
+
this.log.warn(
|
|
118
|
+
'[yellowbricks-angular-contextpath] angular.json: architect.build.options not found — manual intervention needed',
|
|
119
|
+
);
|
|
116
120
|
return content;
|
|
117
121
|
}
|
|
118
122
|
if (!Array.isArray(build.options.plugins)) {
|
|
119
|
-
this.log.warn(
|
|
123
|
+
this.log.warn(
|
|
124
|
+
'[yellowbricks-angular-contextpath] angular.json: build.options.plugins array not found — manual intervention needed',
|
|
125
|
+
);
|
|
120
126
|
return content;
|
|
121
127
|
}
|
|
122
128
|
if (!build.options.outputPath) {
|
|
123
|
-
this.log.warn(
|
|
129
|
+
this.log.warn(
|
|
130
|
+
'[yellowbricks-angular-contextpath] angular.json: build.options.outputPath not found — manual intervention needed',
|
|
131
|
+
);
|
|
124
132
|
return content;
|
|
125
133
|
}
|
|
126
134
|
// --- end drift detection ---
|
|
@@ -132,9 +140,11 @@ export default class extends BaseApplicationGenerator {
|
|
|
132
140
|
build.options = { baseHref: contextPath, ...remainingOptions };
|
|
133
141
|
|
|
134
142
|
if (previousBaseHref && previousBaseHref !== contextPath) {
|
|
135
|
-
this.log.info(
|
|
143
|
+
this.log.info(
|
|
144
|
+
`[yellowbricks-angular-contextpath] angular.json: baseHref renamed from "${previousBaseHref}" to "${contextPath}"`,
|
|
145
|
+
);
|
|
136
146
|
} else {
|
|
137
|
-
this.log.info(`[
|
|
147
|
+
this.log.info(`[yellowbricks-angular-contextpath] angular.json: baseHref "${contextPath}" added successfully`);
|
|
138
148
|
}
|
|
139
149
|
|
|
140
150
|
return `${JSON.stringify(json, null, 2)}\n`;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "generator-jhipster-yellowbricks-angular-contextpath",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.3",
|
|
4
4
|
"description": "JHipster blueprint to configure Angular application baseHref via a custom context path",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"yeoman-generator",
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
},
|
|
15
15
|
"license": "MIT",
|
|
16
16
|
"author": "idNoRD",
|
|
17
|
+
"type": "module",
|
|
17
18
|
"bin": {
|
|
18
19
|
"jhipster-yellowbricks-angular-contextpath": "cli/cli.cjs"
|
|
19
20
|
},
|