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:
YHH
2025-12-26 14:50:35 +08:00
committed by GitHub
parent a84ff902e4
commit 155411e743
1936 changed files with 4147 additions and 11578 deletions

View File

@@ -1,7 +1,7 @@
name: Release NPM Packages
on:
# 标签触发:支持 v* 和 {package}-v* 格式
# 标签触å<EFBFBD>:支æŒ?v* å’?{package}-v* æ ¼å¼<EFBFBD>
# Tag trigger: supports v* and {package}-v* formats
push:
tags:
@@ -20,7 +20,7 @@ on:
workflow_dispatch:
inputs:
package:
description: '选择要发布的包 | Select package to publish'
description: '选æ©è¦<EFBFBD>å<EFBFBD>布的åŒ?| Select package to publish'
required: true
type: choice
options:
@@ -65,7 +65,7 @@ jobs:
TAG="${GITHUB_REF#refs/tags/}"
echo "tag=$TAG" >> $GITHUB_OUTPUT
# 解析格式:v1.0.0 package-v1.0.0
# è§£æž<EFBFBD>æ ¼å¼<EFBFBD>:v1.0.0 æˆ?package-v1.0.0
# Parse format: v1.0.0 or package-v1.0.0
if [[ "$TAG" =~ ^v([0-9]+\.[0-9]+\.[0-9]+.*)$ ]]; then
PACKAGE="core"
@@ -85,7 +85,7 @@ jobs:
echo "📦 Package: $PACKAGE"
echo "📌 Version: $VERSION"
else
# 手动触发:从 package.json 读取并 bump 版本
# æ‰åŠ¨è§¦å<EFBFBD>:从 package.json 读å<C2BB>å¹?bump 版本
# Manual trigger: read from package.json and bump version
PACKAGE="${{ github.event.inputs.package }}"
echo "package=$PACKAGE" >> $GITHUB_OUTPUT
@@ -125,7 +125,7 @@ jobs:
exit 1
fi
echo "Version verified: $EXPECTED_VERSION"
echo "�Version verified: $EXPECTED_VERSION"
- name: Bump version (manual mode)
if: steps.parse.outputs.mode == 'manual'
@@ -147,7 +147,7 @@ jobs:
node -e "const fs=require('fs'); const pkg=JSON.parse(fs.readFileSync('package.json')); pkg.version='$NEW_VERSION'; fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2)+'\n')"
echo "version=$NEW_VERSION" >> $GITHUB_OUTPUT
echo "📌 Bumped version: $CURRENT $NEW_VERSION"
echo "📌 Bumped version: $CURRENT �$NEW_VERSION"
- name: Set final version
id: version
@@ -161,7 +161,7 @@ jobs:
- name: Build core package (if needed)
if: ${{ steps.parse.outputs.package != 'core' && steps.parse.outputs.package != 'node-editor' && steps.parse.outputs.package != 'worker-generator' }}
run: |
cd packages/core
cd packages/framework/core
pnpm run build
- name: Build node-editor package (if needed for blueprint)
@@ -188,8 +188,7 @@ jobs:
with:
tag_name: ${{ steps.parse.outputs.tag }}
name: "${{ steps.parse.outputs.package }} v${{ steps.version.outputs.value }}"
# 不设置为 latestlatest 保留给编辑器热更新使用
# Don't mark as latest, reserve latest for editor auto-update
# ä¸<EFBFBD>设置为 latest,latest ä¿<C3A4>留给ç¼è¾å™¨çƒ­æ´æ°ä½¿ç”? # Don't mark as latest, reserve latest for editor auto-update
make_latest: false
body: |
## 🚀 @esengine/${{ steps.parse.outputs.package }} v${{ steps.version.outputs.value }}
@@ -218,14 +217,13 @@ jobs:
body: |
## 🚀 Release v${{ steps.version.outputs.value }}
此 PR 更新 `@esengine/${{ steps.parse.outputs.package }}` 包的版本号
æ­?PR æ›´æ–° `@esengine/${{ steps.parse.outputs.package }}` 包的版本å<EFBFBD>?
### å<>˜æ´
- ✅ 已发布到 npm: [@esengine/${{ steps.parse.outputs.package }}@${{ steps.version.outputs.value }}](https://www.npmjs.com/package/@esengine/${{ steps.parse.outputs.package }}/v/${{ steps.version.outputs.value }})
- ✅ 更新 `packages/${{ steps.parse.outputs.package }}/package.json` `${{ steps.version.outputs.value }}`
- âœ?å·²å<C2B2>布到 npm: [@esengine/${{ steps.parse.outputs.package }}@${{ steps.version.outputs.value }}](https://www.npmjs.com/package/@esengine/${{ steps.parse.outputs.package }}/v/${{ steps.version.outputs.value }})
- �更新 `packages/${{ steps.parse.outputs.package }}/package.json` �`${{ steps.version.outputs.value }}`
---
*此 PR 由发布工作流自动创建*
*æ­?PR ç”±å<C2B1>布工作æµ<C3A6>自动åˆå»º*
labels: |
release
${{ steps.parse.outputs.package }}