mirror of
https://github.com/tcgdex/compiler.git
synced 2025-07-30 07:59:50 +00:00
Updated Expansions
Signed-off-by: Avior <florian.bouillon@delta-wings.net>
This commit is contained in:
22
endpoints/expansions/item.ts
Normal file
22
endpoints/expansions/item.ts
Normal 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()
|
Reference in New Issue
Block a user