@vc-shell/create-vc-app 1.1.99-alpha.1 → 1.1.99-alpha.11

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 (34) hide show
  1. package/README.md +41 -5
  2. package/dist/cli/argv.d.ts.map +1 -1
  3. package/dist/cli/help.d.ts.map +1 -1
  4. package/dist/cli/types.d.ts +5 -0
  5. package/dist/cli/types.d.ts.map +1 -1
  6. package/dist/commands/generate-blade.d.ts +5 -0
  7. package/dist/commands/generate-blade.d.ts.map +1 -1
  8. package/dist/index.js +940 -789
  9. package/dist/templates/base/_package.json +5 -5
  10. package/dist/templates/blades/grid/blade.vue +329 -340
  11. package/dist/templates/composables/details-composable.ts +2 -0
  12. package/dist/templates/composables/grid-composable.ts +3 -1
  13. package/dist/utils/naming.d.ts +1 -0
  14. package/dist/utils/naming.d.ts.map +1 -1
  15. package/dist/utils/register-module.d.ts +4 -0
  16. package/dist/utils/register-module.d.ts.map +1 -1
  17. package/dist/utils/templates.d.ts +10 -0
  18. package/dist/utils/templates.d.ts.map +1 -0
  19. package/dist/workflows/create-app.d.ts.map +1 -1
  20. package/package.json +3 -3
  21. package/dist/templates/base/ai-guides/.cursorrules-vc-shell +0 -529
  22. package/dist/templates/base/ai-guides/README.md +0 -360
  23. package/dist/templates/base/ai-guides/guides/AI_GUIDE.md +0 -195
  24. package/dist/templates/base/ai-guides/guides/blade-patterns.md +0 -384
  25. package/dist/templates/base/ai-guides/guides/complete-workflow.md +0 -781
  26. package/dist/templates/base/ai-guides/guides/composables-reference.md +0 -338
  27. package/dist/templates/base/ai-guides/guides/troubleshooting.md +0 -529
  28. package/dist/templates/base/ai-guides/guides/ui-components-reference.md +0 -903
  29. package/dist/templates/base/ai-guides/prompts/adapt-existing-module.md +0 -1026
  30. package/dist/templates/base/ai-guides/prompts/advanced-scenarios.md +0 -852
  31. package/dist/templates/base/ai-guides/prompts/api-client-generation.md +0 -877
  32. package/dist/templates/base/ai-guides/prompts/cli-usage.md +0 -640
  33. package/dist/templates/base/ai-guides/prompts/quick-start-scenarios.md +0 -773
  34. package/dist/templates/base/ai-guides/prompts/simple-modifications.md +0 -987
