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:
31
endpoints/illustrators/updateDB.ts
Normal file
31
endpoints/illustrators/updateDB.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
import { getAllCards2 } from "../util"
|
||||
import Card from "../../db/interfaces/Card"
|
||||
|
||||
import { promises as fs} from "fs"
|
||||
import { illustratorsFile, fetchIllustrators } from "../illustratorUtil"
|
||||
|
||||
const dbFile = illustratorsFile
|
||||
|
||||
const btsp = async () => {
|
||||
const db = await fetchIllustrators()
|
||||
|
||||
|
||||
const list = getAllCards2()
|
||||
for (let i of list) {
|
||||
i = i.replace("./", "../../")
|
||||
const card: Card = require(i).default
|
||||
|
||||
if (!card.illustrator) continue
|
||||
console.log(i)
|
||||
|
||||
const illustrator = card.illustrator
|
||||
|
||||
if (!db.includes(illustrator)) {
|
||||
db.push(illustrator)
|
||||
}
|
||||
}
|
||||
|
||||
await fs.writeFile(dbFile, JSON.stringify(db))
|
||||
}
|
||||
|
||||
btsp()
|
Reference in New Issue
Block a user