add external support

This commit is contained in:
Artemy 2024-01-23 21:09:44 +03:00
parent 21492b5ed9
commit 7bb8c0ad32
2 changed files with 19 additions and 11 deletions

View file

@ -1,7 +1,6 @@
# CIM Engine map list
# CIMEngine map list
1. Political Map of the World ([worldMap](https://cimengine.github.io/map/?id=worldMap))
2. Virtual Governments - Map of Virtual Countries from OOVC organisation. ([vgovernments](https://cimengine.github.io/map/?id=vgovernments))
3. International Virtual Countries - Map of International Virtual Countries (League of Virtual Nations). ([ivc](https://cimengine.github.io/map/?id=ivc))
4. Political Map of Dusiburg - Политическая карта Дусибурской Республики ([dusiburg](https://cimengine.github.io/map/?id=dusiburg))
5. `OVN` map - Map of Virtual Countries ([movc](https://cimengine.github.io/map/?id=movc))

View file

@ -1,15 +1,24 @@
const fs = require("fs");
const index = JSON.parse(fs.readFileSync("./index.json", "utf-8"));
async function run() {
const index = JSON.parse(fs.readFileSync("./index.json", "utf-8"));
let readme = "# CIM Engine map list\n\n";
let readme = "# CIMEngine map list\n\n";
let k = 1;
for (let id in index) {
let item = index[id];
readme += `${k++}. ${item.name} ${
item.description ? `- ${item.description}` : ""
} ([${id}](https://cimengine.github.io/map/?id=${id}))\n`;
let k = 1;
for (let id in index) {
let item = index[id];
if (item.external) {
item = await (await fetch(item.external)).json();
}
readme += `${k++}. ${item.name} ${
item.description ? `- ${item.description}` : ""
} ([${id}](https://cimengine.github.io/map/?id=${id}))\n`;
}
fs.writeFileSync("./README.md", readme);
}
fs.writeFileSync("./README.md", readme);
run();