mirror of
https://github.com/tcgdex/compiler.git
synced 2025-07-29 15:39:50 +00:00
Update in progress
Signed-off-by: Avior <florian.bouillon@delta-wings.net>
This commit is contained in:
@ -3,12 +3,15 @@ import Category, { CategorySimple, CategoryList } from '@tcgdex/sdk/interfaces/C
|
||||
import TranslationUtil from "@tcgdex/sdk/TranslationUtil"
|
||||
import { Langs } from "@tcgdex/sdk/interfaces/LangList"
|
||||
import { promises as fs } from 'fs'
|
||||
import Logger from '@dzeio/logger'
|
||||
|
||||
const lang = process.env.CARDLANG as Langs || "en"
|
||||
const endpoint = getBaseFolder(lang, "categories")
|
||||
|
||||
const logger = new Logger('Category/Index')
|
||||
|
||||
export default async () => {
|
||||
console.log(endpoint)
|
||||
logger.log(endpoint)
|
||||
|
||||
const list: Array<CategorySimple> = []
|
||||
for (const cat of Object.values(Category)) {
|
||||
@ -26,5 +29,5 @@ export default async () => {
|
||||
|
||||
await fs.mkdir(endpoint, {recursive: true})
|
||||
await fs.writeFile(`${endpoint}/index.json`, JSON.stringify(res))
|
||||
console.log('ended ' + endpoint)
|
||||
logger.log('ended')
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ export default async () => {
|
||||
const toSave: CategorySingle = {
|
||||
id: rCat,
|
||||
name: TranslationUtil.translate("category", rCat, lang),
|
||||
cards: cards.map(el => cardToCardSimple(el, lang))
|
||||
cards: await Promise.all(cards.map(el => cardToCardSimple(el, lang)))
|
||||
}
|
||||
|
||||
const index = `${endpoint}/${toSave.id}`
|
||||
|
Reference in New Issue
Block a user