refactor: 重构项目结构并优化代码

- 删除无用的文件和错误日志
- 创建统一的 imports 模块集中管理依赖
- 重构组件使用新的 imports 方式
- 修复文档路径大小写问题
- 优化类型定义和接口导出
- 更新依赖版本
- 改进错误处理和API配置
- 统一组件导出方式
This commit is contained in:
2026-03-27 16:56:06 +08:00
parent 2748456d8a
commit 22308fe042
337 changed files with 37060 additions and 57483 deletions

View File

@@ -1,38 +1,49 @@
const fs = require('fs');
const path = require('path');
// 读取serviceConfig.ts文件
const serviceConfigPath = path.join(__dirname, 'server/src/config/serviceConfig.ts');
const domainBootstrapPath = path.join(__dirname, 'server/src/core/runtime/DomainBootstrap.ts');
const serviceConfigContent = fs.readFileSync(serviceConfigPath, 'utf8');
// 读取DomainBootstrap.ts文件
const domainBootstrapPath = path.join(__dirname, 'server/src/core/runtime/DomainBootstrap.ts');
const domainBootstrapContent = fs.readFileSync(domainBootstrapPath, 'utf8');
const serviceNames = [];
const regex = /name:\s*'([^']+)'/g;
// 从serviceConfig.ts中提取服务名称
const serviceNameRegex = /name: '([^']+)'/g;
const serviceConfigs = [];
let match;
while ((match = regex.exec(serviceConfigContent)) !== null) {
serviceNames.push(match[1]);
while ((match = serviceNameRegex.exec(serviceConfigContent)) !== null) {
serviceConfigs.push(match[1]);
}
console.log(`Total services in SERVICE_CONFIGS: ${serviceNames.length}`);
// 从DomainBootstrap.ts中提取注册的服务名称
const registeredServiceRegex = /name: '([^']+)'/g;
const registeredServices = [];
const registerRegex = /name:\s*'([^']+)'/g;
let registerMatch;
while ((registerMatch = registerRegex.exec(domainBootstrapContent)) !== null) {
registeredServices.push(registerMatch[1]);
let registeredMatch;
while ((registeredMatch = registeredServiceRegex.exec(domainBootstrapContent)) !== null) {
registeredServices.push(registeredMatch[1]);
}
console.log(`Total services in DomainBootstrap: ${registeredServices.length}`);
// 找出未注册的服务
const unregisteredServices = serviceConfigs.filter(service => !registeredServices.includes(service));
const missingServices = serviceNames.filter(name => !registeredServices.includes(name));
// 找出多余注册的服务在DomainBootstrap中注册但不在serviceConfig中定义的服务
const extraRegisteredServices = registeredServices.filter(service => !serviceConfigs.includes(service));
console.log('\nMissing services in DomainBootstrap:');
missingServices.forEach(name => console.log(` - ${name}`));
const extraServices = registeredServices.filter(name => !serviceNames.includes(name));
console.log('\nExtra services in DomainBootstrap (not in SERVICE_CONFIGS):');
extraServices.forEach(name => console.log(` - ${name}`));
// 输出结果
console.log('=== 服务注册一致性检查 ===');
console.log(`ServiceConfig中定义的服务数量: ${serviceConfigs.length}`);
console.log(`DomainBootstrap中注册的服务数量: ${registeredServices.length}`);
console.log('\n=== 未注册的服务 ===');
if (unregisteredServices.length > 0) {
console.log(unregisteredServices.join('\n'));
} else {
console.log('所有服务都已注册');
}
console.log('\n=== 多余注册的服务 ===');
if (extraRegisteredServices.length > 0) {
console.log(extraRegisteredServices.join('\n'));
} else {
console.log('没有多余注册的服务');
}