使用Lerna 和 monorepo管理项目结构
This commit is contained in:
@@ -1,27 +0,0 @@
|
|||||||
/** @type {import('ts-jest').JestConfigWithTsJest} */
|
|
||||||
module.exports = {
|
|
||||||
preset: 'ts-jest',
|
|
||||||
testEnvironment: 'node',
|
|
||||||
roots: ['<rootDir>/tests'],
|
|
||||||
testMatch: ['**/*.performance.test.ts'],
|
|
||||||
collectCoverage: false,
|
|
||||||
verbose: true,
|
|
||||||
transform: {
|
|
||||||
'^.+\\.tsx?$': ['ts-jest', {
|
|
||||||
tsconfig: 'tsconfig.test.json',
|
|
||||||
}],
|
|
||||||
},
|
|
||||||
moduleNameMapper: {
|
|
||||||
'^@/(.*)$': '<rootDir>/src/$1',
|
|
||||||
},
|
|
||||||
setupFilesAfterEnv: ['<rootDir>/tests/setup.ts'],
|
|
||||||
// 性能测试需要更长的超时时间
|
|
||||||
testTimeout: 60000,
|
|
||||||
clearMocks: true,
|
|
||||||
restoreMocks: true,
|
|
||||||
modulePathIgnorePatterns: [
|
|
||||||
'<rootDir>/bin/',
|
|
||||||
'<rootDir>/dist/',
|
|
||||||
'<rootDir>/node_modules/'
|
|
||||||
]
|
|
||||||
};
|
|
||||||
25
lerna.json
Normal file
25
lerna.json
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
{
|
||||||
|
"version": "independent",
|
||||||
|
"npmClient": "npm",
|
||||||
|
"command": {
|
||||||
|
"publish": {
|
||||||
|
"registry": "https://registry.npmjs.org/",
|
||||||
|
"allowBranch": ["master", "main"],
|
||||||
|
"conventionalCommits": true,
|
||||||
|
"message": "chore(release): publish packages",
|
||||||
|
"topologicalSort": true,
|
||||||
|
"verifyAccess": true,
|
||||||
|
"verifyRegistry": true
|
||||||
|
},
|
||||||
|
"version": {
|
||||||
|
"allowBranch": ["master", "main"],
|
||||||
|
"conventionalCommits": true,
|
||||||
|
"message": "chore(release): version packages",
|
||||||
|
"push": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"packages": [
|
||||||
|
"packages/*"
|
||||||
|
],
|
||||||
|
"useWorkspaces": true
|
||||||
|
}
|
||||||
5924
package-lock.json
generated
5924
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
55
package.json
55
package.json
@@ -1,16 +1,10 @@
|
|||||||
{
|
{
|
||||||
"name": "@esengine/ecs-framework",
|
"name": "@esengine/ecs-framework-monorepo",
|
||||||
"version": "2.1.29",
|
"version": "2.1.29",
|
||||||
"description": "用于Laya、Cocos Creator等JavaScript游戏引擎的高性能ECS框架",
|
"description": "ECS Framework Monorepo - 高性能ECS框架及其网络插件",
|
||||||
"main": "bin/index.js",
|
"private": true,
|
||||||
"types": "bin/index.d.ts",
|
"workspaces": [
|
||||||
"bin": {
|
"packages/*"
|
||||||
"ecs-proto": "./bin/ecs-proto"
|
|
||||||
},
|
|
||||||
"files": [
|
|
||||||
"bin/**/*",
|
|
||||||
"README.md",
|
|
||||||
"LICENSE"
|
|
||||||
],
|
],
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"ecs",
|
"ecs",
|
||||||
@@ -22,27 +16,22 @@
|
|||||||
"egret"
|
"egret"
|
||||||
],
|
],
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"clean": "rimraf bin dist",
|
"bootstrap": "lerna bootstrap",
|
||||||
"build:ts": "tsc",
|
"clean": "lerna run clean",
|
||||||
"prebuild": "npm run clean",
|
"build": "npm run build:core && npm run build:network",
|
||||||
"build": "npm run build:ts",
|
"build:core": "cd packages/core && npm run build",
|
||||||
"build:watch": "tsc --watch",
|
"build:network": "cd packages/network && npm run build",
|
||||||
"rebuild": "npm run clean && npm run build",
|
"build:npm": "npm run build:npm:core && npm run build:npm:network",
|
||||||
"build:npm": "npm run build && node scripts/build-rollup.js",
|
"build:npm:core": "cd packages/core && npm run build:npm",
|
||||||
"preversion": "npm run rebuild",
|
"build:npm:network": "cd packages/network && npm run build:npm",
|
||||||
"publish:patch": "npm version patch && npm run build:npm && cd dist && npm publish",
|
"test": "lerna run test",
|
||||||
"publish:minor": "npm version minor && npm run build:npm && cd dist && npm publish",
|
"test:coverage": "lerna run test:coverage",
|
||||||
"publish:major": "npm version major && npm run build:npm && cd dist && npm publish",
|
"test:ci": "lerna run test:ci",
|
||||||
"publish:npm": "npm run build:npm && cd dist && npm publish",
|
"prepare:publish": "npm run build:npm && node scripts/pre-publish-check.cjs",
|
||||||
"test": "jest",
|
"sync:versions": "node scripts/sync-versions.cjs",
|
||||||
"test:watch": "jest --watch",
|
"publish:all": "npm run prepare:publish && lerna publish",
|
||||||
"test:performance": "jest --config jest.performance.config.js",
|
"publish": "lerna publish",
|
||||||
"test:coverage": "jest --coverage",
|
"version": "lerna version"
|
||||||
"test:ci": "jest --ci --coverage",
|
|
||||||
"test:clear": "jest --clearCache",
|
|
||||||
"proto:generate": "ecs-proto generate",
|
|
||||||
"proto:compile": "ecs-proto compile",
|
|
||||||
"proto:build": "ecs-proto build"
|
|
||||||
},
|
},
|
||||||
"author": "yhh",
|
"author": "yhh",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
@@ -54,9 +43,11 @@
|
|||||||
"@types/node": "^20.19.0",
|
"@types/node": "^20.19.0",
|
||||||
"jest": "^29.7.0",
|
"jest": "^29.7.0",
|
||||||
"jest-environment-jsdom": "^29.7.0",
|
"jest-environment-jsdom": "^29.7.0",
|
||||||
|
"lerna": "^8.1.8",
|
||||||
"rimraf": "^5.0.0",
|
"rimraf": "^5.0.0",
|
||||||
"rollup": "^4.42.0",
|
"rollup": "^4.42.0",
|
||||||
"rollup-plugin-dts": "^6.2.1",
|
"rollup-plugin-dts": "^6.2.1",
|
||||||
|
"semver": "^7.6.3",
|
||||||
"ts-jest": "^29.4.0",
|
"ts-jest": "^29.4.0",
|
||||||
"typescript": "^5.8.3"
|
"typescript": "^5.8.3"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ async function main() {
|
|||||||
|
|
||||||
// 执行Rollup构建
|
// 执行Rollup构建
|
||||||
console.log('📦 执行 Rollup 构建...');
|
console.log('📦 执行 Rollup 构建...');
|
||||||
execSync('rollup -c', { stdio: 'inherit' });
|
execSync('rollup -c rollup.config.cjs', { stdio: 'inherit' });
|
||||||
|
|
||||||
// 生成package.json
|
// 生成package.json
|
||||||
console.log('📋 生成 package.json...');
|
console.log('📋 生成 package.json...');
|
||||||
63
packages/core/package.json
Normal file
63
packages/core/package.json
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
{
|
||||||
|
"name": "@esengine/ecs-framework",
|
||||||
|
"version": "2.1.29",
|
||||||
|
"description": "用于Laya、Cocos Creator等JavaScript游戏引擎的高性能ECS框架",
|
||||||
|
"type": "module",
|
||||||
|
"main": "bin/index.js",
|
||||||
|
"types": "bin/index.d.ts",
|
||||||
|
"files": [
|
||||||
|
"bin/**/*",
|
||||||
|
"README.md",
|
||||||
|
"LICENSE"
|
||||||
|
],
|
||||||
|
"keywords": [
|
||||||
|
"ecs",
|
||||||
|
"entity-component-system",
|
||||||
|
"game-engine",
|
||||||
|
"typescript",
|
||||||
|
"laya",
|
||||||
|
"cocos",
|
||||||
|
"egret"
|
||||||
|
],
|
||||||
|
"scripts": {
|
||||||
|
"clean": "rimraf bin dist",
|
||||||
|
"build:ts": "tsc",
|
||||||
|
"prebuild": "npm run clean",
|
||||||
|
"build": "npm run build:ts",
|
||||||
|
"build:watch": "tsc --watch",
|
||||||
|
"rebuild": "npm run clean && npm run build",
|
||||||
|
"build:npm": "npm run build && node build-rollup.cjs",
|
||||||
|
"preversion": "npm run rebuild",
|
||||||
|
"test": "jest --config jest.config.cjs",
|
||||||
|
"test:watch": "jest --watch --config jest.config.cjs",
|
||||||
|
"test:performance": "jest --config jest.performance.config.cjs",
|
||||||
|
"test:coverage": "jest --coverage --config jest.config.cjs",
|
||||||
|
"test:ci": "jest --ci --coverage --config jest.config.cjs",
|
||||||
|
"test:clear": "jest --clearCache"
|
||||||
|
},
|
||||||
|
"author": "yhh",
|
||||||
|
"license": "MIT",
|
||||||
|
"devDependencies": {
|
||||||
|
"@rollup/plugin-commonjs": "^28.0.3",
|
||||||
|
"@rollup/plugin-node-resolve": "^16.0.1",
|
||||||
|
"@rollup/plugin-terser": "^0.4.4",
|
||||||
|
"@types/jest": "^29.5.14",
|
||||||
|
"@types/node": "^20.19.0",
|
||||||
|
"jest": "^29.7.0",
|
||||||
|
"jest-environment-jsdom": "^29.7.0",
|
||||||
|
"rimraf": "^5.0.0",
|
||||||
|
"rollup": "^4.42.0",
|
||||||
|
"rollup-plugin-dts": "^6.2.1",
|
||||||
|
"ts-jest": "^29.4.0",
|
||||||
|
"typescript": "^5.8.3"
|
||||||
|
},
|
||||||
|
"publishConfig": {
|
||||||
|
"access": "public",
|
||||||
|
"registry": "https://registry.npmjs.org/"
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/esengine/ecs-framework.git",
|
||||||
|
"directory": "packages/core"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -152,6 +152,7 @@ export abstract class Component implements IComponent {
|
|||||||
*/
|
*/
|
||||||
public update(): void {
|
public update(): void {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 避免循环引用,在文件末尾导入Entity
|
// 避免循环引用,在文件末尾导入Entity
|
||||||
@@ -4,4 +4,5 @@ export { EntityProcessorList } from './EntityProcessorList';
|
|||||||
export { IdentifierPool } from './IdentifierPool';
|
export { IdentifierPool } from './IdentifierPool';
|
||||||
export { Matcher } from './Matcher';
|
export { Matcher } from './Matcher';
|
||||||
export { Bits } from './Bits';
|
export { Bits } from './Bits';
|
||||||
export { ComponentTypeManager } from './ComponentTypeManager';
|
export { ComponentTypeManager } from './ComponentTypeManager';
|
||||||
|
export { BigIntFactory } from './BigIntCompatibility';
|
||||||
@@ -3,6 +3,5 @@ export * from './Pool';
|
|||||||
export * from './Emitter';
|
export * from './Emitter';
|
||||||
export * from './GlobalManager';
|
export * from './GlobalManager';
|
||||||
export * from './PerformanceMonitor';
|
export * from './PerformanceMonitor';
|
||||||
export * from './Serialization';
|
|
||||||
export { Time } from './Time';
|
export { Time } from './Time';
|
||||||
export * from './Debug';
|
export * from './Debug';
|
||||||
@@ -18,7 +18,4 @@ export * from './ECS';
|
|||||||
|
|
||||||
// 工具类和类型定义
|
// 工具类和类型定义
|
||||||
export * from './Utils';
|
export * from './Utils';
|
||||||
export * from './Types';
|
export * from './Types';
|
||||||
|
|
||||||
// 快照系统(可选模块)
|
|
||||||
export * from './Utils/Snapshot';
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user