data: switch to recovered game DB and refresh cards and charts
Publish GitHub Pages output / publish (push) Successful in 44s
Publish GitHub Pages output / publish (push) Successful in 44s
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
import { mkdirSync, readFileSync, existsSync, writeFileSync } from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import { gameDbRoot, openGameDb, prepareGameDbSource, readGameDbText, sourceMetadata } from './game-db-source.mjs';
|
||||
import { jsonChanges } from './holodoridb-diff.mjs';
|
||||
|
||||
const current = prepareGameDbSource('kor', { review: true });
|
||||
const baselineFile = path.join(gameDbRoot, 'applied.json');
|
||||
const previous = existsSync(baselineFile) ? openGameDb(JSON.parse(readFileSync(baselineFile, 'utf8'))) : null;
|
||||
const tables = [];
|
||||
for (const name of [...new Set([...Object.keys(previous?.tables ?? {}), ...Object.keys(current.tables)])].sort()) {
|
||||
const before = previous?.tables[name] ? JSON.parse(readGameDbText(previous, name + '.json')) : [];
|
||||
const after = current.tables[name] ? JSON.parse(readGameDbText(current, name + '.json')) : [];
|
||||
tables.push({ name, beforeCount: before.length, afterCount: after.length,
|
||||
changes: jsonChanges(before, after) });
|
||||
}
|
||||
const report = { schemaVersion: 1, generatedAt: new Date().toISOString(), initialImport: !previous,
|
||||
baseline: previous ? sourceMetadata(previous) : null, target: sourceMetadata(current), tables };
|
||||
const lines = ['# 게임 DB 검토', '', `원본: ${current.masterDataVersion}`, '',
|
||||
previous ? `이전 수집: ${previous.masterDataVersion}` : '첫 DB 등록입니다. 아래 수량은 신규 콘텐츠 수가 아니라 전체 스냅샷 수량입니다.', '',
|
||||
'변경 전후의 전체 값은 latest.json에 저장합니다. 일정·배율 등 DB에 없는 서버 데이터는 추정하지 않습니다.', ''];
|
||||
const categories = [
|
||||
['카드/스킬/보드/메모리', /Card|Character|Costume|Live.*Skill|SkillTree|Poster/],
|
||||
['악곡', /Music/], ['이벤트', /Event|Marathon|Mission/], ['번역', /^Lang/], ['기타 시스템', /./]
|
||||
];
|
||||
const remaining = new Set(tables.filter(t => t.changes.length).map(t => t.name));
|
||||
for (const [label, pattern] of categories) {
|
||||
lines.push(`## ${label}`, '');
|
||||
const changed = tables.filter(t => remaining.has(t.name) && pattern.test(t.name));
|
||||
lines.push(...(changed.length ? changed.map(t => { remaining.delete(t.name); return `- ${t.name}: ${t.beforeCount} → ${t.afterCount}행, 변경 ${t.changes.length}곳 (의미는 전체 값 검토 필요)`; }) : ['변경 없음']), '');
|
||||
}
|
||||
mkdirSync(path.join(gameDbRoot, 'review'), { recursive: true });
|
||||
writeFileSync(path.join(gameDbRoot, 'review/latest.json'), JSON.stringify(report, null, 2) + '\n');
|
||||
writeFileSync(path.join(gameDbRoot, 'review/latest.md'), lines.join('\n'));
|
||||
console.log(`Verified ${tables.length} tables; ${tables.filter(t => t.changes.length).length} changed. Review: data/game-db/review/latest.md`);
|
||||
Reference in New Issue
Block a user