74 lines
2.6 KiB
JavaScript
74 lines
2.6 KiB
JavaScript
const fs = require('fs');
|
|
|
|
const cDriveFile = 'C:\\system-templates.json';
|
|
const projectFile = 'packaging/resources/common/config/system-templates.json';
|
|
|
|
const cConfig = JSON.parse(fs.readFileSync(cDriveFile, 'utf-8'));
|
|
const pConfig = JSON.parse(fs.readFileSync(projectFile, 'utf-8'));
|
|
|
|
const cTemplates = cConfig.subtitleTemplates || [];
|
|
const pTemplates = pConfig.subtitleTemplates || [];
|
|
|
|
console.log('=== C盘配置 vs 项目配置对比 ===\n');
|
|
|
|
cTemplates.forEach(cTemplate => {
|
|
const pTemplate = pTemplates.find(t => t.id === cTemplate.id);
|
|
if (!pTemplate) {
|
|
console.log(`模板 ${cTemplate.name}: 在项目配置中不存在`);
|
|
return;
|
|
}
|
|
|
|
const cTitle = cTemplate.config && cTemplate.config.titleSubtitleConfig;
|
|
const pTitle = pTemplate.config && pTemplate.config.titleSubtitleConfig;
|
|
|
|
if (!cTitle || !pTitle) {
|
|
console.log(`模板 ${cTemplate.name}: 标题配置缺失 (C盘: ${!!cTitle}, 项目: ${!!pTitle})`);
|
|
return;
|
|
}
|
|
|
|
const cKey = `${cTitle.maxCharsPerLine}-${cTitle.lines.length}-${cTitle.lines.map(l => l.text).join('|')}`;
|
|
const pKey = `${pTitle.maxCharsPerLine}-${pTitle.lines.length}-${pTitle.lines.map(l => l.text).join('|')}`;
|
|
|
|
if (cKey === pKey) {
|
|
console.log(`模板 ${cTemplate.name}: 标题配置相同 (${cTitle.maxCharsPerLine}字符/行, ${cTitle.lines.length}行)`);
|
|
} else {
|
|
console.log(`模板 ${cTemplate.name}: 标题配置不同`);
|
|
console.log(` C盘: ${cTitle.maxCharsPerLine}字符/行, ${cTitle.lines.length}行`);
|
|
console.log(` 项目: ${pTitle.maxCharsPerLine}字符/行, ${pTitle.lines.length}行`);
|
|
}
|
|
});
|
|
|
|
console.log('\n=== 相同配置的模板组 (C盘) ===\n');
|
|
const cGroups = {};
|
|
cTemplates.forEach(t => {
|
|
const title = t.config && t.config.titleSubtitleConfig;
|
|
if (title && title.lines) {
|
|
const key = `${title.maxCharsPerLine}-${title.lines.length}-${title.lines.map(l => l.text).join('|')}`;
|
|
if (!cGroups[key]) cGroups[key] = [];
|
|
cGroups[key].push(t.name);
|
|
}
|
|
});
|
|
|
|
Object.keys(cGroups).forEach(key => {
|
|
if (cGroups[key].length > 1) {
|
|
console.log(`模板 ${cGroups[key].join(', ')} 配置相同`);
|
|
}
|
|
});
|
|
|
|
console.log('\n=== 相同配置的模板组 (项目) ===\n');
|
|
const pGroups = {};
|
|
pTemplates.forEach(t => {
|
|
const title = t.config && t.config.titleSubtitleConfig;
|
|
if (title && title.lines) {
|
|
const key = `${title.maxCharsPerLine}-${title.lines.length}-${title.lines.map(l => l.text).join('|')}`;
|
|
if (!pGroups[key]) pGroups[key] = [];
|
|
pGroups[key].push(t.name);
|
|
}
|
|
});
|
|
|
|
Object.keys(pGroups).forEach(key => {
|
|
if (pGroups[key].length > 1) {
|
|
console.log(`模板 ${pGroups[key].join(', ')} 配置相同`);
|
|
}
|
|
});
|