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

@ -4,4 +4,3 @@
2. Virtual Governments - Map of Virtual Countries from OOVC organisation. ([vgovernments](https://cimengine.github.io/map/?id=vgovernments)) 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)) 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)) 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,5 +1,6 @@
const fs = require("fs"); const fs = require("fs");
async function run() {
const index = JSON.parse(fs.readFileSync("./index.json", "utf-8")); const index = JSON.parse(fs.readFileSync("./index.json", "utf-8"));
let readme = "# CIMEngine map list\n\n"; let readme = "# CIMEngine map list\n\n";
@ -7,9 +8,17 @@ let readme = "# CIM Engine map list\n\n";
let k = 1; let k = 1;
for (let id in index) { for (let id in index) {
let item = index[id]; let item = index[id];
if (item.external) {
item = await (await fetch(item.external)).json();
}
readme += `${k++}. ${item.name} ${ readme += `${k++}. ${item.name} ${
item.description ? `- ${item.description}` : "" item.description ? `- ${item.description}` : ""
} ([${id}](https://cimengine.github.io/map/?id=${id}))\n`; } ([${id}](https://cimengine.github.io/map/?id=${id}))\n`;
} }
fs.writeFileSync("./README.md", readme); fs.writeFileSync("./README.md", readme);
}
run();