Move ingestion scripts to ingest
This commit is contained in:
24
ingest/quickerfucker.js
Normal file
24
ingest/quickerfucker.js
Normal file
@@ -0,0 +1,24 @@
|
||||
import fs from "fs"
|
||||
|
||||
const data = JSON.parse(fs.readFileSync("data.json", "utf8"))
|
||||
|
||||
const dataPerRegion = {}
|
||||
|
||||
for (const item of data) {
|
||||
if (!dataPerRegion[item.regionName]) {
|
||||
dataPerRegion[item.regionName] = []
|
||||
}
|
||||
const connectedSystems = item.connectedSystems.split(",")
|
||||
item.connectedSystems = connectedSystems
|
||||
dataPerRegion[item.regionName].push(item)
|
||||
delete item.regionName
|
||||
}
|
||||
|
||||
for (const region in dataPerRegion) {
|
||||
const sanitizedRegion = region.replaceAll(" ", "_").replaceAll("-", "_")
|
||||
const regionFile = `../public/${sanitizedRegion}.json`
|
||||
console.log("Writing to", regionFile)
|
||||
fs.writeFileSync(regionFile, JSON.stringify(dataPerRegion[region], null, 2))
|
||||
}
|
||||
|
||||
console.log("Done")
|
||||
Reference in New Issue
Block a user