Add homepage and make bridges look nice
This commit is contained in:
@@ -4,13 +4,30 @@ import path from 'path';
|
||||
|
||||
const inputDir = './static/mapFiles/yaml';
|
||||
const outputDir = './static/mapFiles/json';
|
||||
const indexFile = './static/map-index.json';
|
||||
|
||||
if (!fs.existsSync(outputDir)) fs.mkdirSync(outputDir, { recursive: true });
|
||||
|
||||
const mapList = [];
|
||||
|
||||
fs.readdirSync(inputDir).forEach((file) => {
|
||||
if (file.endsWith('.yaml')) {
|
||||
const content = yaml.load(fs.readFileSync(path.join(inputDir, file), 'utf8'));
|
||||
const fullPath = path.join(inputDir, file);
|
||||
const content = yaml.load(fs.readFileSync(fullPath, 'utf8'));
|
||||
|
||||
const fileName = file.replace('.yaml', '.json');
|
||||
fs.writeFileSync(path.join(outputDir, fileName), JSON.stringify(content));
|
||||
|
||||
mapList.push({
|
||||
routeId: content.routeId || null,
|
||||
routeStart: content.routeStart || null,
|
||||
routeEnd: content.routeEnd || null,
|
||||
created: content.created || null,
|
||||
checked: content.checked || null,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
fs.writeFileSync(indexFile, JSON.stringify(mapList));
|
||||
|
||||
console.log(`Generated ${mapList.length} map files and index.`)
|
||||
|
||||
Reference in New Issue
Block a user