|
7 | 7 | * Console supports two running modes: |
8 | 8 | * - MSW: `pnpm dev` — Vite dev server with MSW intercepting API calls in browser |
9 | 9 | * - Server: `pnpm dev:server` — Real ObjectStack API server + Vite console proxying to it |
| 10 | + * |
| 11 | + * Note: Examples are merged into a single AppPlugin (rather than separate AppPlugins) |
| 12 | + * because CRM and Kitchen Sink both define an `account` object, which would |
| 13 | + * trigger an ownership conflict in the ObjectQL Schema Registry. |
10 | 14 | */ |
11 | 15 | import { defineStack } from '@objectstack/spec'; |
12 | 16 | import { AppPlugin, DriverPlugin } from '@objectstack/runtime'; |
13 | 17 | import { ObjectQLPlugin } from '@objectstack/objectql'; |
14 | 18 | import { InMemoryDriver } from '@objectstack/driver-memory'; |
15 | | -import CrmApp from './examples/crm/objectstack.config'; |
16 | | -import TodoApp from './examples/todo/objectstack.config'; |
17 | | -import KitchenSinkApp from './examples/kitchen-sink/objectstack.config'; |
| 19 | +import CrmConfig from './examples/crm/objectstack.config'; |
| 20 | +import TodoConfig from './examples/todo/objectstack.config'; |
| 21 | +import KitchenSinkConfig from './examples/kitchen-sink/objectstack.config'; |
| 22 | + |
| 23 | +const crm = (CrmConfig as any).default || CrmConfig; |
| 24 | +const todo = (TodoConfig as any).default || TodoConfig; |
| 25 | +const kitchenSink = (KitchenSinkConfig as any).default || KitchenSinkConfig; |
18 | 26 |
|
19 | | -export default defineStack({ |
| 27 | +// Merge all example configs into a single app bundle for AppPlugin |
| 28 | +const mergedApp = defineStack({ |
20 | 29 | manifest: { |
21 | 30 | id: 'dev-workspace', |
22 | 31 | name: 'dev_workspace', |
23 | 32 | version: '0.0.0', |
24 | 33 | description: 'ObjectUI monorepo development workspace', |
25 | 34 | type: 'app', |
| 35 | + data: [ |
| 36 | + ...(crm.manifest?.data || []), |
| 37 | + ...(todo.manifest?.data || []), |
| 38 | + ...(kitchenSink.manifest?.data || []), |
| 39 | + ], |
26 | 40 | }, |
| 41 | + objects: [ |
| 42 | + ...(crm.objects || []), |
| 43 | + ...(todo.objects || []), |
| 44 | + ...(kitchenSink.objects || []), |
| 45 | + ], |
| 46 | + apps: [ |
| 47 | + ...(crm.apps || []), |
| 48 | + ...(todo.apps || []), |
| 49 | + ...(kitchenSink.apps || []), |
| 50 | + ], |
| 51 | + dashboards: [ |
| 52 | + ...(crm.dashboards || []), |
| 53 | + ...(todo.dashboards || []), |
| 54 | + ...(kitchenSink.dashboards || []), |
| 55 | + ], |
| 56 | + reports: [ |
| 57 | + ...(crm.reports || []), |
| 58 | + ], |
| 59 | + pages: [ |
| 60 | + ...(crm.pages || []), |
| 61 | + ...(todo.pages || []), |
| 62 | + ...(kitchenSink.pages || []), |
| 63 | + ], |
| 64 | +} as any); |
| 65 | + |
| 66 | +// Export only plugins — no top-level objects/manifest/apps. |
| 67 | +// The CLI auto-creates an AppPlugin from the config if it detects objects/manifest/apps, |
| 68 | +// which would conflict with our explicit AppPlugin and skip seed data loading. |
| 69 | +export default { |
27 | 70 | plugins: [ |
28 | 71 | new ObjectQLPlugin(), |
29 | 72 | new DriverPlugin(new InMemoryDriver()), |
30 | | - new AppPlugin(CrmApp), |
31 | | - new AppPlugin(TodoApp), |
32 | | - new AppPlugin(KitchenSinkApp), |
| 73 | + new AppPlugin(mergedApp), |
33 | 74 | ], |
34 | | -}); |
| 75 | +}; |
0 commit comments