mirror of
https://github.com/tcgdex/compiler.git
synced 2025-08-05 02:11:59 +00:00
Updated illustrators
Signed-off-by: Avior <florian.bouillon@delta-wings.net>
This commit is contained in:
22
endpoints/illustrators/index.ts
Normal file
22
endpoints/illustrators/index.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import { fetchIllustrators, illustratorToIllustratorSimple } from "../illustratorUtil"
|
||||
import { IllustratorsList } from "../../sdk/dist/types/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()
|
Reference in New Issue
Block a user