@@ -1,529 +0,0 @@
1
- # Troubleshooting Guide
2
-
3
- Solutions for common issues encountered during VC Shell development.
4
-
5
- ## Quick Diagnosis
6
-
7
- **Before diving into specific issues:**
8
-
9
- 1. **Clear browser cache:** `Cmd+Shift+R` (Mac) or `Ctrl+Shift+R` (Windows)
10
- 2. **Restart dev server:** `Ctrl+C`, then `yarn serve`
11
- 3. **Check console:** `F12` → Console tab for errors
12
- 4. **Check Network tab:** Verify API calls succeed
13
-
14
- ---
15
-
16
- ## Module Issues
17
-
18
- ### Module Not Appearing in Navigation
19
-
20
- **Symptom:** Generated module doesn't show in menu
21
-
22
- **Possible Causes:**
23
-
24
- **1. Module Not Registered**
25
-
26
- **Check `src/main.ts`:**
27
- ```typescript
28
- // Should have import
29
- import ProductsModule from "./modules/products";
30
-
31
- // Should have .use() BEFORE .use(router)
32
- app.use(ProductsModule, { router });
33
- app.use(router);
34
- ```
35
-
36
- **Fix:**
37
- ```typescript
38
- // Add manually if missing
39
- import YourModule from "./modules/your-module";
40
-
41
- app
42
- .use(VirtoShellFramework, { ... })
43
- .use(YourModule, { router }) // Add here
44
- .use(router);
45
- ```
46
-
47
- **2. Module Export Issue**
48
-
49
- **Check `src/modules/your-module/index.ts`:**
50
- ```typescript
51
- // Should use createAppModule
52
- import { createAppModule } from "@vc-shell/framework";
53
- import * as pages from "./pages";
54
- import * as locales from "./locales";
55
-
56
- export default createAppModule(pages, locales);
57
-
58
- ```
59
-
60
- **3. Pages Not Exported**
61
-
62
- **Check `src/modules/your-module/pages/index.ts`:**
63
- ```typescript
64
- // Must export all blade files
65
- export { default as ProductsList } from "./products.vue";
66
- export { default as ProductDetails } from "./product-details.vue";
67
-
68
- // Make sure .vue extension is included
69
- ```
70
-
71
- **4. Server Not Restarted**
72
-
73
- **Solution:**
74
- ```bash
75
- # Stop server (Ctrl+C)
76
- # Start again
77
- yarn serve
78
- ```
79
-
80
- ---
81
-
82
- ### Module Shows But Blade Doesn't Open
83
-
84
- **Symptom:** Click menu item, nothing happens
85
-
86
- **Check Browser Console:**
87
-
88
- **Error: "Component not found"**
89
- ```
90
- Fix: Check blade export in pages/index.ts
91
- ```
92
-
93
- **Error: "Missing required prop"**
94
- ```
95
- Fix: Add all 4 required blade props
96
- ```
97
-
98
- **Solution: Verify Blade Props**
99
- ```vue
100
- <template>
101
- <VcBlade
102
- :expanded="true"
103
- :closable="true"
104
- :param="undefined"
105
- :options="undefined"
106
- :title="$t('MODULE.PAGE.TITLE')"
107
- >
108
- <!-- content -->
109
- </VcBlade>
110
- </template>
111
-
112
- <script setup lang="ts">
113
- const props = defineProps<{
114
- expanded?: boolean;
115
- closable?: boolean;
116
- param?: string;
117
- options?: unknown;
118
- }>();
119
- </script>
120
- ```
121
-
122
- ---
123
-
124
- ### Blade Opens But Shows Blank
125
-
126
- **Symptom:** Blade opens but content is empty/white
127
-
128
- **Possible Causes:**
129
-
130
- **1. Template Error**
131
-
132
- **Check Console:**
133
- ```
134
- [Vue warn] Error in render
135
- ```
136
-
137
- **Fix:** Check your template for syntax errors
138
-
139
- **2. Data Not Loading**
140
-
141
- **Check Network Tab:**
142
- - Is API call made?
143
- - Does it succeed (200)?
144
- - Is response correct?
145
-
146
- **Fix:**
147
- ```typescript
148
- // Add console logs
149
- const { action: load, loading, items } = useAsync(async () => {
150
- console.log('Loading data...');
151
- const response = await api.getItems();
152
- console.log('Response:', response);
153
- return response.data;
154
- });
155
-
156
- // Check items are assigned
157
- console.log('Items:', items.value);
158
- ```
159
-
160
- **3. Conditional Rendering**
161
-
162
- **Check for v-if that's always false:**
163
- ```vue
164
- <!-- BAD -->
165
- <VcTable v-if="false" ... />
166
-
167
- <!-- BAD -->
168
- <VcTable v-if="items.length" ... />
169
- <!-- Won't show while loading -->
170
-
171
- <!-- GOOD -->
172
- <VcTable v-if="!loading || items.length" ... />
173
- ```
174
-
175
- ---
176
-
177
- ## Build and Compilation Issues
178
-
179
- ### TypeScript Errors
180
-
181
- **Error: "Property 'x' does not exist on type 'y'"**
182
-
183
- **Solution 1: Add proper types**
184
- ```typescript
185
- // BAD
186
- const item = ref<any>({});
187
-
188
- // GOOD
189
- interface Product {
190
- id: string;
191
- name: string;
192
- price: number;
193
- }
194
-
195
- const item = ref<Product>({
196
- id: '',
197
- name: '',
198
- price: 0
199
- });
200
- ```
201
-
202
- **Solution 2: Optional chaining**
203
- ```typescript
204
- // Instead of
205
- item.value.name
206
-
207
- // Use
208
- item.value?.name
209
- ```
210
-
211
- **Solution 3: Type assertion (last resort)**
212
- ```typescript
213
- (item as Product).name
214
- ```
215
-
216
- ---
217
-
218
- ### Linter Errors
219
-
220
- **Error: "'x' is defined but never used"**
221
-
222
- **Solution:**
223
- ```typescript
224
- // Remove unused imports/variables
225
- // Or prefix with underscore
226
- const _unused = something;
227
- ```
228
-
229
- **Error: "Missing semicolon"**
230
-
231
- **Solution:**
232
- ```bash
233
- # Auto-fix most issues
234
- yarn lint --fix
235
- ```
236
-
237
- ---
238
-
239
- ### Data Not Displaying
240
-
241
- **Symptom:** API call succeeds but data doesn't show
242
-
243
- **Diagnosis:**
244
-
245
- **1. Check Response Structure**
246
- ```typescript
247
- // Log the response
248
- const response = await api.getProducts();
249
- console.log('Response structure:', response);
250
-
251
- // Maybe it's nested?
252
- // response.data.results instead of response.results?
253
- ```
254
-
255
- **2. Check Data Assignment**
256
- ```typescript
257
- // Make sure you're returning the right part
258
- return {
259
- results: response.data.results, // Correct path
260
- totalCount: response.data.total
261
- };
262
- ```
263
-
264
- **3. Check Template Binding**
265
- ```vue
266
- <!-- Verify the prop name matches -->
267
- <VcTable :items="items" ... />
268
-
269
- <!-- Check items has data -->
270
- <div>Items count: {{ items?.length }}</div>
271
- ```
272
-
273
- ---
274
-
275
- ## UI and Styling Issues
276
-
277
- ### Styles Not Applied
278
-
279
- **Symptom:** Component looks unstyled or broken
280
-
281
- **Possible Causes:**
282
-
283
- **1. Missing Tailwind Prefix**
284
- ```vue
285
- <!-- BAD -->
286
- <div class="p-4 bg-primary">
287
-
288
- <!-- GOOD -->
289
- <div class="tw-p-4 tw-bg-[var(--primary-500)]">
290
- ```
291
-
292
- **2. CSS Variables Not Defined**
293
- ```scss
294
- // Use framework variables
295
- color: var(--primary-500);
296
- background: var(--background-primary);
297
-
298
- // Not custom ones that don't exist
299
- color: var(--my-custom-color); // ❌
300
- ```
301
-
302
- **3. Scoped Styles Conflict**
303
- ```vue
304
- <!-- Scoped styles don't affect child components -->
305
- <style scoped>
306
- .child-component { /* Won't work */ }
307
- </style>
308
-
309
- <!-- Use ::v-deep or :deep() -->
310
- <style scoped>
311
- :deep(.child-component) { /* Works */ }
312
- </style>
313
- ```
314
-
315
- ---
316
-
317
- ### Icons Not Showing
318
-
319
- **Symptom:** Icon space is blank
320
-
321
- **Possible Causes:**
322
-
323
- **1. Wrong Icon Name**
324
- ```vue
325
- <!-- Check icon exists -->
326
- <VcIcon icon="fas fa-user" /> <!-- Font Awesome -->
327
- <VcIcon icon="material-home" /> <!-- Material -->
328
- <VcIcon icon="bi-cart" /> <!-- Bootstrap Icons -->
329
- ```
330
-
331
- **2. Icon Library Not Loaded**
332
- ```typescript
333
- // Check main.ts imports CSS
334
- import "@vc-shell/framework/dist/index.css";
335
- ```
336
-
337
- ---
338
-
339
- ## Form and Validation Issues
340
-
341
- ### Validation Not Working
342
-
343
- **Symptom:** Form submits even with invalid data
344
-
345
- **Fix: Use Field Component**
346
- ```vue
347
- <Field
348
- name="email"
349
- v-slot="{ errors, errorMessage, handleChange }"
350
- :rules="{ required: true, email: true }"
351
- >
352
- <VcInput
353
- :model-value="item.email"
354
- :error="!!errors.length"
355
- :error-message="errorMessage"
356
- @update:model-value="(v) => {
357
- item.email = v;
358
- handleChange(v);
359
- }"
360
- />
361
- </Field>
362
- ```
363
-
364
- ---
365
-
366
- ### Form Not Saving
367
-
368
- **Symptom:** Click save, nothing happens
369
-
370
- **Diagnosis:**
371
-
372
- **1. Check Save Function**
373
- ```typescript
374
- const saveChanges = async () => {
375
- console.log('Save called');
376
- console.log('Item:', item.value);
377
-
378
- try {
379
- await api.save(item.value);
380
- console.log('Save successful');
381
- notification.success('Saved!');
382
- } catch (error) {
383
- console.error('Save failed:', error);
384
- notification.error('Save failed');
385
- }
386
- };
387
- ```
388
-
389
- **2. Check Button Binding**
390
- ```vue
391
- <!-- Make sure button calls function -->
392
- <VcButton @click="saveChanges">Save</VcButton>
393
-
394
- <!-- Not just -->
395
- <VcButton>Save</VcButton>
396
- ```
397
-
398
- ---
399
-
400
- ### Modification Tracker Not Working
401
-
402
- **Symptom:** Blade always shows as modified
403
-
404
- **Fix:**
405
- ```typescript
406
- // Make sure to use modification tracker correctly
407
- const item = ref({ /* initial data */ });
408
- const { isModified, currentValue, resetModificationState } = useModificationTracker(item);
409
-
410
- // Load data - assign to currentValue
411
- const loadData = async (id: string) => {
412
- const data = await api.get(id);
413
- currentValue.value = data; // Use currentValue, not item
414
- };
415
-
416
- // Reset after save
417
- const saveChanges = async () => {
418
- await api.save(currentValue.value); // Use currentValue
419
- resetModificationState(); // Reset after successful save
420
- };
421
- ```
422
-
423
- ---
424
-
425
- ### Memory Leaks
426
-
427
- **Symptom:** Application slows down over time
428
-
429
- **Fix: Clean Up Listeners**
430
- ```typescript
431
- import { onBeforeUnmount } from 'vue';
432
-
433
- // Register listener
434
- const handleEvent = () => { ... };
435
- window.addEventListener('resize', handleEvent);
436
-
437
- // Clean up
438
- onBeforeUnmount(() => {
439
- window.removeEventListener('resize', handleEvent);
440
- });
441
- ```
442
-
443
- **Fix: Unregister Widgets**
444
- ```typescript
445
- import { useWidgets, onBeforeUnmount } from '@vc-shell/framework';
446
-
447
- const { registerWidget, unregisterWidget } = useWidgets();
448
-
449
- registerWidget({ id: 'myWidget', ... });
450
-
451
- onBeforeUnmount(() => {
452
- unregisterWidget('myWidget');
453
- });
454
- ```
455
-
456
- ---
457
-
458
- ## CLI Generator Issues
459
-
460
- ### Generator Fails
461
-
462
- **Error:** `Module "xyz" not found`
463
-
464
- **When:** Generating blade for non-existent module
465
-
466
- **Solution:**
467
- In non-interactive mode, CLI automatically creates the module. Make sure you're in project directory.
468
-
469
- ---
470
-
471
- ### Form Fields Not Generated
472
-
473
- **Error:** Invalid JSON
474
-
475
- **Solution:** Check JSON syntax
476
- ```bash
477
- # GOOD
478
- --form-fields '[{"name":"title","type":"VcInput","props":"{\"required\":true}"}]'
479
-
480
- # BAD
481
- --form-fields '[{"name":"title","type":"VcInput","props":"{"required":true}"}]'
482
- # ↑ not escaped
483
- ```
484
-
485
- ---
486
-
487
- ### Widget Not Registered
488
-
489
- **Symptom:** Widget generated but doesn't show
490
-
491
- **Check:** Blade should have:
492
- ```typescript
493
- import { useWidgets, onBeforeUnmount } from '@vc-shell/framework';
494
- import MyWidget from '../components/widgets/my-widget/my-widget-widget.vue';
495
-
496
- const { registerWidget, unregisterWidget } = useWidgets();
497
-
498
- registerWidget({
499
- id: 'myWidget',
500
- component: MyWidget
501
- });
502
-
503
- onBeforeUnmount(() => {
504
- unregisterWidget('myWidget');
505
- });
506
- ```
507
-
508
- ---
509
-
510
- ## Still Having Issues?
511
-
512
- 1. **Search Documentation:** [VC Shell Docs](https://docs.virtocommerce.org/)
513
- 2. **Check GitHub Issues:** [VC Shell Repository](https://github.com/VirtoCommerce/vc-shell)
514
-
515
- ---
516
-
517
- ## Prevention Tips
518
-
519
- **To avoid common issues:**
520
-
521
- 1. **Always use TypeScript properly** - don't use `any`
522
- 2. **Handle errors** - wrap API calls in try-catch
523
- 3. **Test frequently** - don't write too much before testing
524
- 4. **Use browser DevTools** - check console and network
525
- 5. **Read error messages** - they usually explain the issue
526
- 6. **Keep dependencies updated** - `yarn upgrade`
527
- 7. **Follow framework conventions** - use provided patterns
528
- 8. **Clear cache regularly** - avoid stale data issues
529
-