Florian Bouillon ef866401a4
Moved files to link with the SDK
Signed-off-by: Avior <florian.bouillon@delta-wings.net>
2020-03-11 11:21:40 +01:00

23 lines
650 B
TypeScript

import { fetchIllustrators, illustratorToIllustratorSimple } from "../illustratorUtil"
import { IllustratorsList } from "@tcgdex/sdk/interfaces/Illustrator"
import { getBaseFolder } from "../util"
import { promises as fs} from "fs"
const lang = process.env.CARDLANG || "en"
const endpoint = getBaseFolder(lang, "illustrators")
const btsp = async () => {
const db = await fetchIllustrators()
const res: IllustratorsList = {
count: db.length,
list: db.map((ill, index) => illustratorToIllustratorSimple(ill, index))
}
await fs.mkdir(endpoint, {recursive: true})
await fs.writeFile(`${endpoint}/index.json`, JSON.stringify(res))
}
btsp()