使用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",
|
||||
"description": "用于Laya、Cocos Creator等JavaScript游戏引擎的高性能ECS框架",
|
||||
"main": "bin/index.js",
|
||||
"types": "bin/index.d.ts",
|
||||
"bin": {
|
||||
"ecs-proto": "./bin/ecs-proto"
|
||||
},
|
||||
"files": [
|
||||
"bin/**/*",
|
||||
"README.md",
|
||||
"LICENSE"
|
||||
"description": "ECS Framework Monorepo - 高性能ECS框架及其网络插件",
|
||||
"private": true,
|
||||
"workspaces": [
|
||||
"packages/*"
|
||||
],
|
||||
"keywords": [
|
||||
"ecs",
|
||||
@@ -22,27 +16,22 @@
|
||||
"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 scripts/build-rollup.js",
|
||||
"preversion": "npm run rebuild",
|
||||
"publish:patch": "npm version patch && npm run build:npm && cd dist && npm publish",
|
||||
"publish:minor": "npm version minor && npm run build:npm && cd dist && npm publish",
|
||||
"publish:major": "npm version major && npm run build:npm && cd dist && npm publish",
|
||||
"publish:npm": "npm run build:npm && cd dist && npm publish",
|
||||
"test": "jest",
|
||||
"test:watch": "jest --watch",
|
||||
"test:performance": "jest --config jest.performance.config.js",
|
||||
"test:coverage": "jest --coverage",
|
||||
"test:ci": "jest --ci --coverage",
|
||||
"test:clear": "jest --clearCache",
|
||||
"proto:generate": "ecs-proto generate",
|
||||
"proto:compile": "ecs-proto compile",
|
||||
"proto:build": "ecs-proto build"
|
||||
"bootstrap": "lerna bootstrap",
|
||||
"clean": "lerna run clean",
|
||||
"build": "npm run build:core && npm run build:network",
|
||||
"build:core": "cd packages/core && npm run build",
|
||||
"build:network": "cd packages/network && npm run build",
|
||||
"build:npm": "npm run build:npm:core && npm run build:npm:network",
|
||||
"build:npm:core": "cd packages/core && npm run build:npm",
|
||||
"build:npm:network": "cd packages/network && npm run build:npm",
|
||||
"test": "lerna run test",
|
||||
"test:coverage": "lerna run test:coverage",
|
||||
"test:ci": "lerna run test:ci",
|
||||
"prepare:publish": "npm run build:npm && node scripts/pre-publish-check.cjs",
|
||||
"sync:versions": "node scripts/sync-versions.cjs",
|
||||
"publish:all": "npm run prepare:publish && lerna publish",
|
||||
"publish": "lerna publish",
|
||||
"version": "lerna version"
|
||||
},
|
||||
"author": "yhh",
|
||||
"license": "MIT",
|
||||
@@ -54,9 +43,11 @@
|
||||
"@types/node": "^20.19.0",
|
||||
"jest": "^29.7.0",
|
||||
"jest-environment-jsdom": "^29.7.0",
|
||||
"lerna": "^8.1.8",
|
||||
"rimraf": "^5.0.0",
|
||||
"rollup": "^4.42.0",
|
||||
"rollup-plugin-dts": "^6.2.1",
|
||||
"semver": "^7.6.3",
|
||||
"ts-jest": "^29.4.0",
|
||||
"typescript": "^5.8.3"
|
||||
},
|
||||
|
||||
@@ -14,7 +14,7 @@ async function main() {
|
||||
|
||||
// 执行Rollup构建
|
||||
console.log('📦 执行 Rollup 构建...');
|
||||
execSync('rollup -c', { stdio: 'inherit' });
|
||||
execSync('rollup -c rollup.config.cjs', { stdio: 'inherit' });
|
||||
|
||||
// 生成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 {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 避免循环引用,在文件末尾导入Entity
|
||||
@@ -5,3 +5,4 @@ export { IdentifierPool } from './IdentifierPool';
|
||||
export { Matcher } from './Matcher';
|
||||
export { Bits } from './Bits';
|
||||
export { ComponentTypeManager } from './ComponentTypeManager';
|
||||
export { BigIntFactory } from './BigIntCompatibility';
|
||||
@@ -3,6 +3,5 @@ export * from './Pool';
|
||||
export * from './Emitter';
|
||||
export * from './GlobalManager';
|
||||
export * from './PerformanceMonitor';
|
||||
export * from './Serialization';
|
||||
export { Time } from './Time';
|
||||
export * from './Debug';
|
||||
@@ -19,6 +19,3 @@ export * from './ECS';
|
||||
// 工具类和类型定义
|
||||
export * from './Utils';
|
||||
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