generate-ui-cli 2.2.0 → 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 +177 -35
- package/dist/commands/angular.js +343 -57
- package/dist/commands/generate.js +242 -30
- package/dist/commands/login.js +87 -25
- package/dist/commands/merge.js +201 -0
- package/dist/generators/angular/feature.generator.js +2262 -637
- package/dist/generators/angular/menu.generator.js +1 -1
- 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 +69 -8
- package/dist/license/guard.js +2 -1
- package/dist/license/permissions.js +62 -8
- package/dist/license/token.js +19 -0
- package/dist/postinstall.js +42 -2
- package/dist/runtime/config.js +4 -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:
|
|
53
54
|
|
|
54
|
-
1. Read
|
|
55
|
-
2. Generate Angular code
|
|
55
|
+
1. Read OpenAPI and generate schemas
|
|
56
|
+
2. Generate Angular code
|
|
56
57
|
|
|
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
|
+
```
|
|
94
|
+
|
|
95
|
+
3. Review generated files in `src/generate-ui/overlays`.
|
|
96
|
+
4. If needed, review generated vs override changes:
|
|
97
|
+
|
|
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,15 +129,20 @@ 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:
|
|
88
140
|
|
|
89
|
-
-
|
|
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).
|
|
144
|
+
|
|
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
|
|
@@ -94,6 +150,31 @@ What happens after this command:
|
|
|
94
150
|
- route definitions
|
|
95
151
|
- `menu.json` and `menu.gen.ts` (if present in `generate-ui/`)
|
|
96
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`)
|
|
177
|
+
|
|
97
178
|
What you should review now:
|
|
98
179
|
|
|
99
180
|
- Are files generated in the correct location?
|
|
@@ -104,11 +185,29 @@ What you should review now:
|
|
|
104
185
|
Note:
|
|
105
186
|
If your project uses custom routing, standalone components, or advanced layouts, you may need to adjust how routes are plugged in.
|
|
106
187
|
|
|
107
|
-
Defaults:
|
|
108
|
-
- `--schemas` defaults to the last generated path (stored in `~/.generateui/config.json`), otherwise `./src/generate-ui` (or `./
|
|
109
|
-
- `--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/`
|
|
110
192
|
|
|
111
|
-
|
|
193
|
+
## Smart admin screens (Dev plan)
|
|
194
|
+
|
|
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
|
|
112
211
|
|
|
113
212
|
GenerateUI creates a `generateui-config.json` at your project root on first `generate`. You can edit it to:
|
|
114
213
|
|
|
@@ -120,10 +219,18 @@ Example:
|
|
|
120
219
|
|
|
121
220
|
```json
|
|
122
221
|
{
|
|
123
|
-
"
|
|
124
|
-
"
|
|
222
|
+
"openapi": "openapi.yaml",
|
|
223
|
+
"schemas": "src/generate-ui",
|
|
224
|
+
"features": "src/app/features",
|
|
225
|
+
"appTitle": "Store",
|
|
226
|
+
"defaultRoute": "",
|
|
125
227
|
"menu": {
|
|
126
228
|
"autoInject": true
|
|
229
|
+
},
|
|
230
|
+
"views": {
|
|
231
|
+
"ProductsAdmin": "cards",
|
|
232
|
+
"getProducts": "list",
|
|
233
|
+
"CharacterAdmin": "cards"
|
|
127
234
|
}
|
|
128
235
|
}
|
|
129
236
|
```
|
|
@@ -133,6 +240,16 @@ Notes:
|
|
|
133
240
|
- `defaultRoute` must match a path in `routes.gen.ts` (the same path used by the router).
|
|
134
241
|
- You can provide either the final route path or an `operationId`; the generator normalizes it to the correct path.
|
|
135
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
|
+
```
|
|
136
253
|
|
|
137
254
|
Example `menu.overrides.json`:
|
|
138
255
|
|
|
@@ -154,19 +271,6 @@ Example `menu.overrides.json`:
|
|
|
154
271
|
}
|
|
155
272
|
```
|
|
156
273
|
|
|
157
|
-
Optional paths:
|
|
158
|
-
|
|
159
|
-
```bash
|
|
160
|
-
generate-ui angular \
|
|
161
|
-
--schemas /path/to/generate-ui \
|
|
162
|
-
--features /path/to/angular/features
|
|
163
|
-
```
|
|
164
|
-
|
|
165
|
-
Custom output folder for `generate`:
|
|
166
|
-
|
|
167
|
-
```bash
|
|
168
|
-
generate-ui generate --openapi youropenapi.yaml --output /path/to/generate-ui
|
|
169
|
-
```
|
|
170
274
|
|
|
171
275
|
## Login (Dev plan)
|
|
172
276
|
|
|
@@ -189,7 +293,7 @@ Telemetry can be disabled by setting `telemetry=false` in `~/.generateui/config.
|
|
|
189
293
|
|
|
190
294
|
GenerateUI usually creates route files such as:
|
|
191
295
|
|
|
192
|
-
- `src/generate-ui/routes.gen.ts` or `
|
|
296
|
+
- `src/generate-ui/routes.gen.ts` or `generate-ui/routes.gen.ts`
|
|
193
297
|
|
|
194
298
|
Example (Angular Router):
|
|
195
299
|
|
|
@@ -215,7 +319,7 @@ Step-by-step:
|
|
|
215
319
|
1) Generate files:
|
|
216
320
|
|
|
217
321
|
```bash
|
|
218
|
-
generate-ui generate
|
|
322
|
+
generate-ui generate
|
|
219
323
|
generate-ui angular
|
|
220
324
|
```
|
|
221
325
|
|
|
@@ -250,13 +354,13 @@ npm ls @angular/router
|
|
|
250
354
|
## Example Generated Structure
|
|
251
355
|
|
|
252
356
|
```txt
|
|
253
|
-
src/generate-ui/ or
|
|
357
|
+
src/generate-ui/ or generate-ui/
|
|
254
358
|
generated/
|
|
255
359
|
overlays/
|
|
256
360
|
routes.json
|
|
257
361
|
routes.gen.ts
|
|
258
362
|
screens.json
|
|
259
|
-
|
|
363
|
+
src/app/features/
|
|
260
364
|
users/
|
|
261
365
|
users.component.ts
|
|
262
366
|
users.service.gen.ts
|
|
@@ -283,15 +387,54 @@ You can edit files inside `overlays/` to customize labels, placeholders, hints,
|
|
|
283
387
|
|
|
284
388
|
Even after the Angular TypeScript files are generated, changes you make in `overlays/` will be mirrored the next time you regenerate.
|
|
285
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
|
+
|
|
286
428
|
## Common Issues and Fixes
|
|
287
429
|
|
|
288
|
-
### "
|
|
430
|
+
### "Missing OpenAPI file"
|
|
289
431
|
|
|
290
|
-
|
|
432
|
+
`generate-ui generate` did not find `openapi` in `generateui-config.json`.
|
|
291
433
|
|
|
292
434
|
Fix:
|
|
293
435
|
```bash
|
|
294
|
-
|
|
436
|
+
# set "openapi" in generateui-config.json and run:
|
|
437
|
+
generate-ui generate
|
|
295
438
|
```
|
|
296
439
|
|
|
297
440
|
### "An endpoint exists but no screen was generated"
|
|
@@ -339,7 +482,6 @@ Check:
|
|
|
339
482
|
- [ ] Layout presets (minimal / enterprise / dashboard)
|
|
340
483
|
- [ ] Design system adapters (Material / PrimeNG / custom)
|
|
341
484
|
- [ ] Filters and real pagination
|
|
342
|
-
- [ ] UI schema overrides (visual control without touching OpenAPI)
|
|
343
485
|
- [ ] React support
|
|
344
486
|
|
|
345
487
|
## Contributing
|