generator-jhipster-yellowbricks 1.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 +123 -0
- package/generators/app/command.js +11 -0
- package/generators/app/generator.js +56 -0
- package/generators/app/index.js +2 -0
- package/package.json +70 -0
package/README.md
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# generator-jhipster-yellowbricks
|
|
2
|
+
|
|
3
|
+
[](https://github.com/idNoRD/generator-jhipster-yellowbricks) Meta blueprint — a [JHipster](https://www.jhipster.tech/) blueprint that orchestrates all yellowbricks in a single `--blueprints` flag.
|
|
4
|
+
|
|
5
|
+
[![NPM version][npm-image]][npm-url]
|
|
6
|
+
[![Generator][github-generator-image]][github-generator-url]
|
|
7
|
+

|
|
8
|
+
|
|
9
|
+
## Concept
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
generator-jhipster-yellowbricks ← meta blueprint (aggregator + orchestrator)
|
|
13
|
+
├── generator-jhipster-yellowbricks-angular-contextpath
|
|
14
|
+
├── generator-jhipster-yellowbricks-spring-boot-contextpath
|
|
15
|
+
├── generator-jhipster-yellowbricks-client-contextpath
|
|
16
|
+
├── generator-jhipster-yellowbricks-angular-relativepathresource
|
|
17
|
+
└── generator-jhipster-yellowbricks-client-relativepathresource
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
### Rules
|
|
21
|
+
|
|
22
|
+
- Every yellowbrick is a standalone JHipster blueprint — usable without this meta package
|
|
23
|
+
- This meta package exists only to group and activate them
|
|
24
|
+
- Each brick has exactly one responsibility
|
|
25
|
+
|
|
26
|
+
## Available bricks
|
|
27
|
+
|
|
28
|
+
| Brick name | What it does |
|
|
29
|
+
| ------------------------------ | -------------------------------------------------------------- |
|
|
30
|
+
| `angular-contextpath` | Sets `baseHref` in `angular.json` |
|
|
31
|
+
| `spring-boot-contextpath` | Sets `context-path` in `application.yml` |
|
|
32
|
+
| `client-contextpath` | Sets `<base href>` in `index.html` and `swagger-ui/index.html` |
|
|
33
|
+
| `angular-relativepathresource` | Makes logo URL relative in `navbar.scss` |
|
|
34
|
+
| `client-relativepathresource` | Makes logo URL relative in `loading.css` |
|
|
35
|
+
|
|
36
|
+
## Prerequisites
|
|
37
|
+
|
|
38
|
+
- Node.js `^22.18.0 || >=24.11.0`
|
|
39
|
+
- JHipster 9
|
|
40
|
+
|
|
41
|
+
## Installation
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
npm install -g generator-jhipster-yellowbricks
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Usage
|
|
48
|
+
|
|
49
|
+
Create a `.yo-rc.json` in your project directory selecting which bricks to activate and configuring any that need it:
|
|
50
|
+
|
|
51
|
+
```json
|
|
52
|
+
{
|
|
53
|
+
"generator-jhipster-yellowbricks": {
|
|
54
|
+
"bricks": "angular-contextpath,spring-boot-contextpath,client-contextpath,angular-relativepathresource,client-relativepathresource"
|
|
55
|
+
},
|
|
56
|
+
"generator-jhipster-yellowbricks-angular-contextpath": {
|
|
57
|
+
"contextPath": "/jh/"
|
|
58
|
+
},
|
|
59
|
+
"generator-jhipster-yellowbricks-spring-boot-contextpath": {
|
|
60
|
+
"contextPath": "/jh/"
|
|
61
|
+
},
|
|
62
|
+
"generator-jhipster-yellowbricks-client-contextpath": {
|
|
63
|
+
"contextPath": "/jh/"
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
The `angular-relativepathresource` and `client-relativepathresource` bricks require no configuration.
|
|
69
|
+
|
|
70
|
+
Then run JHipster with this blueprint:
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
# Standard generator
|
|
74
|
+
jhipster --blueprints yellowbricks
|
|
75
|
+
|
|
76
|
+
# With JDL
|
|
77
|
+
jhipster import-jdl your-app.jdl --blueprints yellowbricks
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## How to create a new yellowbrick
|
|
81
|
+
|
|
82
|
+
All yellowbricks start from the `generator-jhipster-yellowbricks-` prefix followed by the generator name and a purpose suffix.
|
|
83
|
+
|
|
84
|
+
To find the generator name, search the JHipster source for the template file you want to modify: https://github.com/search?q=repo%3Ajhipster%2Fgenerator-jhipster&type=code
|
|
85
|
+
|
|
86
|
+
For example, `generators/angular/templates/angular.json.ejs` lives under `generators/angular` — so the generator name is `angular` and the brick would be `generator-jhipster-yellowbricks-angular-<purpose>`.
|
|
87
|
+
|
|
88
|
+
### Bricks that modify existing JHipster output
|
|
89
|
+
|
|
90
|
+
Override the specific sub-generator with `sbsBlueprint: true`:
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
mkdir generator-jhipster-yellowbricks-<generator>-<purpose>
|
|
94
|
+
cd generator-jhipster-yellowbricks-<generator>-<purpose>
|
|
95
|
+
jhipster generate-blueprint --sub-generators <generator> --all-priorities --defaults --skip-git
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Answer:
|
|
99
|
+
|
|
100
|
+
| Prompt | Answer |
|
|
101
|
+
| ---------------------------------------------------- | ------ |
|
|
102
|
+
| Is `<generator>` generator a side-by-side blueprint? | Y |
|
|
103
|
+
| Is `<generator>` generator a cli command? | N |
|
|
104
|
+
|
|
105
|
+
### Bricks that add new files
|
|
106
|
+
|
|
107
|
+
Override the `app` generator with `sbsBlueprint: true`:
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
jhipster generate-blueprint --sub-generators app --defaults --skip-git
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Answer:
|
|
114
|
+
|
|
115
|
+
| Prompt | Answer |
|
|
116
|
+
| ------------------------------------------ | ------ |
|
|
117
|
+
| Is app generator a side-by-side blueprint? | Y |
|
|
118
|
+
| Is app generator a cli command? | N |
|
|
119
|
+
|
|
120
|
+
[npm-image]: https://img.shields.io/npm/v/generator-jhipster-yellowbricks.svg
|
|
121
|
+
[npm-url]: https://npmjs.org/package/generator-jhipster-yellowbricks
|
|
122
|
+
[github-generator-image]: https://github.com/idNoRD/generator-jhipster-yellowbricks/actions/workflows/generator.yml/badge.svg
|
|
123
|
+
[github-generator-url]: https://github.com/idNoRD/generator-jhipster-yellowbricks/actions/workflows/generator.yml
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { asCommand } from 'generator-jhipster';
|
|
2
|
+
|
|
3
|
+
export default asCommand({
|
|
4
|
+
configs: {
|
|
5
|
+
bricks: {
|
|
6
|
+
description: 'Comma-separated list of bricks to activate (e.g. angular-contextpath,spring-boot-contextpath)',
|
|
7
|
+
cli: { type: String },
|
|
8
|
+
scope: 'blueprint',
|
|
9
|
+
},
|
|
10
|
+
},
|
|
11
|
+
});
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';
|
|
2
|
+
|
|
3
|
+
import BaseApplicationGenerator from 'generator-jhipster/generators/base-application';
|
|
4
|
+
|
|
5
|
+
const require = createRequire(import.meta.url);
|
|
6
|
+
|
|
7
|
+
const BRICK_MAP = {
|
|
8
|
+
'angular-contextpath': {
|
|
9
|
+
pkg: 'generator-jhipster-yellowbricks-angular-contextpath',
|
|
10
|
+
gen: 'angular',
|
|
11
|
+
},
|
|
12
|
+
'spring-boot-contextpath': {
|
|
13
|
+
pkg: 'generator-jhipster-yellowbricks-spring-boot-contextpath',
|
|
14
|
+
gen: 'spring-boot',
|
|
15
|
+
},
|
|
16
|
+
'client-contextpath': {
|
|
17
|
+
pkg: 'generator-jhipster-yellowbricks-client-contextpath',
|
|
18
|
+
gen: 'client',
|
|
19
|
+
},
|
|
20
|
+
'angular-relativepathresource': {
|
|
21
|
+
pkg: 'generator-jhipster-yellowbricks-angular-relativepathresource',
|
|
22
|
+
gen: 'angular',
|
|
23
|
+
},
|
|
24
|
+
'client-relativepathresource': {
|
|
25
|
+
pkg: 'generator-jhipster-yellowbricks-client-relativepathresource',
|
|
26
|
+
gen: 'client',
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export default class extends BaseApplicationGenerator {
|
|
31
|
+
constructor(args, opts, features) {
|
|
32
|
+
super(args, opts, { ...features, sbsBlueprint: true });
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
get [BaseApplicationGenerator.COMPOSING]() {
|
|
36
|
+
return this.asComposingTaskGroup({
|
|
37
|
+
async composeBricks() {
|
|
38
|
+
const requested = (this.blueprintConfig.bricks ?? '')
|
|
39
|
+
.split(',')
|
|
40
|
+
.map(b => b.trim())
|
|
41
|
+
.filter(Boolean);
|
|
42
|
+
|
|
43
|
+
for (const brickName of requested) {
|
|
44
|
+
const brick = BRICK_MAP[brickName];
|
|
45
|
+
if (!brick) {
|
|
46
|
+
this.log.warn(`[yellowbricks] unknown brick "${brickName}"`);
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
const resolved = require.resolve(`${brick.pkg}/generators/${brick.gen}`);
|
|
50
|
+
await this.composeWith(resolved);
|
|
51
|
+
this.log.info(`[yellowbricks] activated brick: ${brickName}`);
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "generator-jhipster-yellowbricks",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Yellowbricks meta blueprint — orchestrates all yellowbricks in a single JHipster blueprint",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"yeoman-generator",
|
|
7
|
+
"jhipster-blueprint",
|
|
8
|
+
"jhipster-9",
|
|
9
|
+
"generator-jhipster-yellowbricks"
|
|
10
|
+
],
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "git+https://github.com/idNoRD/generator-jhipster-yellowbricks.git"
|
|
14
|
+
},
|
|
15
|
+
"license": "MIT",
|
|
16
|
+
"author": "idNoRD",
|
|
17
|
+
"type": "module",
|
|
18
|
+
"files": [
|
|
19
|
+
"generators",
|
|
20
|
+
"!**/__*",
|
|
21
|
+
"!**/*.snap",
|
|
22
|
+
"!**/*.spec.?(c|m)js"
|
|
23
|
+
],
|
|
24
|
+
"scripts": {
|
|
25
|
+
"lint": "eslint .",
|
|
26
|
+
"lint-fix": "npm run lint -- --fix",
|
|
27
|
+
"prepare": "husky",
|
|
28
|
+
"prettier-check": "prettier --check \"{,**/}*.{md,json,yml,html,cjs,mjs,js,cts,mts,ts,tsx,css,scss,vue,java}\"",
|
|
29
|
+
"prettier-format": "prettier --write \"{,**/}*.{md,json,yml,html,cjs,mjs,js,cts,mts,ts,tsx,css,scss,vue,java}\"",
|
|
30
|
+
"pretest": "npm run prettier-check && npm run lint",
|
|
31
|
+
"test": "vitest run",
|
|
32
|
+
"update-snapshot": "vitest run --update",
|
|
33
|
+
"vitest": "vitest"
|
|
34
|
+
},
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"generator-jhipster-yellowbricks-angular-contextpath": "^1.0.0",
|
|
37
|
+
"generator-jhipster-yellowbricks-angular-relativepathresource": "^1.0.0",
|
|
38
|
+
"generator-jhipster-yellowbricks-client-contextpath": "^1.0.0",
|
|
39
|
+
"generator-jhipster-yellowbricks-client-relativepathresource": "^1.0.0",
|
|
40
|
+
"generator-jhipster-yellowbricks-spring-boot-contextpath": "^1.0.0"
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"@semantic-release/commit-analyzer": "^13.0.1",
|
|
44
|
+
"@semantic-release/exec": "^7.1.0",
|
|
45
|
+
"@semantic-release/git": "^10.0.1",
|
|
46
|
+
"@semantic-release/github": "^12.0.6",
|
|
47
|
+
"@semantic-release/npm": "^13.1.4",
|
|
48
|
+
"@semantic-release/release-notes-generator": "^14.1.0",
|
|
49
|
+
"eslint": "9.39.2",
|
|
50
|
+
"eslint-config-prettier": "10.1.8",
|
|
51
|
+
"eslint-plugin-prettier": "5.5.5",
|
|
52
|
+
"generator-jhipster": "9.0.0-beta.3",
|
|
53
|
+
"globals": "17.3.0",
|
|
54
|
+
"husky": "9.1.7",
|
|
55
|
+
"jiti": "2.6.1",
|
|
56
|
+
"lint-staged": "16.2.7",
|
|
57
|
+
"prettier": "3.8.1",
|
|
58
|
+
"prettier-plugin-packagejson": "3.0.0",
|
|
59
|
+
"semantic-release": "^25.0.3",
|
|
60
|
+
"vitest": "4.0.18",
|
|
61
|
+
"yeoman-test": ">=10"
|
|
62
|
+
},
|
|
63
|
+
"peerDependencies": {
|
|
64
|
+
"generator-jhipster": ">=9.0.0"
|
|
65
|
+
},
|
|
66
|
+
"engines": {
|
|
67
|
+
"generator-jhipster": "9.0.0-beta.3",
|
|
68
|
+
"node": "^22.18.0 || >=24.11.0"
|
|
69
|
+
}
|
|
70
|
+
}
|