generate-ui-cli 2.1.7 → 2.3.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 +216 -27
- package/dist/commands/angular.js +535 -40
- package/dist/commands/generate.js +350 -20
- package/dist/commands/login.js +131 -42
- package/dist/commands/merge.js +201 -0
- package/dist/generate-ui/routes.gen.js +4 -0
- package/dist/generators/angular/feature.generator.js +3183 -583
- package/dist/generators/angular/menu.generator.js +165 -0
- package/dist/generators/angular/routes.generator.js +8 -3
- package/dist/generators/screen.generator.js +100 -5
- package/dist/generators/screen.merge.js +70 -15
- package/dist/index.js +88 -12
- package/dist/license/guard.js +2 -1
- package/dist/license/permissions.js +63 -9
- package/dist/license/token.js +38 -3
- package/dist/postinstall.js +47 -0
- package/dist/runtime/config.js +4 -0
- package/dist/runtime/logger.js +29 -0
- package/dist/runtime/project-config.js +64 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -4,6 +4,7 @@ Generate CRUD screens (List, Create/Edit, Delete), typed API services, and route
|
|
|
4
4
|
|
|
5
5
|
Goal: stop rewriting repetitive CRUD and start with a functional, scalable UI foundation.
|
|
6
6
|
|
|
7
|
+

