refactor(types): move shared types from renderer to shared directory
- Move type definitions from src/renderer/src/types/ to src/shared/types/ - Add @shared/* path alias to tsconfig.node.json and tsconfig.web.json - Update all imports from @renderer/types/* to @shared/types/* - Update AGENTS.md with new directory structure and path alias This fixes architecture violation where main/preload processes imported from renderer directory. Types are now properly shared across all processes.
This commit is contained in:
@@ -38,13 +38,14 @@ src/
|
||||
├── preload/ # Preload 脚本
|
||||
│ ├── index.ts # 暴露 API 到渲染进程
|
||||
│ └── index.d.ts # 类型声明
|
||||
├── shared/ # 跨进程共享代码
|
||||
│ └── types/ # 共享类型定义
|
||||
└── renderer/ # React 渲染进程
|
||||
└── src/
|
||||
├── main.tsx # React 入口
|
||||
├── App.tsx # 根组件
|
||||
├── components/ # React 组件
|
||||
├── stores/ # Zustand Stores
|
||||
└── types/ # TypeScript 类型
|
||||
└── stores/ # Zustand Stores
|
||||
```
|
||||
|
||||
## 3. 路径别名
|
||||
@@ -54,7 +55,7 @@ src/
|
||||
| `@renderer/*` | `src/renderer/src/*` |
|
||||
| `@main/*` | `src/main/*` |
|
||||
| `@preload/*` | `src/preload/*` |
|
||||
|
||||
| `@shared/*` | `src/shared/*` |
|
||||
## 4. 代码风格
|
||||
|
||||
### 导入顺序
|
||||
|
||||
Reference in New Issue
Block a user