- 删除无用的文件和错误日志 - 创建统一的 imports 模块集中管理依赖 - 重构组件使用新的 imports 方式 - 修复文档路径大小写问题 - 优化类型定义和接口导出 - 更新依赖版本 - 改进错误处理和API配置 - 统一组件导出方式
50 lines
1.9 KiB
JavaScript
50 lines
1.9 KiB
JavaScript
const fs = require('fs');
|
||
const path = require('path');
|
||
|
||
// 读取serviceConfig.ts文件
|
||
const serviceConfigPath = path.join(__dirname, 'server/src/config/serviceConfig.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');
|
||
|
||
// 从serviceConfig.ts中提取服务名称
|
||
const serviceNameRegex = /name: '([^']+)'/g;
|
||
const serviceConfigs = [];
|
||
let match;
|
||
while ((match = serviceNameRegex.exec(serviceConfigContent)) !== null) {
|
||
serviceConfigs.push(match[1]);
|
||
}
|
||
|
||
// 从DomainBootstrap.ts中提取注册的服务名称
|
||
const registeredServiceRegex = /name: '([^']+)'/g;
|
||
const registeredServices = [];
|
||
let registeredMatch;
|
||
while ((registeredMatch = registeredServiceRegex.exec(domainBootstrapContent)) !== null) {
|
||
registeredServices.push(registeredMatch[1]);
|
||
}
|
||
|
||
// 找出未注册的服务
|
||
const unregisteredServices = serviceConfigs.filter(service => !registeredServices.includes(service));
|
||
|
||
// 找出多余注册的服务(在DomainBootstrap中注册但不在serviceConfig中定义的服务)
|
||
const extraRegisteredServices = registeredServices.filter(service => !serviceConfigs.includes(service));
|
||
|
||
// 输出结果
|
||
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('没有多余注册的服务');
|
||
}
|