|
|
7
8
|
## What GenerateUI Does
|
|
8
9
|
|
|
9
10
|
Given an `openapi.yaml` (or `.json`), GenerateUI can generate:
|
|
@@ -49,17 +50,67 @@ npx generate-ui --help
|
|
|
49
50
|
|
|
50
51
|
## Recommended Workflow
|
|
51
52
|
|
|
52
|
-
GenerateUI
|
|
53
|
+
GenerateUI default flow is a single command:
|
|
54
|
+
|
|
55
|
+
1. Read OpenAPI and generate schemas
|
|
56
|
+
2. Generate Angular code
|
|
57
|
+
|
|
58
|
+
All in:
|
|
59
|
+
- `generate-ui generate`
|
|
60
|
+
|
|
61
|
+
## Recommended Setup (No Paths in Commands)
|
|
62
|
+
|
|
63
|
+
Create `generateui-config.json` at the root of your Angular project:
|
|
64
|
+
|
|
65
|
+
```json
|
|
66
|
+
{
|
|
67
|
+
"openapi": "openapi.yaml",
|
|
68
|
+
"schemas": "src/generate-ui",
|
|
69
|
+
"features": "src/app/features",
|
|
70
|
+
"appTitle": "Store",
|
|
71
|
+
"defaultRoute": "",
|
|
72
|
+
"menu": {
|
|
73
|
+
"autoInject": true
|
|
74
|
+
},
|
|
75
|
+
"views": {
|
|
76
|
+
"ProductsAdmin": "cards",
|
|
77
|
+
"getProducts": "list",
|
|
78
|
+
"CharacterAdmin": "cards"
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Note: `list` is treated as table-style rendering.
|
|
84
|
+
|
|
85
|
+
## Complete Step-by-Step
|
|
86
|
+
|
|
87
|
+
1. Configure `generateui-config.json` at the project root.
|
|
88
|
+
Edit it before generation whenever you want to change `appTitle`, `defaultRoute`, `menu.autoInject`, or `views`.
|
|
89
|
+
2. Run full generation:
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
generate-ui generate
|
|
93
|
+
```
|
|
53
94
|
|
|
54
|
-
|
|
55
|
-
|
|
95
|
+
3. Review generated files in `src/generate-ui/overlays`.
|
|
96
|
+
4. If needed, review generated vs override changes:
|
|
56
97
|
|
|
57
|
-
|
|
98
|
+
```bash
|
|
99
|
+
generate-ui merge --feature ProductsAdmin
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Advanced commands:
|
|
103
|
+
- `generate-ui schema` -> generate schemas only
|
|
104
|
+
- `generate-ui angular` -> regenerate Angular from existing schemas (`--no-watch` to run once)
|
|
105
|
+
|
|
106
|
+
## 1) Default Full Generation
|
|
58
107
|
|
|
59
108
|
```bash
|
|
60
|
-
generate-ui generate
|
|
109
|
+
generate-ui generate
|
|
61
110
|
```
|
|
62
111
|
|
|
112
|
+
`generate-ui generate` reads paths from `generateui-config.json` when available.
|
|
113
|
+
|
|
63
114
|
What happens after this command:
|
|
64
115
|
|
|
65
116
|
- GenerateUI reads your OpenAPI and detects endpoints.
|
|
@@ -78,20 +129,51 @@ What you should review now:
|
|
|
78
129
|
|
|
79
130
|
Tip: this is the best moment to adjust naming and structure before generating code.
|
|
80
131
|
|
|
81
|
-
## 2)
|
|
132
|
+
## 2) Advanced Commands
|
|
82
133
|
|
|
83
134
|
```bash
|
|
135
|
+
generate-ui schema
|
|
84
136
|
generate-ui angular
|
|
85
137
|
```
|
|
86
138
|
|
|
87
|
-
What
|
|
139
|
+
What they do:
|
|
140
|
+
|
|
141
|
+
- `schema` generates or updates `generated/` and `overlays/` from OpenAPI.
|
|
142
|
+
- `angular` regenerates Angular output from existing overlays.
|
|
143
|
+
- `angular` keeps live sync while editing `*.screen.json` (use `--no-watch` to run once).
|
|
88
144
|
|
|
89
|
-
|
|
145
|
+
For each screen defined in overlays, Angular generation creates:
|
|
90
146
|
- a feature folder
|
|
91
147
|
- list and form components (create/edit)
|
|
92
148
|
- a typed API service
|
|
93
149
|
- DTO/types files
|
|
94
150
|
- route definitions
|
|
151
|
+
- `menu.json` and `menu.gen.ts` (if present in `generate-ui/`)
|
|
152
|
+
|
|
153
|
+
Generated/overrides folders:
|
|
154
|
+
|
|
155
|
+
- `features/generated/` → generated code (always overwritten)
|
|
156
|
+
- `features/overrides/` → your custom edits (never overwritten)
|
|
157
|
+
|
|
158
|
+
Routes prefer `overrides/` when a matching file exists.
|
|
159
|
+
|
|
160
|
+
Tip: when you regenerate and want to see what changed, compare files with:
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
diff -u features/generated/<Feature>/<Feature>.component.ts \
|
|
164
|
+
features/overrides/<Feature>/<Feature>.component.ts
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
Interactive merge (pick which changes to keep):
|
|
168
|
+
|
|
169
|
+
```bash
|
|
170
|
+
generate-ui merge --feature ProductsAdmin
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
Options:
|
|
174
|
+
|
|
175
|
+
- `--file component.ts|component.html|component.scss|all`
|
|
176
|
+
- `--tool code|meld|kdiff3|bc` (default: `code`)
|
|
95
177
|
|
|
96
178
|
What you should review now:
|
|
97
179
|
|
|
@@ -103,24 +185,93 @@ What you should review now:
|
|
|
103
185
|
Note:
|
|
104
186
|
If your project uses custom routing, standalone components, or advanced layouts, you may need to adjust how routes are plugged in.
|
|
105
187
|
|
|
106
|
-
Defaults:
|
|
107
|
-
- `--schemas` defaults to the last generated path (stored in `~/.generateui/config.json`), otherwise `./src/generate-ui` (or `./
|
|
108
|
-
- `--features` defaults to `./src/app/features`
|
|
188
|
+
Defaults (for advanced commands):
|
|
189
|
+
- `--schemas` defaults to the last generated path (stored in `~/.generateui/config.json`), otherwise `./src/generate-ui` (or `./generate-ui`)
|
|
190
|
+
- `--features` defaults to `./src/app/features`
|
|
191
|
+
- Generated files are placed under `features/generated/` and your manual edits go in `features/overrides/`
|
|
109
192
|
|
|
110
|
-
|
|
193
|
+
## Smart admin screens (Dev plan)
|
|
111
194
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
195
|
+
When you are logged in and Dev features are enabled, GenerateUI creates **one Admin screen per entity** when it finds a collection GET endpoint.
|
|
196
|
+
|
|
197
|
+
Example:
|
|
198
|
+
|
|
199
|
+
- `GET /products` → `ProductsAdmin`
|
|
200
|
+
- `GET /users` → `UsersAdmin`
|
|
201
|
+
|
|
202
|
+
If the API also includes:
|
|
203
|
+
|
|
204
|
+
- `GET /entity/{id}` → the Admin list links to a Detail screen
|
|
205
|
+
- `PUT/PATCH /entity/{id}` → the Admin list links to Edit
|
|
206
|
+
- `DELETE /entity/{id}` → Delete actions with confirmation modal
|
|
207
|
+
|
|
208
|
+
The Admin list is generated in addition to the basic screens (list, get by id, create, update, delete). It is never a replacement.
|
|
209
|
+
|
|
210
|
+
### generateui-config.json
|
|
211
|
+
|
|
212
|
+
GenerateUI creates a `generateui-config.json` at your project root on first `generate`. You can edit it to:
|
|
213
|
+
|
|
214
|
+
- inject a sidebar menu layout automatically (when `menu.autoInject` is not `false`)
|
|
215
|
+
- add a default redirect for `/` using `defaultRoute`
|
|
216
|
+
- show a custom app title in the menu (`appTitle`)
|
|
217
|
+
|
|
218
|
+
Example:
|
|
219
|
+
|
|
220
|
+
```json
|
|
221
|
+
{
|
|
222
|
+
"openapi": "openapi.yaml",
|
|
223
|
+
"schemas": "src/generate-ui",
|
|
224
|
+
"features": "src/app/features",
|
|
225
|
+
"appTitle": "Store",
|
|
226
|
+
"defaultRoute": "",
|
|
227
|
+
"menu": {
|
|
228
|
+
"autoInject": true
|
|
229
|
+
},
|
|
230
|
+
"views": {
|
|
231
|
+
"ProductsAdmin": "cards",
|
|
232
|
+
"getProducts": "list",
|
|
233
|
+
"CharacterAdmin": "cards"
|
|
234
|
+
}
|
|
235
|
+
}
|
|
116
236
|
```
|
|
117
237
|
|
|
118
|
-
|
|
238
|
+
Notes:
|
|
239
|
+
- If `menu.autoInject` is `false`, the menu layout is not injected.
|
|
240
|
+
- `defaultRoute` must match a path in `routes.gen.ts` (the same path used by the router).
|
|
241
|
+
- You can provide either the final route path or an `operationId`; the generator normalizes it to the correct path.
|
|
242
|
+
- You can override the menu by adding `menu.overrides.json` inside your `generate-ui/` folder (it replaces the generated menu entirely).
|
|
243
|
+
- You can choose a default list view per screen (table vs cards) by adding a `views` map:
|
|
244
|
+
|
|
245
|
+
```json
|
|
246
|
+
{
|
|
247
|
+
"views": {
|
|
248
|
+
"ProductsAdmin": "cards",
|
|
249
|
+
"GetProducts": "table"
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
```
|
|
119
253
|
|
|
120
|
-
|
|
121
|
-
|
|
254
|
+
Example `menu.overrides.json`:
|
|
255
|
+
|
|
256
|
+
```json
|
|
257
|
+
{
|
|
258
|
+
"groups": [
|
|
259
|
+
{
|
|
260
|
+
"id": "cadastros",
|
|
261
|
+
"label": "Cadastros",
|
|
262
|
+
"items": [
|
|
263
|
+
{ "id": "GetCharacter", "label": "Personagens", "route": "getCharacter" },
|
|
264
|
+
{ "id": "GetLocation", "label": "Localizações", "route": "getLocation" }
|
|
265
|
+
]
|
|
266
|
+
}
|
|
267
|
+
],
|
|
268
|
+
"ungrouped": [
|
|
269
|
+
{ "id": "GetEpisode", "label": "Episódios", "route": "getEpisode" }
|
|
270
|
+
]
|
|
271
|
+
}
|
|
122
272
|
```
|
|
123
273
|
|
|
274
|
+
|
|
124
275
|
## Login (Dev plan)
|
|
125
276
|
|
|
126
277
|
```bash
|
|
@@ -142,7 +293,7 @@ Telemetry can be disabled by setting `telemetry=false` in `~/.generateui/config.
|
|
|
142
293
|
|
|
143
294
|
GenerateUI usually creates route files such as:
|
|
144
295
|
|
|
145
|
-
- `src/generate-ui/routes.gen.ts` or `
|
|
296
|
+
- `src/generate-ui/routes.gen.ts` or `generate-ui/routes.gen.ts`
|
|
146
297
|
|
|
147
298
|
Example (Angular Router):
|
|
148
299
|
|
|
@@ -168,7 +319,7 @@ Step-by-step:
|
|
|
168
319
|
1) Generate files:
|
|
169
320
|
|
|
170
321
|
```bash
|
|
171
|
-
generate-ui generate
|
|
322
|
+
generate-ui generate
|
|
172
323
|
generate-ui angular
|
|
173
324
|
```
|
|
174
325
|
|
|
@@ -203,13 +354,13 @@ npm ls @angular/router
|
|
|
203
354
|
## Example Generated Structure
|
|
204
355
|
|
|
205
356
|
```txt
|
|
206
|
-
src/generate-ui/ or
|
|
357
|
+
src/generate-ui/ or generate-ui/
|
|
207
358
|
generated/
|
|
208
359
|
overlays/
|
|
209
360
|
routes.json
|
|
210
361
|
routes.gen.ts
|
|
211
362
|
screens.json
|
|
212
|
-
|
|
363
|
+
src/app/features/
|
|
213
364
|
users/
|
|
214
365
|
users.component.ts
|
|
215
366
|
users.service.gen.ts
|
|
@@ -236,15 +387,54 @@ You can edit files inside `overlays/` to customize labels, placeholders, hints,
|
|
|
236
387
|
|
|
237
388
|
Even after the Angular TypeScript files are generated, changes you make in `overlays/` will be mirrored the next time you regenerate.
|
|
238
389
|
|
|
390
|
+
|
|
391
|
+
### Theme / colors / fonts (quick change)
|
|
392
|
+
|
|
393
|
+
The generated UI uses CSS variables. To update the entire app theme at once, edit your app's root `styles.css`:
|
|
394
|
+
|
|
395
|
+
```css
|
|
396
|
+
:root {
|
|
397
|
+
--bg-page: #f7f3ef;
|
|
398
|
+
--bg-surface: #ffffff;
|
|
399
|
+
--bg-ink: #0f172a;
|
|
400
|
+
--color-text: #111827;
|
|
401
|
+
--color-muted: #6b7280;
|
|
402
|
+
--color-primary: #0f766e;
|
|
403
|
+
--color-primary-strong: #0891b2;
|
|
404
|
+
--color-accent: #f97316;
|
|
405
|
+
--shadow-card: 0 24px 60px rgba(15, 23, 42, 0.12);
|
|
406
|
+
}
|
|
407
|
+
```
|
|
408
|
+
|
|
409
|
+
Changing these variables updates buttons, cards, menu, inputs, and backgrounds across the app.
|
|
410
|
+
|
|
411
|
+
#### Fonts
|
|
412
|
+
|
|
413
|
+
Fonts are defined in `styles.css` as well. You can:
|
|
414
|
+
|
|
415
|
+
- swap the Google Fonts import at the top, and
|
|
416
|
+
- update the `font-family` on `body`.
|
|
417
|
+
|
|
418
|
+
Example:
|
|
419
|
+
|
|
420
|
+
```css
|
|
421
|
+
@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700&display=swap");
|
|
422
|
+
|
|
423
|
+
body {
|
|
424
|
+
font-family: "Manrope", "Helvetica Neue", Arial, sans-serif;
|
|
425
|
+
}
|
|
426
|
+
```
|
|
427
|
+
|
|
239
428
|
## Common Issues and Fixes
|
|
240
429
|
|
|
241
|
-
### "
|
|
430
|
+
### "Missing OpenAPI file"
|
|
242
431
|
|
|
243
|
-
|
|
432
|
+
`generate-ui generate` did not find `openapi` in `generateui-config.json`.
|
|
244
433
|
|
|
245
434
|
Fix:
|
|
246
435
|
```bash
|
|
247
|
-
|
|
436
|
+
# set "openapi" in generateui-config.json and run:
|
|
437
|
+
generate-ui generate
|
|
248
438
|
```
|
|
249
439
|
|
|
250
440
|
### "An endpoint exists but no screen was generated"
|
|
@@ -292,7 +482,6 @@ Check:
|
|
|
292
482
|
- [ ] Layout presets (minimal / enterprise / dashboard)
|
|
293
483
|
- [ ] Design system adapters (Material / PrimeNG / custom)
|
|
294
484
|
- [ ] Filters and real pagination
|
|
295
|
-
- [ ] UI schema overrides (visual control without touching OpenAPI)
|
|
296
485
|
- [ ] React support
|
|
297
486
|
|
|
298
487
|
## Contributing
|