fix: monorepo build order

This commit is contained in:
Simon
2025-12-05 17:02:30 +08:00
parent 683602bb6b
commit 20f33ac478
5 changed files with 58 additions and 16 deletions

View File

@@ -41,10 +41,7 @@ npm run build --workspace=@page-agent/website
We adopt a very simple monorepo solution: ts reference + vite alias.
We use the same vite config for dev and bundling. Local packages (even when they are published to npm) will be bundled into artifacts instead of installed from npm.
That is why we put local packages in devDependencies (with version "*") rather than dependencies.
You must update relative tsconfig and vite config if you add/remove/rename a package.
You must update tsconfig and vite config if you add/remove/rename a package.
```bash
packages/
@@ -69,6 +66,17 @@ packages/
└── dom/ # DOM tree extraction
```
`workspaces` must be written in topological order to guarantee build order.
```json
"workspaces": [
// internal deps ...
"packages/page-controller",
"packages/page-agent",
"packages/website"
],
```
### Module Boundaries (Critical)
- **Website** (`packages/website/`): CAN import from `page-agent` for demos. Alias `@/``website/src/`
@@ -143,7 +151,6 @@ Query params configure `PageAgentConfig` automatically in `src/entry.ts`.
| `src/utils/bus.ts` | Type-safe event bus for decoupled communication |
| `src/ui/` | UI components (Panel, SimulatorMask) with CSS modules |
| `src/llms/` | LLM integration and communication layer |
| `src/patches/` | Framework-specific optimizations (React, Antd) |
| `vite.config.js` | Library build configuration (ES + UMD) |
### Page Controller (`packages/page-controller/`)
@@ -154,6 +161,7 @@ Query params configure `PageAgentConfig` automatically in `src/entry.ts`.
| `src/actions.ts` | Element interaction implementations (click, input, scroll) |
| `src/dom/dom_tree/index.js` | Core DOM extraction engine (ported from browser-use) |
| `src/dom/getPageInfo.ts` | Page scroll/size information |
| `src/patches/` | Framework-specific optimizations (React, Antd) |
| `src/types.ts` | TypeScript interfaces for controller |
### Website (`packages/website/`)