@vc-shell/create-vc-app 1.1.99-alpha.1 → 1.2.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.
Files changed (83) hide show
  1. package/README.md +26 -552
  2. package/dist/index.js +530 -1900
  3. package/dist/templates/base/_package.json +5 -5
  4. package/dist/templates/base/src/main.ts +4 -0
  5. package/dist/templates/mocks/sample-data/constants.ts +89 -0
  6. package/dist/templates/mocks/sample-data/index.ts +2 -0
  7. package/dist/templates/mocks/sample-data/methods.ts +65 -0
  8. package/dist/templates/modules/classic-module/composables/index.ts +2 -0
  9. package/dist/templates/modules/classic-module/composables/use{{ModuleNamePascalCase}}Details/index.ts +24 -0
  10. package/dist/templates/modules/classic-module/composables/use{{ModuleNamePascalCase}}List/index.ts +47 -0
  11. package/dist/templates/modules/classic-module/index.ts +8 -0
  12. package/dist/templates/modules/classic-module/locales/en.json +37 -0
  13. package/dist/templates/modules/classic-module/locales/index.ts +2 -0
  14. package/dist/templates/modules/classic-module/pages/details.vue +87 -0
  15. package/dist/templates/modules/classic-module/pages/index.ts +2 -0
  16. package/dist/templates/modules/classic-module/pages/list.vue +257 -0
  17. package/dist/templates/sample/classic-module/composables/index.ts +2 -0
  18. package/dist/templates/sample/classic-module/composables/useDetails/index.ts +54 -0
  19. package/dist/templates/sample/classic-module/composables/useList/index.ts +62 -0
  20. package/dist/templates/sample/classic-module/index.ts +8 -0
  21. package/dist/templates/sample/classic-module/locales/en.json +67 -0
  22. package/dist/templates/sample/classic-module/locales/index.ts +2 -0
  23. package/dist/templates/sample/classic-module/pages/details.vue +238 -0
  24. package/dist/templates/sample/classic-module/pages/index.ts +2 -0
  25. package/dist/templates/sample/classic-module/pages/list.vue +300 -0
  26. package/dist/templates/sample/overrides/main.ts +52 -0
  27. package/package.json +7 -12
  28. package/dist/cli/argv.d.ts +0 -4
  29. package/dist/cli/argv.d.ts.map +0 -1
  30. package/dist/cli/constants.d.ts +0 -4
  31. package/dist/cli/constants.d.ts.map +0 -1
  32. package/dist/cli/errors.d.ts +0 -12
  33. package/dist/cli/errors.d.ts.map +0 -1
  34. package/dist/cli/help.d.ts +0 -3
  35. package/dist/cli/help.d.ts.map +0 -1
  36. package/dist/cli/run.d.ts +0 -2
  37. package/dist/cli/run.d.ts.map +0 -1
  38. package/dist/cli/runtime.d.ts +0 -7
  39. package/dist/cli/runtime.d.ts.map +0 -1
  40. package/dist/cli/types.d.ts +0 -30
  41. package/dist/cli/types.d.ts.map +0 -1
  42. package/dist/cli/utils.d.ts +0 -4
  43. package/dist/cli/utils.d.ts.map +0 -1
  44. package/dist/cli/validation.d.ts +0 -5
  45. package/dist/cli/validation.d.ts.map +0 -1
  46. package/dist/commands/generate-blade.d.ts +0 -16
  47. package/dist/commands/generate-blade.d.ts.map +0 -1
  48. package/dist/templates/base/ai-guides/.cursorrules-vc-shell +0 -529
  49. package/dist/templates/base/ai-guides/README.md +0 -360
  50. package/dist/templates/base/ai-guides/guides/AI_GUIDE.md +0 -195
  51. package/dist/templates/base/ai-guides/guides/blade-patterns.md +0 -384
  52. package/dist/templates/base/ai-guides/guides/complete-workflow.md +0 -781
  53. package/dist/templates/base/ai-guides/guides/composables-reference.md +0 -338
  54. package/dist/templates/base/ai-guides/guides/troubleshooting.md +0 -529
  55. package/dist/templates/base/ai-guides/guides/ui-components-reference.md +0 -903
  56. package/dist/templates/base/ai-guides/prompts/adapt-existing-module.md +0 -1026
  57. package/dist/templates/base/ai-guides/prompts/advanced-scenarios.md +0 -852
  58. package/dist/templates/base/ai-guides/prompts/api-client-generation.md +0 -877
  59. package/dist/templates/base/ai-guides/prompts/cli-usage.md +0 -640
  60. package/dist/templates/base/ai-guides/prompts/quick-start-scenarios.md +0 -773
  61. package/dist/templates/base/ai-guides/prompts/simple-modifications.md +0 -987
  62. package/dist/templates/blades/details/blade.vue +0 -175
  63. package/dist/templates/blades/grid/blade.vue +0 -340
  64. package/dist/templates/composables/details-composable.ts +0 -101
  65. package/dist/templates/composables/grid-composable.ts +0 -244
  66. package/dist/templates/module/components/index.ts +0 -2
  67. package/dist/templates/module/components/widgets/index.ts +0 -2
  68. package/dist/templates/module/composables/index.ts +0 -3
  69. package/dist/templates/module/index.ts +0 -13
  70. package/dist/templates/module/locales/en.json +0 -65
  71. package/dist/templates/module/locales/index.ts +0 -4
  72. package/dist/templates/module/pages/index.ts +0 -3
  73. package/dist/templates/widgets/widget.vue +0 -113
  74. package/dist/utils/form-builder.d.ts +0 -69
  75. package/dist/utils/form-builder.d.ts.map +0 -1
  76. package/dist/utils/format.d.ts +0 -24
  77. package/dist/utils/format.d.ts.map +0 -1
  78. package/dist/utils/naming.d.ts +0 -44
  79. package/dist/utils/naming.d.ts.map +0 -1
  80. package/dist/utils/register-module.d.ts +0 -21
  81. package/dist/utils/register-module.d.ts.map +0 -1
  82. package/dist/workflows/create-app.d.ts +0 -14
  83. package/dist/workflows/create-app.d.ts.map +0 -1
