Skip to content

Commit 3f01fbb

Browse files
committed
feat: merge example configurations into a single AppPlugin for ObjectUI monorepo
1 parent a216967 commit 3f01fbb

3 files changed

Lines changed: 53 additions & 61 deletions

File tree

objectstack.config.ts

Lines changed: 49 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,28 +7,69 @@
77
* Console supports two running modes:
88
* - MSW: `pnpm dev` — Vite dev server with MSW intercepting API calls in browser
99
* - 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.
1014
*/
1115
import { defineStack } from '@objectstack/spec';
1216
import { AppPlugin, DriverPlugin } from '@objectstack/runtime';
1317
import { ObjectQLPlugin } from '@objectstack/objectql';
1418
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;
1826

19-
export default defineStack({
27+
// Merge all example configs into a single app bundle for AppPlugin
28+
const mergedApp = defineStack({
2029
manifest: {
2130
id: 'dev-workspace',
2231
name: 'dev_workspace',
2332
version: '0.0.0',
2433
description: 'ObjectUI monorepo development workspace',
2534
type: 'app',
35+
data: [
36+
...(crm.manifest?.data || []),
37+
...(todo.manifest?.data || []),
38+
...(kitchenSink.manifest?.data || []),
39+
],
2640
},
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 {
2770
plugins: [
2871
new ObjectQLPlugin(),
2972
new DriverPlugin(new InMemoryDriver()),
30-
new AppPlugin(CrmApp),
31-
new AppPlugin(TodoApp),
32-
new AppPlugin(KitchenSinkApp),
73+
new AppPlugin(mergedApp),
3374
],
34-
});
75+
};

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@
7777
"@objectstack/objectql": "^1.1.0",
7878
"@objectstack/plugin-msw": "^1.1.0",
7979
"@objectstack/runtime": "^1.1.0",
80+
"@objectstack/spec": "^1.1.0",
8081
"@storybook/addon-essentials": "^8.6.14",
8182
"@storybook/addon-interactions": "^8.6.14",
8283
"@storybook/addon-links": "^8.6.15",

0 commit comments

Comments
 (0)