refactor: reorganize package structure and decouple framework packages (#338)
* refactor: reorganize package structure and decouple framework packages ## Package Structure Reorganization - Reorganized 55 packages into categorized subdirectories: - packages/framework/ - Generic framework (Laya/Cocos compatible) - packages/engine/ - ESEngine core modules - packages/rendering/ - Rendering modules (WASM dependent) - packages/physics/ - Physics modules - packages/streaming/ - World streaming - packages/network-ext/ - Network extensions - packages/editor/ - Editor framework and plugins - packages/rust/ - Rust WASM engine - packages/tools/ - Build tools and SDK ## Framework Package Decoupling - Decoupled behavior-tree and blueprint packages from ESEngine dependencies - Created abstracted interfaces (IBTAssetManager, IBehaviorTreeAssetContent) - ESEngine-specific code moved to esengine/ subpath exports - Framework packages now usable with Cocos/Laya without ESEngine ## CI Configuration - Updated CI to only type-check and lint framework packages - Added type-check:framework and lint:framework scripts ## Breaking Changes - Package import paths changed due to directory reorganization - ESEngine integrations now use subpath imports (e.g., '@esengine/behavior-tree/esengine') * fix: update es-engine file path after directory reorganization * docs: update README to focus on framework over engine * ci: only build framework packages, remove Rust/WASM dependencies * fix: remove esengine subpath from behavior-tree and blueprint builds ESEngine integration code will only be available in full engine builds. Framework packages are now purely engine-agnostic. * fix: move network-protocols to framework, build both in CI * fix: update workflow paths from packages/core to packages/framework/core * fix: exclude esengine folder from type-check in behavior-tree and blueprint * fix: update network tsconfig references to new paths * fix: add test:ci:framework to only test framework packages in CI * fix: only build core and math npm packages in CI * fix: exclude test files from CodeQL and fix string escaping security issue
This commit is contained in:
90
packages/tools/build-config/src/index.ts
Normal file
90
packages/tools/build-config/src/index.ts
Normal file
@@ -0,0 +1,90 @@
|
||||
/**
|
||||
* @esengine/build-config
|
||||
*
|
||||
* 统一构建配置包,提供标准化的 Vite 配置预设和共享插件
|
||||
* Unified build configuration with standardized Vite presets and shared plugins
|
||||
*
|
||||
* @example
|
||||
* ```typescript
|
||||
* // 1. 纯运行时包 (core, math, components)
|
||||
* import { runtimeOnlyPreset } from '@esengine/build-config/presets';
|
||||
* export default runtimeOnlyPreset({ root: __dirname });
|
||||
*
|
||||
* // 2. 插件包 (ui, tilemap, behavior-tree)
|
||||
* import { pluginPreset } from '@esengine/build-config/presets';
|
||||
* export default pluginPreset({
|
||||
* root: __dirname,
|
||||
* hasCSS: true
|
||||
* });
|
||||
*
|
||||
* // 3. 纯编辑器包 (editor-core, node-editor)
|
||||
* import { editorOnlyPreset } from '@esengine/build-config/presets';
|
||||
* export default editorOnlyPreset({
|
||||
* root: __dirname,
|
||||
* hasReact: true
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* ## 包类型说明
|
||||
*
|
||||
* | 类型 | 说明 | 示例 |
|
||||
* |------|------|------|
|
||||
* | RuntimeOnly | 纯运行时库,不含编辑器代码 | core, math, components |
|
||||
* | Plugin | 插件包,同时有 runtime 和 editor 入口 | ui, tilemap, behavior-tree |
|
||||
* | EditorOnly | 纯编辑器包,仅用于编辑器 | editor-core, node-editor |
|
||||
*
|
||||
* ## 目录结构约定
|
||||
*
|
||||
* ### RuntimeOnly 包
|
||||
* ```
|
||||
* packages/my-lib/
|
||||
* ├── src/
|
||||
* │ └── index.ts # 主入口
|
||||
* ├── vite.config.ts
|
||||
* └── package.json
|
||||
* ```
|
||||
*
|
||||
* ### Plugin 包
|
||||
* ```
|
||||
* packages/my-plugin/
|
||||
* ├── src/
|
||||
* │ ├── index.ts # 主入口(编辑器环境)
|
||||
* │ ├── runtime.ts # 运行时入口(不含 React)
|
||||
* │ └── editor/
|
||||
* │ └── index.ts # 编辑器模块
|
||||
* ├── plugin.json # 插件描述文件
|
||||
* ├── vite.config.ts
|
||||
* └── package.json
|
||||
* ```
|
||||
*
|
||||
* ### EditorOnly 包
|
||||
* ```
|
||||
* packages/my-editor-tool/
|
||||
* ├── src/
|
||||
* │ └── index.ts # 主入口
|
||||
* ├── vite.config.ts
|
||||
* └── package.json
|
||||
* ```
|
||||
*/
|
||||
|
||||
// Types
|
||||
export { EPackageType, STANDARD_EXTERNALS, EDITOR_ONLY_EXTERNALS } from './types';
|
||||
export type { PackageBuildConfig } from './types';
|
||||
|
||||
// Presets
|
||||
export {
|
||||
runtimeOnlyPreset,
|
||||
pluginPreset,
|
||||
standaloneRuntimeConfig,
|
||||
editorOnlyPreset
|
||||
} from './presets';
|
||||
export type {
|
||||
RuntimeOnlyOptions,
|
||||
PluginPackageOptions,
|
||||
StandaloneRuntimeOptions,
|
||||
EditorOnlyOptions
|
||||
} from './presets';
|
||||
|
||||
// Plugins
|
||||
export { cssInjectPlugin, blockEditorPlugin } from './plugins';
|
||||
export type { BlockEditorOptions } from './plugins';
|
||||
Reference in New Issue
Block a user