Updated Expansions

Signed-off-by: Avior <florian.bouillon@delta-wings.net>
This commit is contained in:
2020-03-10 14:52:24 +01:00
parent 6cb861d16e
commit a30d338103
4 changed files with 84 additions and 1 deletions

View File

@ -0,0 +1,22 @@
import { getAllExpansions, fetchExpansion, expansionToExpansionSingle } from "../expansionUtil"
import { Langs } from "../../db/interfaces/LangList"
import { getBaseFolder } from "../util"
import { promises as fs } from 'fs'
const lang = process.env.CARDLANG as Langs || "en"
const endpoint = getBaseFolder(lang, "expansions")
const btsp = async () => {
const list = getAllExpansions()
for (const i of list) {
const expansion = fetchExpansion(i)
await fs.mkdir(`${endpoint}/${expansion.code}/`, {recursive: true})
await fs.writeFile(`${endpoint}/${expansion.code}/index.json`, JSON.stringify(expansionToExpansionSingle(expansion, lang)))
}
}
btsp()