package/README.md CHANGED
@@ -1,18 +1,8 @@
1
- # @vc-shell/create-vc-app
2
-
3
- CLI tool for creating VC Shell applications and generating blades.
4
-
5
- ## Table of Contents
6
-
7
- - [Creating a New Application](#creating-a-new-application)
8
- - [Blade Generator](#blade-generator)
9
- - [Available Options](#available-options)
10
-
11
- ## Creating a New Application
1
+ # Creating your first application
12
2
 
13
3
  Make sure you have executed `yarn` command and your current working directory is the one where you intend to create a project.
14
4
 
15
- ### Interactive Mode (Default)
5
+ ## Interactive Mode (Default)
16
6
 
17
7
  Run following command:
18
8
  ```bash
@@ -22,60 +12,24 @@ $ npx create-vc-app
22
12
  This command will execute application scaffolding tool. You will be presented with prompts:
23
13
 
24
14
  ```text
25
- ╔══════════════════════════════════════════════════╗
26
- ║ create-vc-app v1.x.x ║
27
- ╚══════════════════════════════════════════════════╝
28
-
29
15
  ✔ Project name: … <your-app-name>
30
16
  ✔ Package name: … <your-package-name>
31
17
  ✔ Base path: … /apps/<your-app-name>/
18
+ ✔ Select module variant: › Classic view modules boilerplate
19
+ ✔ Module name: … <your-first-module-name>
20
+ ✔ Do you want to include additional module with sample data? … No / Yes
32
21
 
33
- 📦 Scaffolding app in ./<your-app-name>...
34
- ✅ Created 42 files
35
-
36
- 🎨 Formatting files with Prettier...
37
- ✅ All files formatted
38
-
39
- 🏗️ Creating module with blade generator...
40
-
41
- ✔ Module name (e.g., products, orders): … <your-module-name>
42
- ✔ Entity name (e.g., Product, Order): … <your-entity-name>
43
- ✔ Create both Grid and Details blades? … yes
44
- ✔ Which blade should be the workspace blade (main module blade)? › Grid blade
45
- ✔ Customize form fields interactively? … no
46
-
47
- ==================================================
48
- ✨ Application created successfully!
49
- ==================================================
50
-
51
- 📊 Summary:
52
- Location: /path/to/<your-app-name>
53
- Package: <your-package-name>
54
- Base path: /apps/<your-app-name>/
55
- Files created: 42
22
+ Scaffolding app in ./<your-app-name>...
56
23
 
57
- 🚀 Next steps:
58
-
59
- 1. cd <your-app-name>
60
- 2. yarn
61
- 3. yarn serve
24
+ Done.
62
25
  ```
63
26
 
64
- The process is now streamlined - after basic app configuration, the powerful blade generator creates your first module with proper structure, composables, and locales. All files are automatically formatted with Prettier.
65
-
66
27
  ## Non-Interactive Mode
67
28
 
68
29
  For automation, CI/CD, or when you want to skip prompts, you can use command line arguments:
69
30
 
70
31
  ```bash
71
- $ npx create-vc-app my-app --skip-module-gen
72
- ```
73
-
74
- Then add modules later using the blade generator:
75
-
76
- ```bash
77
- $ cd my-app
78
- $ npx create-vc-app blade
32
+ $ npx create-vc-app my-app --variant classic --module-name "My Module" --mocks
79
33
  ```
80
34
 
81
35
  ### Available Options
@@ -84,31 +38,29 @@ $ npx create-vc-app blade
84
38
  |--------|-------------|---------|
85
39
  | `--name`, `--app-name` | Name of the application | Directory name |
86
40
  | `--package-name` | Package name | App name (validated) |
41
+ | `--variant` | Module variant (classic\|dynamic) | `classic` |
42
+ | `--module-name` | Module name | App name in title case |
87
43
  | `--base-path` | Base path for the application | `/apps/<app-name>/` |
88
- | `--skip-module-gen` | Skip module generation (create only base app) | `false` |
89
- | `--skip-form-editor` | Skip interactive form builder | `false` |
90
- | `--form-fields` | JSON string with form field definitions | - |
44
+ | `--mocks` | Include additional module with sample data | `false` |
91
45
  | `--overwrite` | Overwrite existing files without confirmation | `false` |
92
46
  | `--help`, `-h` | Show help message | - |
93
47
  | `--version`, `-v` | Show version | - |
94
48
 
95
49
  ### Examples
96
50
 
97
- **Basic usage (interactive):**
51
+ **Basic usage:**
98
52
  ```bash
99
53
  npx create-vc-app my-app
100
- # Will prompt for app config, then launch blade generator for first module
101
54
  ```
102
55
 
103
- **With custom base path:**
56
+ **With custom options:**
104
57
  ```bash
105
- npx create-vc-app my-app --base-path "/custom/path/" --package-name "@my-org/my-app"
58
+ npx create-vc-app my-app --variant classic --module-name "My Module" --mocks
106
59
  ```
107
60
 
108
- **Create base app without module:**
61
+ **With custom paths:**
109
62
  ```bash
110
- npx create-vc-app my-app --skip-module-gen
111
- # Then add modules later: cd my-app && npx create-vc-app blade
63
+ npx create-vc-app my-app --base-path "/custom/path/" --package-name "@my-org/my-app"
112
64
  ```
113
65
 
114
66
  **Overwrite existing directory:**
@@ -121,22 +73,17 @@ npx create-vc-app existing-dir --overwrite
121
73
  npx create-vc-app . --name my-existing-project --overwrite
122
74
  ```
123
75
 
124
- **Full non-interactive mode with all options:**
76
+ **Full non-interactive example:**
125
77
  ```bash
126
- npx create-vc-app my-app \
127
- --package-name "@my-org/my-app" \
128
- --base-path "/apps/my-custom-path/" \
129
- --skip-module-gen \
78
+ npx create-vc-app my-ecommerce-app \
79
+ --variant classic \
80
+ --module-name "Product Catalog" \
81
+ --base-path "/apps/ecommerce/" \
82
+ --package-name "@mycompany/ecommerce-app" \
83
+ --mocks \
130
84
  --overwrite
131
85
  ```
132
86
 
133
- **With predefined form fields:**
134
- ```bash
135
- npx create-vc-app my-app \
136
- --skip-form-editor \
137
- --form-fields '[{"name":"title","type":"text","required":true},{"name":"price","type":"currency"}]'
138
- ```
139
-
140
87
  ## After Creation
141
88
 
142
89
  Once app is created, follow the instructions to install dependencies and start dev server:
@@ -146,487 +93,14 @@ $ yarn
146
93
  $ yarn serve
147
94
  ```
148
95
 
149
- Your app will be available at `http://localhost:8080/apps/<your-app-name>/`
150
-
151
- ## Key Features
152
-
153
- ### 🎯 Professional Quality
154
-
155
- - **Node.js Version Check**: Ensures compatibility (Node 18+)
156
- - **Smart Validation**: Package names, base paths, and all arguments are validated
157
- - **Graceful Error Handling**: Clear error messages and proper cancellation handling
158
- - **Automatic Formatting**: All files formatted with Prettier based on project config
159
-
160
- ### 📊 Detailed Progress & Summary
161
-
162
- Real-time feedback during generation:
163
- - Progress indicators for each step
164
- - File count tracking
165
- - Comprehensive final summary with:
166
- - Project location
167
- - Configuration details
168
- - Next steps with commands
169
-
170
- ### 🎨 Automatic Code Formatting
171
-
172
- - Respects project's `.prettierrc` configuration
173
- - Formats TypeScript, Vue, JSON, and Markdown files
174
- - Ensures consistent code style from the start
175
- - No manual formatting needed
176
-
177
- ### 🚀 Streamlined Workflow
178
-
179
- 1. **Basic app scaffolding** (42+ files)
180
- 2. **Automatic formatting**
181
- 3. **Initial module generation** with blade generator
182
- 4. **Clear next steps**
183
-
184
- Everything you need to start developing immediately!
185
-
186
- ## Interactive Generator
187
-
188
- The interactive generator provides a powerful menu-driven interface for generating modules, blades, and widgets with best practices.
189
-
190
- ### Quick Start
191
-
192
- Run the following command in your project directory:
193
- ```bash
194
- $ npx create-vc-app blade
195
- # or
196
- $ npx create-vc-app generate
197
- ```
198
-
199
- ### Main Menu
200
-
201
- You will see a menu with three options:
202
-
203
- 1. **Module (with blades)** - Create a complete new module
204
- 2. **Blade (in existing module)** - Add a blade to an existing module
205
- 3. **Widget (for existing blade)** - Create a widget for an existing blade
206
-
207
- ### Automatic Code Formatting 🎨
208
-
209
- All generated files are **automatically formatted** using Prettier with your project's configuration:
210
-
211
- ✅ **Respects `.prettierrc`** in your project root
212
- ✅ **Smart fallback defaults** if no config found
213
- ✅ **Vue files** formatted with `singleAttributePerLine: true`
214
- ✅ **TypeScript, JSON, and all files** properly formatted
215
-
216
- **Default Configuration:**
217
- ```json
218
- {
219
- "singleAttributePerLine": true,
220
- "endOfLine": "auto"
221
- }
222
- ```
223
-
224
- **Example - Before Generator:**
225
- ```vue
226
- <VcWidget v-loading:500="loading" :value="count" :title="$t('MODULE.TITLE')" icon="star" @click="handler"></VcWidget>
227
- ```
228
-
229
- **After Generator (auto-formatted):**
230
- ```vue
231
- <VcWidget
232
- v-loading:500="loading"
233
- :value="count"
234
- :title="$t('MODULE.TITLE')"
235
- icon="star"
236
- @click="handler"
237
- ></VcWidget>
238
- ```
239
-
240
- **Why `singleAttributePerLine: true`?**
241
- - 📖 Better readability for Vue components
242
- - 🔍 Easier Git diffs - see exactly which prop changed
243
- - ✨ Consistent with VC Shell framework style
244
- - 🤝 Better for code reviews
245
-
246
- ### Creating a New Module
247
-
248
- When you select "Module", you'll be guided through:
249
-
250
- ```text
251
- ✔ Module name (e.g., products, orders): …
252
- ✔ Entity name (e.g., Product, Order): …
253
- ✔ Create both Grid and Details blades? … yes / no
254
- ✔ Which blade should be the workspace blade (main module blade)? › Grid / Details / Both / None
255
- ✔ Customize form fields interactively? … yes / no
256
- ```
257
-
258
- **Smart Naming:**
259
- - Automatic pluralization using `pluralize` library
260
- - Just enter singular form (e.g., "Order") → automatically generates "Orders"
261
- - No more "offerss" bugs!
262
- - Consistent naming throughout generated files (kebab-case, camelCase, PascalCase, snake_case)
263
-
264
- **Workspace Blade:**
265
- - A workspace blade is the main entry point of a module
266
- - It gets a menu item in the app navigation
267
- - You can choose which blade(s) should be workspace blades
268
-
269
- **Auto-Registration:**
270
- - Module is automatically registered in `main.ts`
271
- - Blades are automatically exported in `pages/index.ts`
272
- - No manual imports needed!
273
-
274
- ### Non-Interactive Mode (Scripting & CI/CD)
275
-
276
- For automation or CI/CD pipelines, you can use command-line flags:
277
-
278
- ```bash
279
- # Add a blade to an existing module
280
- $ npx create-vc-app blade --module orders --type grid --name Order
281
-
282
- # Add a details blade with workspace flag
283
- $ npx create-vc-app blade --module products --type details --name Product --workspace
284
-
285
- # Generate a widget
286
- $ npx create-vc-app blade --widget
287
- ```
288
-
289
- **Available Flags:**
290
-
291
- | Flag | Description | Example |
292
- |------|-------------|---------|
293
- | `--module` | Existing module name | `--module orders` |
294
- | `--type` | Blade type (grid\|details) | `--type grid` |
295
- | `--name` | Entity name | `--name Product` |
296
- | `--workspace` | Make it a workspace blade | `--workspace` |
297
- | `--composable` | Include composable (default: true) | `--no-composable` |
298
- | `--widget` | Generate widget only | `--widget` |
299
- | `--path` | Project path | `--path ./my-app` |
300
-
301
- **Security & Safety:**
302
- - Module names are automatically normalized to kebab-case
303
- - `"My New Module"` → `my-new-module` ✅
304
- - Prevents filesystem issues with spaces and special characters
305
- - Form options are properly escaped (e.g., `"Men's"` → `"Men\'s"`)
306
-
307
- ### Adding to Existing Module
308
-
309
- When you select "Blade (in existing module)":
310
-
311
- ```text
312
- ✔ Select existing module: › products / orders / ...
313
- ✔ Entity name (e.g., Product, Order): …
314
- ✔ Blade type: › Grid (List) / Details (Form)
315
- ✔ Is this a workspace blade? … yes / no
316
- ✔ Include composable? … yes / no
317
- ✔ Customize form fields interactively? … yes / no (for Details blade)
318
- ```
319
-
320
- **Features:**
321
- - Blades are automatically registered in `pages/index.ts`
322
- - Composables are auto-exported from `composables/index.ts`
323
- - Custom form fields update locales automatically
324
-
325
- ### Creating Widgets
326
-
327
- When you select "Widget (for existing blade)":
328
-
329
- ```text
330
- ✔ Select module: › products / orders / ...
331
- ✔ Select blade to register widget in: › product-details / order-details / ...
332
- ✔ Widget name (e.g., Stats, Chart, Items): …
333
- ✔ Related entity name (e.g., Offer, Review): …
334
- ✔ Widget icon: › List / Sell / Cart / Star / Image / Custom
335
- ```
336
-
337
- **Generated files:**
338
- - `components/widgets/{widget-name}/{widget-name}-widget.vue`
339
- - `components/widgets/{widget-name}/index.ts`
340
- - Auto-export in `components/widgets/index.ts`
341
- - **Automatic locale updates** - Adds `WIDGETS.{WIDGET_NAME}.TITLE` to `locales/en.json`
342
- - **Automatic blade registration** - Widget is registered in the parent blade
343
-
344
- **Features:**
345
- - ✅ **No manual steps required!** Widget is fully integrated
346
- - ✅ Auto-adds import: `import { YourWidget } from "../components/widgets"`
347
- - ✅ Auto-creates `registerWidgets()` function with `registerWidget()` call
348
- - ✅ Auto-adds `unregisterWidget()` in `onBeforeUnmount()`
349
- - ✅ Auto-adds required imports: `useWidgets`, `useBlade`, `onBeforeUnmount`
350
- - ✅ `registerWidget` and `unregisterWidget` come from `useWidgets()` composable
351
- - ✅ No missing-translation warnings
352
- - ✅ Widget ready to use immediately after generation
353
-
354
- **What the generator adds to your blade:**
355
-
356
- ```typescript
357
- // ✅ Widget import
358
- import { YourWidget } from "../components/widgets";
359
-
360
- // ✅ Framework imports (only what's needed)
361
- import { useWidgets, useBlade } from "@vc-shell/framework";
362
- import { onBeforeUnmount } from "vue";
363
-
364
- // ✅ Setup composables
365
- const blade = useBlade();
366
- const { registerWidget, unregisterWidget } = useWidgets();
367
- // ^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^
368
- // From useWidgets(), NOT direct imports!
369
-
370
- // ✅ Registration
371
- function registerWidgets() {
372
- registerWidget(
373
- {
374
- id: "YourWidget",
375
- component: YourWidget,
376
- props: { item },
377
- updateFunctionName: "updateActiveWidgetCount",
378
- // isVisible: computed(() => !!props.param), // Uncomment to show widget only when blade has param
379
- },
380
- blade?.value.id ?? "",
381
- );
382
- }
383
-
384
- registerWidgets();
385
-
386
- // ✅ Cleanup
387
- onBeforeUnmount(() => {
388
- unregisterWidget("YourWidget", blade?.value.id);
389
- });
390
- ```
391
-
392
- **Widget Visibility:**
393
- - By default, widgets are **always visible** (recommended for better UX)
394
- - Uncomment `isVisible` if you want the widget to appear only when blade has a `param` (edit mode)
395
-
396
- ### Interactive Form Builder
397
-
398
- For Details blades, you can customize form fields interactively:
399
-
400
- ```text
401
- 📝 Configure form fields:
402
- ✔ Field name (e.g., price, description): …
403
- ✔ Field type: › Text Input / Textarea / Number / Date / Select /
404
- Checkbox / Radio / Switch / Currency / Editor /
405
- Image / Multivalue / Gallery
406
- ✔ Options (for Select/Radio): … option1, option2, option3
407
- ✔ Field label (optional): …
408
- ✔ Is this field required? … yes / no
409
- ✔ Add another field? … yes / no
410
- ```
411
-
412
- **Supported Components:**
413
- - VcInput, VcTextarea (text fields)
414
- - VcSelect, VcRadioButton (selections)
415
- - VcCheckbox, VcSwitch (toggles)
416
- - VcInputCurrency, VcEditor (special inputs)
417
- - VcImage, VcGallery (media)
418
- - VcMultivalue (arrays)
419
-
420
- **Generated output:**
421
- - Proper Vc component templates
422
- - vee-validate Field wrappers
423
- - Auto-generated locale keys
424
- - Type-safe v-model bindings
425
- - Default fields replaced with custom ones
426
-
427
- ### Blade Generator Options
428
-
429
- | Option | Description | Default |
430
- |--------|-------------|---------|
431
- | `--type` | Blade type: `grid` or `details` | Required (interactive) |
432
- | `--module` | Module name (e.g., products, orders) | Required (interactive) |
433
- | `--composable` | Include composable with useAsync and useApiClient | `true` |
434
- | `--locales` | Include locale keys in module | `true` |
435
- | `--widget` | Include widget component | `false` |
436
- | `--is-workspace` | Mark as workspace blade (main module blade) | `false` |
437
- | `--path` | Target directory | Current directory |
438
-
439
- ### Generated Features
440
-
441
- **Grid Blade** (List view):
442
- - Table with sorting and pagination
443
- - Search functionality
444
- - **Advanced Filters** (staged/applied architecture)
445
- - Status filters with radio buttons
446
- - Date range filters
447
- - Apply/Reset buttons
448
- - Active filter count indicator
449
- - Empty and not-found states
450
- - Toolbar with add/delete/refresh
451
- - Notifications support
452
-
453
- **Grid Composable:**
454
- - Complete pagination: `totalCount`, `pages`, `currentPage`
455
- - Filter state management: `stagedFilters`, `appliedFilters`
456
- - Filter methods: `toggleFilter`, `applyFilters`, `resetFilters`, `resetSearch`
457
- - Generic API client with TODO comments
458
- - Type-safe with full TypeScript interfaces
459
-
460
- **Details Blade** (Form view):
461
- - Form with validation (vee-validate)
462
- - VcInput/VcField components (no raw HTML inputs)
463
- - Modification tracking with `useModificationTracker`
464
- - Save/delete toolbar actions
465
- - onBeforeClose guard
466
- - useBeforeUnload hook
467
-
468
- **Details Composable:**
469
- - Correct `useModificationTracker` usage (returns `currentValue` as `item`)
470
- - `useLoading` for combined loading states
471
- - Reactive item management
472
- - Generic API client with TODO comments
473
- - Type-safe operations
474
-
475
- ### Generated Files
476
-
477
- When you generate a blade, the following files are created:
478
-
479
- ```
480
- src/modules/<module-name>/
481
- ├── pages/
482
- │ └── <blade-name>.vue # Blade component
483
- ├── composables/
484
- │ ├── use<EntityName>s.ts # List composable (grid)
485
- │ ├── use<EntityName>Details.ts # Details composable (details)
486
- │ └── index.ts # Composables index
487
- ├── components/
488
- │ └── widgets/
489
- │ └── <widget-name>/
490
- │ ├── <widget-name>-widget.vue
491
- │ └── index.ts
492
- ├── locales/
493
- │ ├── en.json # Locale keys
494
- │ └── index.ts # Locales index
495
- └── index.ts # Module entry point
496
- ```
497
-
498
- ### Example: Complete Workflow
499
-
500
- 1. Create a new application:
501
- ```bash
502
- $ npx create-vc-app my-ecommerce-app --variant classic --module-name "Products"
503
- $ cd my-ecommerce-app
504
- $ yarn
505
- ```
506
-
507
- 2. Generate a list blade:
508
- ```bash
509
- $ npx create-vc-app blade ProductsList --type grid --module products --is-workspace
510
- ```
511
-
512
- 3. Generate a details blade:
513
- ```bash
514
- $ npx create-vc-app blade ProductDetails --type details --module products
515
- ```
516
-
517
- 4. Generate a widget:
518
- ```bash
519
- $ npx create-vc-app blade ProductVariants --type grid --module products --widget
520
- ```
521
-
522
- 5. Start development server:
523
- ```bash
524
- $ yarn serve
525
- ```
526
-
527
- ### Automatic Code Formatting
528
-
529
- All generated files are automatically formatted with Prettier to ensure consistent code style.
530
-
531
- ### Customization
532
-
533
- After generating a blade:
534
-
535
- 1. **Update API Client Methods**:
536
- - Look for `TODO:` comments in composables
537
- - Replace `@ts-expect-error` placeholders with actual types
538
- - Import your API client (e.g., `ProductsClient` from `@your-app/api`)
539
- - Update method names to match your API
540
-
541
- 2. **Customize Columns/Fields**:
542
- - Modify table columns in grid blades
543
- - Add/remove form fields in details blades
544
- - Use the interactive form builder for quick prototyping
545
-
546
- 3. **Add Business Logic**:
547
- - Implement custom validation rules
548
- - Add calculations or derived data
549
- - Integrate with state machines or workflows
550
-
551
- 4. **Style Components**:
552
- - Apply custom styles following framework guidelines
553
- - Use TailwindCSS classes with `tw-` prefix
554
- - Leverage framework's color palette and spacing
555
-
556
- ### Security & Safety Features
557
-
558
- The generator includes several safety measures to prevent common issues:
559
-
560
- **1. Safe Module Names**
561
- - Input: `"My New Module"` → Output: `my-new-module`
562
- - Automatic kebab-case normalization prevents:
563
- - Filesystem errors from spaces
564
- - Invalid import paths
565
- - Shell/bundler compatibility issues
566
-
567
- **2. Escaped Form Options**
568
- - Input: `"Men's Clothing"` → Output: `"Men\'s Clothing"`
569
- - Prevents template injection
570
- - Quotes are properly escaped in Vue templates
571
- - Safe for Select/Radio options
572
-
573
- **3. Automatic Locale Management**
574
- - Widget translations automatically added
575
- - No missing-translation warnings
576
- - Creates namespaces when missing
577
- - Format validation
578
-
579
- **4. Error Handling**
580
- - Graceful cancellation (Ctrl+C / Esc)
581
- - Clear error messages
582
- - File existence checks
583
- - Rollback on failures
584
-
585
- ### Troubleshooting
586
-
587
- **Q: Getting TypeScript errors after generation?**
588
- A: The generated code uses `@ts-expect-error` for placeholder types. Replace them with your actual API types and imports.
589
-
590
- **Q: API client imports are missing?**
591
- A: Update the imports at the top of composables to point to your actual API client location. Look for `TODO:` comments.
592
-
593
- **Q: Filter/form fields don't match my needs?**
594
- A: Edit the blade template and composable. The generator provides a starting point - customize as needed.
595
-
596
- **Q: Module doesn't appear in the app?**
597
- A: Don't forget to import and register the module in your `main.ts`:
598
- ```typescript
599
- import MyModule from "./modules/my-module";
600
- app.use(MyModule);
601
- ```
602
-
603
- **Q: Naming is wrong (pluralization issues)?**
604
- A: The new generator asks for BOTH singular and plural forms to avoid "offerss" bugs. If you still see issues, check your input.
96
+ ## Available Variants
605
97
 
606
- **Q: Want to regenerate with different options?**
607
- A: Simply run the generator again. It will overwrite existing files, so make sure to commit your changes first!
608
-
609
- ### Architecture
610
-
611
- Generated blades follow VC Shell architecture:
612
-
613
- - **Composables**: Business logic with `useAsync`, `useApiClient`, `useModificationTracker`
614
- - **Props & Emits**: Standard blade interface for communication
615
- - **Localization**: i18n keys following framework conventions
616
- - **TypeScript**: Full type safety with interfaces
617
- - **Responsive**: Mobile-ready with responsive utilities
98
+ - **classic** - Classic view modules boilerplate (default)
99
+ - **dynamic** - Dynamic view modules boilerplate (coming soon)
618
100
 
619
101
  ## Notes
620
102
 
621
- ### Application Creation
622
103
  - If you provide a project name as the first argument, it will be used as the app name
623
104
  - The `--variant` option is required for non-interactive mode
624
105
  - Use `--overwrite` to automatically overwrite existing files without confirmation
625
106
  - Package names are automatically validated and converted to valid npm package names
626
-
627
- ### Blade Generation
628
- - Blade names should be in PascalCase (e.g., ProductDetails, OrdersList)
629
- - Module names should be in lowercase (e.g., products, orders)
630
- - Generated blades follow framework best practices and architecture
631
- - Composables use framework utilities (useAsync, useApiClient, useModificationTracker)
632
- - All generated code is fully typed with TypeScript