chore(sync): synchronize metadata files with added categories / aliases to central metadata file

This commit is contained in:
Meier Lukas
2025-04-16 21:27:10 +02:00
parent 0d8c53bf9b
commit bed168dd18
620 changed files with 4333 additions and 1211 deletions

25
scripts/sync-metadata.mjs Normal file
View File

@@ -0,0 +1,25 @@
import fs from "fs/promises";
const content = await fs.readFile("metadata.json", "utf-8");
const metadata = JSON.parse(content);
const keys = Object.keys(metadata);
let iteration = 0;
for (const key of keys) {
const file = `meta/${key}.json`;
try {
const fileContent = await fs.readFile(file, "utf-8");
const fileMetadata = JSON.parse(fileContent);
if (fileMetadata !== metadata[key]) {
await fs.writeFile(file, JSON.stringify(metadata[key], null, 2));
} else {
console.log(`No changes for ${file}`);
}
} catch (err) {
console.error(`Error reading ${file}: ${err.message}`);
}
iteration++;
if (iteration % 100 === 0) {
console.log(`Processed ${iteration}/${keys.length} files`);
}
}