Files
makemd/check-services.js

39 lines
1.3 KiB
JavaScript
Raw Normal View History

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}`));