Skip to content

Commit a216967

Browse files
committed
feat: add development configuration for ObjectUI monorepo and update scripts for MSW and server modes
1 parent d68508c commit a216967

3 files changed

Lines changed: 56 additions & 6 deletions

File tree

apps/console/vite.config.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,5 +92,18 @@ export default defineConfig({
9292
}
9393
},
9494
server: {
95+
// Proxy API requests to the real ObjectStack server when running in server mode.
96+
// In MSW mode, MSW intercepts requests at the service worker level before they
97+
// reach the network, so these proxies are effectively bypassed.
98+
proxy: {
99+
'/api': {
100+
target: 'http://localhost:3000',
101+
changeOrigin: true,
102+
},
103+
'/.well-known/objectstack': {
104+
target: 'http://localhost:3000',
105+
changeOrigin: true,
106+
},
107+
},
95108
}
96109
});

objectstack.config.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/**
2+
* Root Development Configuration
3+
*
4+
* Aggregates all example apps for `pnpm serve` / `pnpm dev:server`.
5+
* This is NOT a deployable config — it's the monorepo dev entry point.
6+
*
7+
* Console supports two running modes:
8+
* - MSW: `pnpm dev` — Vite dev server with MSW intercepting API calls in browser
9+
* - Server: `pnpm dev:server` — Real ObjectStack API server + Vite console proxying to it
10+
*/
11+
import { defineStack } from '@objectstack/spec';
12+
import { AppPlugin, DriverPlugin } from '@objectstack/runtime';
13+
import { ObjectQLPlugin } from '@objectstack/objectql';
14+
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';
18+
19+
export default defineStack({
20+
manifest: {
21+
id: 'dev-workspace',
22+
name: 'dev_workspace',
23+
version: '0.0.0',
24+
description: 'ObjectUI monorepo development workspace',
25+
type: 'app',
26+
},
27+
plugins: [
28+
new ObjectQLPlugin(),
29+
new DriverPlugin(new InMemoryDriver()),
30+
new AppPlugin(CrmApp),
31+
new AppPlugin(TodoApp),
32+
new AppPlugin(KitchenSinkApp),
33+
],
34+
});

package.json

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,15 @@
4848
"shadcn:check": "node scripts/shadcn-sync.js --check",
4949
"shadcn:update": "node scripts/shadcn-sync.js --update",
5050
"shadcn:update-all": "node scripts/shadcn-sync.js --update-all --backup",
51-
"dev:mock": "pnpm --filter @object-ui/console dev",
52-
"start:hono": "pnpm --filter @object-ui/console start",
53-
"dev": "pnpm dev:mock",
54-
"start": "pnpm start:hono",
55-
"dev:console": "pnpm dev:mock",
56-
"start:console": "pnpm start:hono",
51+
"dev:msw": "pnpm --filter @object-ui/console dev",
52+
"dev:mock": "pnpm dev:msw",
53+
"serve": "tsx node_modules/@objectstack/cli/bin/objectstack.js serve",
54+
"dev:server": "concurrently -k -n api,console -c blue,green \"pnpm serve\" \"wait-on tcp:3000 && VITE_USE_MOCK_SERVER=false pnpm --filter @object-ui/console dev\"",
55+
"start:hono": "pnpm serve",
56+
"dev": "pnpm dev:msw",
57+
"start": "pnpm serve",
58+
"dev:console": "pnpm dev:msw",
59+
"start:console": "pnpm serve",
5760
"build:console:server": "pnpm --filter @object-ui/console build:server",
5861
"shadcn:diff": "node scripts/shadcn-sync.js --diff",
5962
"shadcn:list": "node scripts/shadcn-sync.js --list",

0 commit comments

Comments
 (0)