Files
makemd/check-services.js
wurenzhi 2748456d8a refactor(services): 重构服务文件结构,将服务按功能分类到不同目录
- 将服务文件按功能分类到core、ai、analytics、security等目录
- 修复logger导入路径问题,统一使用相对路径
- 更新相关文件的导入路径引用
- 添加新的批量操作组件导出文件
- 修复dashboard页面中的类型错误
- 添加dotenv依赖到package.json
2026-03-25 13:46:26 +08:00

39 lines
1.3 KiB
JavaScript

const fs = require('fs');
const path = require('path');
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');
const domainBootstrapContent = fs.readFileSync(domainBootstrapPath, 'utf8');
const serviceNames = [];
const regex = /name:\s*'([^']+)'/g;
let match;
while ((match = regex.exec(serviceConfigContent)) !== null) {
serviceNames.push(match[1]);
}
console.log(`Total services in SERVICE_CONFIGS: ${serviceNames.length}`);
const registeredServices = [];
const registerRegex = /name:\s*'([^']+)'/g;
let registerMatch;
while ((registerMatch = registerRegex.exec(domainBootstrapContent)) !== null) {
registeredServices.push(registerMatch[1]);
}
console.log(`Total services in DomainBootstrap: ${registeredServices.length}`);
const missingServices = serviceNames.filter(name => !registeredServices.includes(name));
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}`));