import fs from 'fs';

const jsonFiles = fs.readdirSync('../public');

for (const file of jsonFiles) {
	if (!file.endsWith('.json')) continue
	const data = fs.readFileSync(`../public/${file}`, 'utf8');
	const json = JSON.parse(data);
	for (const region of json) {
		if (region.connectedSystems) {
			region.connectedSystems = region.connectedSystems.join(',');
		}
	}
	fs.writeFileSync(`../public/${file}`, JSON.stringify(json, null, 2));
}
