From 552e4b49fa6bd7d5e5720d78b446676c5f5c2bef Mon Sep 17 00:00:00 2001 From: Avior Date: Tue, 10 Mar 2020 13:02:02 +0100 Subject: [PATCH] Initial Compiler Signed-off-by: Avior --- .drone.yml | 39 ++++++++ .editorconfig | 12 +++ .gitignore | 1 + .gitmodules | 10 ++ db | 1 + dist | 1 + endpoints/RarityUtil.ts | 10 ++ endpoints/TagUtil.ts | 10 ++ endpoints/abilities-type/.gitkeep | 0 endpoints/abilities/.gitkeep | 0 endpoints/abilityUtil.ts | 21 ++++ endpoints/attackUtil.ts | 13 +++ endpoints/attacks-by-cost/.gitkeep | 0 endpoints/attacks-by-type/.gitkeep | 0 endpoints/attacks/.gitkeep | 0 endpoints/cardUtil.ts | 90 +++++++++++++++++ endpoints/cards/index.ts | 38 +++++++ endpoints/cards/item.ts | 28 ++++++ endpoints/expansionUtil.ts | 7 ++ endpoints/resistances/.gitkeep | 0 endpoints/retreat/index.ts | 36 +++++++ endpoints/retreat/item.ts | 42 ++++++++ endpoints/setUtil.ts | 80 +++++++++++++++ endpoints/sets/index.ts | 38 +++++++ endpoints/sets/item.ts | 28 ++++++ endpoints/sets/subitem.ts | 42 ++++++++ endpoints/typeUtil.ts | 10 ++ endpoints/util.ts | 65 ++++++++++++ endpoints/weaknesses/.gitkeep | 0 generated/abilities.json | 1 + generated/illustrators.json | 1 + package.json | 30 ++++++ sdk | 1 + tsconfig-cards.json | 9 ++ yarn.lock | 153 +++++++++++++++++++++++++++++ 35 files changed, 817 insertions(+) create mode 100644 .drone.yml create mode 100644 .editorconfig create mode 100644 .gitignore create mode 100644 .gitmodules create mode 160000 db create mode 160000 dist create mode 100644 endpoints/RarityUtil.ts create mode 100644 endpoints/TagUtil.ts create mode 100644 endpoints/abilities-type/.gitkeep create mode 100644 endpoints/abilities/.gitkeep create mode 100644 endpoints/abilityUtil.ts create mode 100644 endpoints/attackUtil.ts create mode 100644 endpoints/attacks-by-cost/.gitkeep create mode 100644 endpoints/attacks-by-type/.gitkeep create mode 100644 endpoints/attacks/.gitkeep create mode 100644 endpoints/cardUtil.ts create mode 100644 endpoints/cards/index.ts create mode 100644 endpoints/cards/item.ts create mode 100644 endpoints/expansionUtil.ts create mode 100644 endpoints/resistances/.gitkeep create mode 100644 endpoints/retreat/index.ts create mode 100644 endpoints/retreat/item.ts create mode 100644 endpoints/setUtil.ts create mode 100644 endpoints/sets/index.ts create mode 100644 endpoints/sets/item.ts create mode 100644 endpoints/sets/subitem.ts create mode 100644 endpoints/typeUtil.ts create mode 100644 endpoints/util.ts create mode 100644 endpoints/weaknesses/.gitkeep create mode 100644 generated/abilities.json create mode 100644 generated/illustrators.json create mode 100644 package.json create mode 160000 sdk create mode 100644 tsconfig-cards.json create mode 100644 yarn.lock diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..4c15184 --- /dev/null +++ b/.drone.yml @@ -0,0 +1,39 @@ +kind: pipeline +name: default +type: docker + +steps: + - name: submodules + image: alpine/git + commands: + - git submodule update --init --recursive + - git submodule foreach git checkout master + - git submodule foreach git pull origin master + + - name: prepare + image: node:alpine + commands: + - apk -q add yarn + - yarn + - yarn cards:compile + + - name: compile + image: node:alpine + commands: + - apk -q add yarn + - yarn gen:all + + - name: push + image: alpine/git + commands: + - cd dist + - git config --global user.email "$PUSH_EMAIL" + - git config --global user.name "$PUSH_NAME" + - git add . + - git commit -m "Updated API" + - git push -u origin master + environment: + PUSH_EMAIL: + from_secret: PUSH_EMAIL + PUSH_NAME: + from_secret: PUSH_NAME diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..aa0d24e --- /dev/null +++ b/.editorconfig @@ -0,0 +1,12 @@ +root = true + +[*] +indent_style = tab +indent_size = 4 +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[*.yml] +indent_size = 2 +indent_style = space diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3c3629e --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +node_modules diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..6183ffc --- /dev/null +++ b/.gitmodules @@ -0,0 +1,10 @@ +[submodule "db"] + path = db + url = https://git.delta-wings.net/tcgdex/db.git + +[submodule "dist"] + path = dist + url = https://git.delta-wings.net/tcgdex/compiled.git +[submodule "sdk"] + path = sdk + url = https://git.delta-wings.net/tcgdex/javascript-sdk.git diff --git a/db b/db new file mode 160000 index 0000000..be94e71 --- /dev/null +++ b/db @@ -0,0 +1 @@ +Subproject commit be94e712b87623615025eb21c0d363f2ad89a423 diff --git a/dist b/dist new file mode 160000 index 0000000..34f7f45 --- /dev/null +++ b/dist @@ -0,0 +1 @@ +Subproject commit 34f7f45aaef1f1158b987bf8bfaee3dd72a66650 diff --git a/endpoints/RarityUtil.ts b/endpoints/RarityUtil.ts new file mode 100644 index 0000000..ef12972 --- /dev/null +++ b/endpoints/RarityUtil.ts @@ -0,0 +1,10 @@ +import Rarity from "../db/interfaces/Rarity"; +import { Langs } from "../db/interfaces/LangList"; +import { raritySimple } from "./rarities/rarity"; + +export function rarityToRaritySimple(rarity: Rarity, lang: Langs): raritySimple { + return { + id: rarity, + name: Rarity.toLang(rarity, lang) + } +} diff --git a/endpoints/TagUtil.ts b/endpoints/TagUtil.ts new file mode 100644 index 0000000..a58b664 --- /dev/null +++ b/endpoints/TagUtil.ts @@ -0,0 +1,10 @@ +import Tag from "../db/interfaces/Tag"; +import { Langs } from "../db/interfaces/LangList"; +import { tagSimple } from "./tags/tag"; + +export function tagToTagSimple(tag: Tag, lang: Langs): tagSimple { + return { + id: tag, + name: Tag.toLang(tag, lang) + } +} diff --git a/endpoints/abilities-type/.gitkeep b/endpoints/abilities-type/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/endpoints/abilities/.gitkeep b/endpoints/abilities/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/endpoints/abilityUtil.ts b/endpoints/abilityUtil.ts new file mode 100644 index 0000000..7a56921 --- /dev/null +++ b/endpoints/abilityUtil.ts @@ -0,0 +1,21 @@ +import Ability from "../db/interfaces/Ability"; +import { Langs } from "../db/interfaces/LangList"; +import { abilitySimple, abilitySingle } from "./abilities/ability"; +import AbilityType from "../db/interfaces/AbilityType"; + +export function abilityToAbilitySimple(ability: Ability, lang: Langs): abilitySimple { + return { + name: ability.name[lang] + } +} + +export function abilityToAbilitySingle(ability: Ability, lang: Langs): abilitySingle { + return { + name: ability.name[lang], + text: ability.text[lang], + type: { + id: ability.type, + name: AbilityType.toLang(ability.type, lang) + } + } +} diff --git a/endpoints/attackUtil.ts b/endpoints/attackUtil.ts new file mode 100644 index 0000000..95e6751 --- /dev/null +++ b/endpoints/attackUtil.ts @@ -0,0 +1,13 @@ +import Attack from "../db/interfaces/Attack"; +import { Langs } from "../db/interfaces/LangList"; +import { attackSingle } from "./attacks/attack"; +import Type from "../db/interfaces/Type"; + +export function attackToAttackSingle(attack: Attack, lang: Langs): attackSingle { + return { + name: attack.name[lang], + cost: attack.cost && attack.cost.map(el => Type.toLang(el, lang)), + text: attack.text && attack.text[lang], + damage: attack.damage && attack.damage + } +} diff --git a/endpoints/attacks-by-cost/.gitkeep b/endpoints/attacks-by-cost/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/endpoints/attacks-by-type/.gitkeep b/endpoints/attacks-by-type/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/endpoints/attacks/.gitkeep b/endpoints/attacks/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/endpoints/cardUtil.ts b/endpoints/cardUtil.ts new file mode 100644 index 0000000..54df719 --- /dev/null +++ b/endpoints/cardUtil.ts @@ -0,0 +1,90 @@ +import { CardSimple, CardSingle } from "../sdk/dist/types/interfaces/Card"; +import Card from "../db/interfaces/Card"; +import { Langs } from "../db/interfaces/LangList"; +import { typeToTypeSimple } from "./typeUtil"; +import { rarityToRaritySimple } from "./RarityUtil"; +import { tagToTagSimple } from "./TagUtil"; +import Category from "../db/interfaces/Category"; +import { attackToAttackSingle } from "./attackUtil"; +import { abilityToAbilitySingle } from "./abilityUtil"; +import { getExpansion } from "./expansionUtil"; +import { getSet } from "./setUtil"; +import Expansion from "../db/interfaces/Expansion"; + +export function cardToCardSimple(card: Card, lang: Langs): CardSimple { + return { + id: card.id, + name: card.name[lang], + image: card.image && card.image.low[lang] + } +} + +export function getCardExpansion(card: Card): Expansion { + return getExpansion(getSet(card)) +} + +export function cardToCardSingle(card: Card, lang: Langs): CardSingle { + + const images: { + low: string, + high?: string + } = card.image && { + low: card.image.low[lang], + high: card.image.high && card.image.high[lang] + } + + return { + id: card.id, + localId: card.localId, + dexId: card.dexId, + + name: card.name[lang], + hp: card.hp, + type: card.type && card.type.map((el) => typeToTypeSimple(el, lang)), + + image: images, + + evolveFrom: card.evolveFrom && card.evolveFrom[lang], + evolveTo: card.evolveTo && card.evolveTo.map((el) => el[lang]), + tags: card.tags.map((el) => tagToTagSimple(el, lang)), + illustrator: { + id: 0, + name: typeof card.illustrator === "object" ? card.illustrator.name : card.illustrator, + }, + + abilities: card.abilities && card.abilities.map((el) => abilityToAbilitySingle(el, lang)), + + attacks: card.attacks && card.attacks.map(el => attackToAttackSingle(el, lang)), + + effect: card.effect && card.effect[lang], + + weaknesses: card.weaknesses && card.weaknesses.map(el => {return {type: typeToTypeSimple(el.type, lang), value: el.value}}), + resistances: card.resistances && card.resistances.map(el => {return {type: typeToTypeSimple(el.type, lang), value: el.value}}), + + retreat: card.retreat && card.retreat, + + rarity: rarityToRaritySimple(card.rarity, lang), + + category: { + id: card.category, + name: Category.toLang(card.category, lang) + }, + + set: { + name: typeof card.set.name === "object" ? card.set.name[lang] : card.set.name, + code: card.set.code + }, + + cardTypes: card.cardTypes && card.cardTypes + + } +} + +export function isCardAvailable(card: Card, lang: Langs): boolean { + if (!(lang in card.name)) return false + const set = getSet(card) + if ("availability" in set && (lang in set.availability)) { + return set.availability[lang] + } + return true +} diff --git a/endpoints/cards/index.ts b/endpoints/cards/index.ts new file mode 100644 index 0000000..023bc5a --- /dev/null +++ b/endpoints/cards/index.ts @@ -0,0 +1,38 @@ +import Card from "../../db/interfaces/Card" +import { Langs } from "../../db/interfaces/LangList" +import { promises as fs } from 'fs' +import { CardList, CardSimple } from "../../sdk/dist/types/interfaces/Card" +import { cardToCardSimple, isCardAvailable } from "../cardUtil" +import { getBaseFolder, getAllCards2 } from "../util" + +const lang = process.env.CARDLANG as Langs || "en" + +const endpoint = getBaseFolder(lang, "cards") + +const bootstrap = async () => { + const list = await getAllCards2() + const items: Array = [] + for (let el of list) { + el = el.replace("./", "../../") + const card: Card = require(el).default + + console.log(el) + if (!isCardAvailable(card, lang)) continue + items.push( + cardToCardSimple(card, lang) + ) + + // if (if (typeof card.set.availability === "undefined")) + } + + const cardList: CardList = { + count: items.length, + list: items + } + + await fs.mkdir(`${endpoint}`, {recursive: true}) + await fs.writeFile(`${endpoint}/index.json`, JSON.stringify(cardList)) + +} + +bootstrap() diff --git a/endpoints/cards/item.ts b/endpoints/cards/item.ts new file mode 100644 index 0000000..cf6cf26 --- /dev/null +++ b/endpoints/cards/item.ts @@ -0,0 +1,28 @@ +import { getAllCards2, getBaseFolder } from "..//util" +import Card from "../../db/interfaces/Card" +import { Langs } from "../../db/interfaces/LangList" +import { promises as fs } from 'fs' +import { cardToCardSingle, isCardAvailable } from "../cardUtil" + +const lang = process.env.CARDLANG as Langs || "en" + +const endpoint = getBaseFolder(lang, "cards") + +const bootstrap = async () => { + const list = await getAllCards2() + console.log(list) + for (let el of list) { + el = el.replace("./", "../../") + const card: Card = require(el).default + + console.log(el) + if (!isCardAvailable(card, lang)) continue + + await fs.mkdir(`${endpoint}/${card.id}/`, {recursive: true}) + await fs.writeFile(`${endpoint}/${card.id}/index.json`, JSON.stringify(cardToCardSingle(card, lang))) + + // if (if (typeof card.set.availability === "undefined")) + } +} + +bootstrap() diff --git a/endpoints/expansionUtil.ts b/endpoints/expansionUtil.ts new file mode 100644 index 0000000..c66a019 --- /dev/null +++ b/endpoints/expansionUtil.ts @@ -0,0 +1,7 @@ +import Expansion from "../db/interfaces/Expansion" +import Set from "../db/interfaces/Set" + +export function getExpansion(set: Set): Expansion { + if ("expansion" in set) return set.expansion + return require(`../../db/expansions/${set.expansionCode}`) +} diff --git a/endpoints/resistances/.gitkeep b/endpoints/resistances/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/endpoints/retreat/index.ts b/endpoints/retreat/index.ts new file mode 100644 index 0000000..6e53eaa --- /dev/null +++ b/endpoints/retreat/index.ts @@ -0,0 +1,36 @@ +import Card from "../../db/interfaces/Card" +import { getAllCards2, getBaseFolder } from "../util" +import { promises as fs } from 'fs' +import { isCardAvailable } from "../cardUtil" +import { RetreatList } from '../../sdk/dist/types/interfaces/Retreat' +import { Langs } from "../../db/interfaces/LangList" + +const lang = (process.env.CARDLANG || "en") as Langs +const endpoint = getBaseFolder(lang, "retreat") + +const btsp = async () => { + const files = await getAllCards2() + const count: Array = [] + for (let file of files) { + file = file.replace("./", "../../") + const card: Card = await require(file).default + + if ( + !isCardAvailable(card, lang) || + !card.retreat || + count.includes(card.retreat) + ) continue + console.log(file) + count.push(card.retreat) + } + + const list: RetreatList = { + count: count.length, + list: count + } + + await fs.mkdir(endpoint, {recursive: true}) + await fs.writeFile(`${endpoint}/index.json`, JSON.stringify(list)) +} + +btsp() diff --git a/endpoints/retreat/item.ts b/endpoints/retreat/item.ts new file mode 100644 index 0000000..af17d3e --- /dev/null +++ b/endpoints/retreat/item.ts @@ -0,0 +1,42 @@ +import Card from "../../db/interfaces/Card" +import { getAllCards2, getBaseFolder } from "../util" +import { promises as fs } from 'fs' +import { isCardAvailable, cardToCardSimple } from "../cardUtil" +import { RetreatSingle } from '../../sdk/dist/types/interfaces/Retreat' +import { Langs } from "../../db/interfaces/LangList" + +const lang = (process.env.CARDLANG || "en") as Langs +const endpoint = getBaseFolder(lang, "retreat") + +const btsp = async () => { + const files = await getAllCards2() + const count: Array> = [] + for (let file of files) { + file = file.replace("./", "../../") + const card: Card = await require(file).default + + if ( + !isCardAvailable(card, lang) || + !card.retreat + ) continue + console.log(file) + if (!(card.retreat in count)) count[card.retreat] = [] + count[card.retreat].push(card) + } + + for (const retreat in count) { + if (count.hasOwnProperty(retreat)) { + const cardArr = count[retreat]; + + const item: RetreatSingle = { + id: retreat as unknown as number, + cards: cardArr.map((val) => cardToCardSimple(val, lang)) + } + + await fs.mkdir(`${endpoint}/${item.id}`, {recursive: true}) + await fs.writeFile(`${endpoint}/${item.id}/index.json`, JSON.stringify(item)) + } + } +} + +btsp() diff --git a/endpoints/setUtil.ts b/endpoints/setUtil.ts new file mode 100644 index 0000000..fb39f2e --- /dev/null +++ b/endpoints/setUtil.ts @@ -0,0 +1,80 @@ +import Set from "../db/interfaces/Set" +import Card from "../db/interfaces/Card" +import * as glob from 'glob' +import { Langs } from "../db/interfaces/LangList" +import { SetSimple, SetSingle } from "../sdk/dist/types/interfaces/Set" +import { cardToCardSimple } from "./cardUtil" +import { CardSimple } from "../sdk/dist/types/interfaces/Card" +import { getAllCards2 } from "./util" + +interface t { + [key: string]: T +} + +const setCache: t = {} + +export function isSet(set: Set | {name: string, code: string}): set is Set { + return "releaseDate" in set +} + +export function getSet(card: Card): Set { + if (!(card.set.code in setCache)) { + if (isSet(card.set)) setCache[card.set.code] = card.set + console.log(card.set.code) + let setPath = glob.sync(`./db/sets/**/${card.set.code}.js`)[0] + setPath = setPath.replace('./', '../') + setCache[card.set.code] = require(setPath).default + } + return setCache[card.set.code] +} + +export function isSetAvailable(set: Set, lang: Langs) { + if (!set.availability || !(lang in set.availability)) return true + return set.availability +} + +export function setToSetSimple(set: Set, lang: Langs): SetSimple { + return { + code: set.code, + name: set.name[lang], + total: set.cardCount.total + } +} + +export function getSetCards(set: Set, lang: Langs): Array { + const cards = getAllCards2(set.code) + const items: Array = [] + for (let el of cards) { + el = el.replace("./", "../") + const card: Card = require(el).default + + items.push( + cardToCardSimple(card, lang) + ) + } + + return items +} + +export function setToSetSingle(set: Set, lang: Langs): SetSingle { + return { + name: set.name[lang], + code: set.code, + expansionCode: set.expansion && set.expansion.code || set.expansionCode || undefined, + tcgoCode: set.tcgoCode, + cardCount: { + total: set.cardCount.total, + official: set.cardCount.official + }, + releaseDate: set.releaseDate, + legal: set.legal && { + standard: set.legal.standard, + expanded: set.legal.expanded + }, + images: set.images && { + symbol: set.images.symbol, + logo: set.images.logo + }, + list: getSetCards(set, lang) + } +} diff --git a/endpoints/sets/index.ts b/endpoints/sets/index.ts new file mode 100644 index 0000000..4367b87 --- /dev/null +++ b/endpoints/sets/index.ts @@ -0,0 +1,38 @@ +import Set from "../../db/interfaces/Set" +import { Langs } from "../../db/interfaces/LangList" +import { promises as fs } from 'fs' +import { SetSimple, SetList } from "../../sdk/dist/types/interfaces/Set" +import { getAllSets, getBaseFolder } from "../util" +import { isSetAvailable, setToSetSimple } from "../setUtil" + +const lang = process.env.CARDLANG as Langs || "en" + +const endpoint = getBaseFolder(lang, "sets") + +const bootstrap = async () => { + const list = await getAllSets() + const items: Array = [] + for (let el of list) { + el = el.replace("./", "../../") + const set: Set = require(el).default + + console.log(el) + if (!isSetAvailable(set, lang)) continue + items.push( + setToSetSimple(set, lang) + ) + } + + const cardList: SetList = { + count: items.length, + list: items + } + + await fs.mkdir(`${endpoint}`, {recursive: true}) + await fs.writeFile(`${endpoint}/index.json`, JSON.stringify(cardList)) + +} + +console.log("Building sets/index") + +bootstrap() diff --git a/endpoints/sets/item.ts b/endpoints/sets/item.ts new file mode 100644 index 0000000..860576e --- /dev/null +++ b/endpoints/sets/item.ts @@ -0,0 +1,28 @@ +import { getBaseFolder, getAllSets } from "../util" +import Set from "../../db/interfaces/Set" +import { Langs } from "../../db/interfaces/LangList" +import { promises as fs } from 'fs' +import { isSetAvailable, setToSetSingle } from "../setUtil" + +const lang = process.env.CARDLANG as Langs || "en" + +const endpoint = getBaseFolder(lang, "sets") + +const bootstrap = async () => { + const list = await getAllSets() + for (let el of list) { + el = el.replace("./", "../../") + const set: Set = require(el).default + + if (!isSetAvailable(set, lang)) continue + console.log(el) + + await fs.mkdir(`${endpoint}/${set.code}/`, {recursive: true}) + await fs.writeFile(`${endpoint}/${set.code}/index.json`, JSON.stringify(setToSetSingle(set, lang))) + } + + +} +console.log("Building sets/item") + +bootstrap() diff --git a/endpoints/sets/subitem.ts b/endpoints/sets/subitem.ts new file mode 100644 index 0000000..706178a --- /dev/null +++ b/endpoints/sets/subitem.ts @@ -0,0 +1,42 @@ +import { getBaseFolder, getAllSets } from "../util" +import Set from "../../db/interfaces/Set" +import { Langs } from "../../db/interfaces/LangList" +import { promises as fs } from 'fs' +import { isSetAvailable } from "../setUtil" +import { getAllCards2 } from "../util" +import Card from "../../db/interfaces/Card" +import { cardToCardSingle, isCardAvailable } from "../cardUtil" + +const lang = process.env.CARDLANG as Langs || "en" + +const endpoint = getBaseFolder(lang, "sets") + +const bootstrap = async () => { + const list = await getAllSets() + for (let el of list) { + el = el.replace("./", "../../") + const set: Set = require(el).default + + console.log(el) + if (!isSetAvailable(set, lang)) continue + + const lit = await getAllCards2(set.code) + for (let i of lit) { + i = i.replace("./", "../../") + const card: Card = require(i).default + + if (!isCardAvailable(card, lang)) continue + console.log(i) + + await fs.mkdir(`${endpoint}/${set.code}/${card.localId}`, {recursive: true}) + await fs.writeFile(`${endpoint}/${set.code}/${card.localId}/index.json`, JSON.stringify(cardToCardSingle(card, lang))) + } + + } + + +} + +console.log("Building sets/subitem") + +bootstrap() diff --git a/endpoints/typeUtil.ts b/endpoints/typeUtil.ts new file mode 100644 index 0000000..1b6afa2 --- /dev/null +++ b/endpoints/typeUtil.ts @@ -0,0 +1,10 @@ +import Type from "../db/interfaces/Type"; +import LangList, { Langs } from "../db/interfaces/LangList"; +import { typeSimple } from "./types/type"; + +export function typeToTypeSimple(type: Type, lang: Langs): typeSimple { + return { + id: type, + name: Type.toLang(type, lang) + } +} diff --git a/endpoints/util.ts b/endpoints/util.ts new file mode 100644 index 0000000..3e5c4af --- /dev/null +++ b/endpoints/util.ts @@ -0,0 +1,65 @@ +import { promises as fs, promises } from 'fs' +import * as glob from 'glob' + +export function getAllCards() { + return listFolder("./assets") +} + +export function getAllCards2(set = "**", expansion = "**") { + return glob.sync(`./db/cards/${expansion}/${set}/*.js`) +} + +export function getAllSets() { + return glob.sync('./db/sets/**/*.js') +} + +export function getAllCardsJSON() { + return glob.sync("./db/cards/**/**/*.json") +} + +async function listFolder(folder: string): Promise> { + const files = await fs.readdir(folder) + const res = [] + for (const file of files) { + if (file.endsWith(".json")) res.push(`${folder}/${file}`) + if ((await fs.stat(`${folder}/${file}`)).isDirectory()) { + res.push(...await listFolder(`${folder}/${file}`)) + } + } + return res +} + +export function getBaseFolder(lang: string, endpoint: string) { + return `./dist/${lang}/${endpoint}` +} + +export async function del(path: string) { + let files = [] + const promiseArr = [] + try { + files = await promises.readdir(path) + } catch { + return + } + if (files.length > 0) { + for (const file of files) { + const fPath = `${path}/${file}` + if ((await promises.stat(fPath)).isDirectory()) { + promiseArr.push( + del(fPath) + ) + } else { + promiseArr.push( + promises.unlink(fPath) + ) + } + } + } + await Promise.all(promiseArr) + await promises.rmdir(path) +} + +export function urlize(str: string): string { + str = str.normalize('NFD').replace(/[\u0300-\u036f]/g, "") + return str.replace(/ /g, "-").toLowerCase() +} diff --git a/endpoints/weaknesses/.gitkeep b/endpoints/weaknesses/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/generated/abilities.json b/generated/abilities.json new file mode 100644 index 0000000..c10d56f --- /dev/null +++ b/generated/abilities.json @@ -0,0 +1 @@ +["Commanding Aura","Terraforming","Magnetic Field","Synergy Effect","Dark Palm","Intense Voltage","Constrain","Time Travel","Clear Body","Floral Scent","Sharp Eye","Magnetize","Security Guard","Strikes Back","Evasion Jutsu","Earth Fissure","Pantomime","Empty Shell","Retreat Aid","Lazy Aura","Royal Garden","Metallic Lift","Natural Cure","Baby Evolution","Core Guard","Vigorous Aura","Roto Motor","Allergy Flower","Primal Swirl","Claw Snag","PUT","Cursed Eyes","Inner Focus","Magnetic Redraw","Final Sting","Metal Gravity","Nervous Seed","Chilling Breath","Emerge","Metal Navigation","Poison Sacs","Call Up","Body Odor","Form Change","Varied Pollen","Call","Duplicate","DARK","Sweet Sleeping Face","Frozen Charm","Tropical Motion","Supreme Command","Upper Material","Chain of Events","Forest Murmurs","Burning Draft","Power Saver","Sludge Festival","Active Volcano","Strong Cheer","Holon Veil","Shining Horn","Invitation","Voltage Increase","Submerge","Healing Aroma","Stages of Evolution","Volunteer","Bedhead","Red Armor","Thick Fat","Darkness Fan","Opponent's Choice","Spiky Shield","Shady Move","Solid Shell","Delta Protection","Prowl","Psychoflow","Mystical Fire","Cloud-Covered Moon","Blaze","Water Shuriken","Psychic Float","Forest's Curse","Celebration Wind","Frozen Flow","Wash Out","Shuffle","Extra Boost","Mapping","Water Acceleration","Fairy Transfer","Moon Guidance","Type Shift","Energy Signal","Fire Formation","Battle Aura","Shell Retreat","Magma Armor","Evolutionary Call","Mystic Scale","Swelling Spite","Sharing","Armor","Cosmic Guard","Power Circulation","Hypnotic Pendulum","Loose Shell","Tropical Heal","Mind Report","Intimidating Fang","Extra Feather","Bench Barrier","Extra Wing","Top Accelerator","Justified","Sooth Dust","Forest Breath","Imprison","Link Wing","Rage Aura","Energymite","Power Gene","Fighting Tag","Family Bonds","Fossil Bind","Spiral","Magnetic Draw","Insight","Power Pinchers","Fossilized Memories","Free Flight","Thick Skin","Dragon Wind","Rest Up","Acid Sampler","Sand Guard","THROW","Wall of Stone","Rebirth","Stickiness","Shell Armor","Electro Recycle","Energy Healer","Levitate","Head Trip","Electromagnetic Wall","Safeguard","Golden Wing","Green Breath","HEAL","My Way","Toppling Wind","Fight Song","Delta Switch","Icy Aura","Cloak Evolution","Heal Dance","Dark Trance","[XXXXX]","Versatile","Electro-guard","Transform","Curse","Long-Distance Hypnosis","Beacon Protection","Energy Rain","Shift","Cursed Glare","[Quicken]","[Zoom]","Leaf Draw","Overflow","Intimidating Mane","Invisible Wall","Thick Skinned","Growing Up","Heal","Big Wing","Multitype","Burning Road","Reactive Barrier","Peek","Level-Down","Double Fall","Energy Evolution","Healing Growth","Extreme Speed","Fossil","Final Blow","Wild Growth","YAWN","Mind Games","Sleep Pendulum","Fire Recharge","Reactive Protection","Dig Well","Ion Coating","Darkness Send","Serene Grace","Rainbow Scale","Fluff","Fire Breath","Healing Breath","Dragon Spirit","Reactive Shift","Psychic Connect","Shadow Curse","Let Loose","Ancient Shell","Turboblaze","Type Change","Stench","Evolutionary Fan","Aqua Lift","Crust","Earth Rage","Nectar Pod","Dragon Road","Reactive Lift","Firestarter","Black Eyes","Energy Draw","Electromagnetic Power","Protective Dust","Reactive Booster","Rough Skin","Reactive Generator","Natural Remedy","Dual Armor","Pure Body","Sol Shade","Analyze","Bounce","Magma Pool","Reactive Recharge","Draw","Ancient Fang","Electric Barrier","SET","[Keep]","Energy Trans","Reactive Colors","Energy Connect","Deep Sleep","Reactive Aroma","Temper Tantrum","Reactive Healing","Wonder Guard","Miraculous Powder","Camouflage Pattern","Sinister Selection","Lightweight","Ancient Tentacles","Balloon Sting","Pressure","Toxic Gas","Fire Remedy","Emerge Charge","Primal Veil","Dark Cloak","Damage Swap","Energy Burn","Rain Dish","Sand Slammer","Crystal Body","Lunar Eclipse","Froth","Black Beam","Fan Away","Cheerful Voice","Psymimic","Jet Stream","Solar Eclipse","Sand Damage","Exoskeleton","Snow Gift","Burning Energy","Galactic Switch","Poison Point","Moonlight","Poison Resistance","Fire Veil","Chaos Flash","Gift Exchange","Spiny","Energy Variation","Rock Body","Insomnia","Relaxing Shower","Dynamotor","Uplifting Glow","Keystone Seal","Healing Wind","Saturation","Cold Feet","Hidden Poison","Buffer","Darkness Veil","Dark Condition","Soothing Aroma","Time Recall","Primal Lock","Crimson Ray","Durable Body","Dark Lift","Dimension Breach","Victory Star","Cursed Body","Fury Blaze","Burning Coat","Beating Wings","Kabuto Armor","Irritating Buzz","Star Barrier","Dark Healer","Dark Aura","Darkness Guard","Plunge","Aqua Recovery","Miracle Aroma","Flame Dash","Recover Mechanism","Flare Command","Long Distance Hypnosis","Heat Up","Flame Body","Dark Ray","Plus Charge","Marvel Scale","Delta Supply","Dark Engage","Delta Reactor","Delta Reserve","Plant Cloak","Fainting Spell","Fellowship","Time Crystal","Tri-Poison","Camouflage","Lost Cyclone","Thankfulness","Tailwind","Gluey Slime","Aqua Healing","Major Tsunami","Chaos Move","Flare Condition","Eerie Aura","Rainbow Float","Prehistoric Call","Cotton Balloon","Final Wish","KIND","Unlucky Wind","X-RAY","Psychic Vision","Wear Cloak","Damage Bind","Flutter Wings","Smooth Coat","Pot Shell","Undevelop","Sweet Veil","Sticky Hold","Fur Coat","Sand Cover","Energy Return","Teleportation","Forewarn","Pupate","Royal Heal","Inferno Fandango","Irresistible Aroma","Magnetic Reversal","Toxic Spikes","Steel Coating","Slow Start","Curse Breath","Fossil Armor","Time Walk","Attracting Body","Iron Shell","Energy Grounding","Rear Sensor","Healing Tail","Regi Move","Regi Heal","Heavyweight","White Smoke","Territoriality","Royal Gain","Gather Ice","!","Set Up","Frost Wind","Energy Refresh","Allergy Panic","Temperament","Tool Concealment","Wormadam First","Revenge Fang","Roast Reveal","Clear Humming","Rush In","Badge of Discipline","Restoring Beam","Dangerous Tentacle","Yellow Ray","Round 'n' Round","Dragon Aura","Kinesis","Sparkling Particles","Metal Chain","Mirror Coat","Dense","Strange Behavior","Poison Moth Wind","Trade","Ancient Wind","[Tell]","Moonlight Veil","Dedechange","Battery","Stealthy Body","Conversion","Psychic Aura","Shoot Poison","Sentinel","Psybarrier","Self Healing","Busybody","Immunity","Toxic Virus","Unobservant","Trade Off","Mist","Sound Veil","Freezing Screech","Shadow Pain","Bad Sleeping Habits","Detention Gas","Gather Sand","Mysterious Message","Primal Shell","Hyper Transfer","Resetting Hole","Aqua Skin","Cursed Shadow","Overgrow","Flame Charge","Ancient Power","GUARD","Sheet Lightning","Underground Work","Cursed Alloy","Purple Ray","Sunlight Veil","Aftermath","Bratty Kick","Camouflage Gas","Garbotoxin","Rare Metal","Ruler of the Night","Greedy Evolution","Freefloating","Building Spite","Synchronicity","Reconstruction","Damage Switch","Cosmic Power","Disturbance Scales","Cloudy Sky","Dowsing Code","Water Rescue","Hair Wall","Wind Erosion","Blade Storm","Dense Body","Sand Reset","Fast-Flight Configuration","Energy Color","Propagation","Metal Eater","Ancient Guidance","Intimidating Roar","Excitable Draw","Bright Look","Shining Body","Fairy Feast","Innards Out","Water Bubble","Magical Return","Distortion Door","Fluffy Cotton","Big Appetite","Power of Alchemy","Fright Night","Fan Shift","FAKE","Dragon Pulse","Gathering of Cats","Plump Body","Chilly Breath","Frost Shift","Cat Walk","Power Cancel","Wind Charm","Goodnight, Babies","Downer Material","Heat Shift","Miracle Oracle","Kind Egg","Crazy Code","Lazy Eating","Playhouse Heal","Gravity Change","Dark Genes","Lure Ring","Force Canceler","Play Ball","Quick Search","Block","Metal Fortress","Glacier Snow","Sticky","Steam Up","Protective Wall","Metal Juncture","Ice Wall","Hydro Barrier","Dragon DNA","Lazy Paunch","Mow Shift","Jumbo Fin","Full Moon Dance","Airy Wall","Mother Pheromone","King's Palace","Color Shift","ITEM","Intimidating Pattern","Dark Shadow","Poison Enzyme","Sludge Cell","Dark Invitation","Evolutionary Vitality","Cold Fat","Mystic Heart","Magic Room","RETIRE","?","Enthusiasm","Gale Wings","Sudden Cyclone","Focus Wall","Slush Rush","Primal Stare","Shadow Command","Emperor Aura","Super Connectivity","Ditto DNA","EQUIP","Premonition","Cycler","Regi Cycle","Plasma Steel","Spirit Pulse","Flash Bite","Burning Mane","Resent","Time Reversal","Protect Wing","Deluge","Green Renewal","Radiance","Energy Protection","Energy Reaction","Overeager","Shocking Tail","Stance","Flash Fire","Drag Along","Torrid Wave","Poison Payback","Ectoplasm","Red Eyes","Conductivity","No Guard","Darkness Shade","Link Lightning","Surprise Bite","Primal Claw","Unburden","QUICK","Energy Forcing","Scare","Cast-off Shell","Mode Crash","Spatial Distortion","Flight Support","JUNK","UNSEEN","Drive Off","VACATION","Miraculous Wind","Gift","Adaptive Evolution","Hot Plate","Sinister Hand","Cunning","Dig up","Lost Link","Psy Shadow","Lazy","Hydroelectric Power","[Help]","[Want]","Pika Shield","Diving Draw","Ancient Scream","Counterattack","Dark Impulse","[Chase]","Psychic Protector","Iron Skull","Floral Breeze","Flower Veil","Water Call","Dragon Intimidation","[Search]","Cellular Companions","Leaf Ride","Gravitation","[Vanish]","Auxiliary Light","Poison Barrier","Rock Peak Growl","Speed Boost","Compound Eyes","Fluffy","Geotech System","Darkness Restore","Spray Splash","Diving Search","Extra Tight","Dig Down","Marvel Shell","Stir and Snooze","Spikes","Big Jump","Flare Witch","Frog Song","Rebellion","Psylink","Abyssal Hand","Anger","Stand In","Disrupting Spy","Second Coat","Twilight Eyes","Memory Out","Ominous Posture","Self-Generation","Portrait","Sonic Vision","MAGNET","Wash Shift","Mega Boost","Evolutionary Pollen","Prehistoric Power","Scram","Sticky Goo","Energy Grace","Electric Trans","Step In","Relaxing Scent","Shock Blast","Thorn Tempest","[Find]","Ultra-thick Skin","Revive Friends","Toxic Sludge","Transparency","Fire Boost","Shell On","Victory Kiss","Escape","Gaze","Gaseous Form","Aqua Search","Regi Form","Queenly Majesty","Glaring Gaze","Sunny Day","Ancient Protection","Fast Call","Fragrance Trap","Observe","Boundary Aura","Cowardice","Photosynthesis","Special Delivery","Maternal Comfort","Solar Power","Softboiled","Tool Reversal","Second Sight","Sand Armor","Seal of Antiquity","Howl","Counterattack Quills","Energy Shark","Energy Converter","Prehistoric Memory","Legendary Body","FLASH","Healing Fire","Mimic","Shell Shield","Night Vision","Empty Light","Earthen Awakening","Primal Pull","Contrary","Aqua Recycle","Gyro Unit","[Bear]","Shield Veil","Bolt","[Yield]","Leap Through Time","Peal of Thunder","Echo Draw","Chlorophyll","Jewel Armor","Bright Veil","Hard Shell","Colorful Body","Fighting Fury","Guard","Hearing","Secret Key","Power Suction","Floating Electrons","Bust In","Hot Snort","Boost Gas","Perfect Metal","Search the Premises","Reflexive Retaliation","Twisted Incantation","Calming Aroma","Devour Light","Energetic Impulse","Intimidating Armor","Burning Head","Miraculous Scales","Wing Buzz","Gooey Regeneration","Ice Shield","Delta Support","Teleport Room","Echolocation","Magma Switch","Harvest Bounty","Sneaky Bite","Poison Pollen","Pattern Distraction","CURE","Double Type","Fragrant Flower Garden","Catastrophe","Max Wind","Flaming Shot","Gothic Fear","Hard Rock","Extra Liquid","Dark Eyes","Hunch","Scorching Scales","Airhead","Withering Dust","Dark Protection","Leaf Tailor","Happy Dance","Solid Rock","Smooth Over","Solar Revelation","Fan Action","Hard Protection","Wimp Out","Green Aroma","Revenge Seed","Hard Cocoon","Le Parfum","Erasing Sound","Craftsmanship","Dragon Call","Happy Healing","Distortion","Splash Back","Dragon Boost","Temperamental Weather","Strange Tentacles","Dragon Lift","Fiery Spirit","Dignified Fighter","Power of Evolution","Gourgantic","Heal Block","Seasonal Blessings","Super Suction Cups","Perfection","Energy Guard","Time Skip","Slip Trip","Restructure","Psychic Mirage","Glowing Screen","Bide Barricade","Summon Minions","Delta Charge","Evolution Memories","Energy Jump","Darkness","Clairvoyance","[Engage]","Undo","Delta Aura","Flower Picking","Delta Control","Delta Guard","Sacrifice","Heat Metal","Mental Shroud","Sunbeam","Anger Point","Dark Hide","Dimension Transfer","Jamming","Osmosis","Trump Card","Install","Backup","Call for Help","Sleeping Pulse","Bind Eye","Good Night Melody","Blanket Weaver","Bursting Spores","Invisible Tentacles","Solid Unit","Delta Storm","Leap Away","Prize Shift","Earthen Shield","Reversal Aura","Bright Down","Conductive Body","Defense Sign","Burning Spirit","Call for Power","Energy Shift","Minus Charge","Sandy Cloak","Verdant Wind","Lunar Aura","Download","Sunshine Grace","Darkness Aura","Red Signal","Rock Hiding","Mermaid's Call","Sap Sipper","Scornful Storm","Scent Conduct","Grit","Serpentine Strangle","Bodyguard","Regi Power","Wild Guard","Cotton Spore","Evolutionary Flame","Evolutionary Thunder","Motor Drive","Grass Whistle","Trash Cloak","Psychic Shift","Evolutionary Swirl","ZERO","Sunlight","Dangerous Scales","Delta Transport","LINK","[Laugh]","Berserk","Herbal Scent","Silent Waves","Light Conduct","[Join]","Neutral Shield","Playful Punch","Chain Reaction","Self-control","Carefree","Sunny Heal","Peppy Pick","Green Dignity","Spooky Whirlpool","Lonely Bone","Drifting Balloon","Toolbox","Green Essence","Water Cyclone","Leap Frog","Scoundrel Guard","Tangling Tendrils","Eye of Disaster","RETURN","Primal Aura","Schooling","Stellar Guidance","Primal Winds","Wonder Tag","Feathery","Daunting Pose","Avenging Aura","Dark Gaze","Good Neighbor","Item Search","Swing Dance","Wishing Star","Dark Hole","Fast Protection","Rai-shield","Moonglow","Breakwing","Form Variation","Energy Recharge","Fiery Aura","Plasma Transfer","Wise Aura","Excavate","Crush Chance","Spike Storm","Delta Sign","Star Light","Flotation","Delta Heal","Crush Draw","Delta Moon","Binding Aura","Scatter","Extra Protection","Assistance","Wafting Scent","Psychic Trace","Energy Flame","Psychic Wing","Extra Energy Bomb","Magic Odds","Frenzy","Magic Evens","Extra Smoke","Frubbles","Laid-Back","Freeze Zone","Evolutionary Light","Thick Shell","Trickery","Hurricane Charge","Investigate","Reactive Shield","Slippery Skin","Shapeshift","Fortitude","Overzealous","Call the Boss","Poison Structure","Energy Drain","Snack Search","Flaming Fighter","Scramble","Soak Up","Support Navigation","Fluffy Fur","Hover Lift","Extra Noise","Energy Recycle","Fellow Boost","Luna Shade","Deadlock","Paranoid","Dark and Clear","Blue Ray","Darkness Navigation","Shuriken Flurry","Bubble Turn","Bench Guard","Dark Moon","Pollen Defense","Energy Charge","Flee","Reel In","Night Scope","Restless Sleep","Stardust Song","Beast Boost","Power Bind","Strange Barrier","Luster Float","Dark Shade","Lonesome","Sneak Attack","Water Immunity","Manipulate","Flame Vapor","Streaming Mantle","Strange Spiral","Fast Feet","Natural Healing","Scavenger Hunt","Power Diffusion","Night Sight","Evolutionary Advantage","[Give]","Fair-Weather Heal","Lightning Burst","Spiral Swirl","Restored Barrier","Blissful Nurse","Mark of Antiquity","Healing Stone","Rain Dance","Block Dust","Ocean Grow","Hustle Step","Chaotic Star","Sporprise","Mischievous Trick","Rivalry","Speed Gain","Spiteful Spirit","Dual Brains","Nightmare Star","Smelt","Space Virus","Psychic Bind","Magical Trans","Evolutionary Toxic","Craggy Face","Freeze-up","Search for Friends","Snappy Move","Ultra Conversion","Waterlog","Telepass","Phoenix Turn","Thunder Rumble","ONE","NOD","Cottonweed","Blaze Dance","Fin Luster","Magnetic Search","Snow Veil","Sunshine Song","Battle Rush","Honeycomb Defender","Unaware","Darkness Drive","Leaf Trans","Afterburner","Sacred Rainbow","Aqua Mirage","Healing Shower","WALL","Magnetic Call","Scoundrel Ring","Suction Cups","Anti","Competitiveness","Unearth","Shadow Hunt","Surge Surfer","Sturdy","Purifying Fire","Dragon Curse","Dual Aura","Dual Aura (Duaru oora)","Mischievous Fang","Primal Light","Delta Block","Makeover","Weak Barrier","Power Connect","Trick Reveal","Driving Howl","Pheromone Stamina","Dittobolic","Moomoo Malt","Sand Veil","Water Pressure","Evolutionary Gas","Mysterious Buzz","Crushing Charge","Synchronized Lift","Burning Aura","Tangling Hair","Instruct","Pump Up","Root Protector","Marvel Eyes","Sunshine Fate","Power Shift","Reverse Time","Time Aura","Metal Trait","Nurse Call","Sinkhole","Anticipation","Swift Swim","Overpowering Fang","Silver Sparkle","Nurture and Heal","Danger Perception","Aurora Veil","Guts","Luminous Barrier","Last Pattern","Evoshock","Surrender Now","Secret Spring","Restoration","Light's End","Metal Links","Plasma Search","Psyscan","Abnormal Outbreak","Unnerve","Mystical Torch","Blessings of the Deep","Psychic Recharge","Tyrannical Heart","Wondrous Gift","First Law","Hydration","Vital Dance","Bulletproof","Fresh Egg","Rake It In","Comatose","Barrier Shrine","Bloodthirsty Eyes","Strong Charge","Water Veil","Weather Guard","Incandescent Body","Sparkling Ripples","Magnetic Circuit","Rock Wall","Flashing Head","Invasion","Freezing Gaze","Blow-Away Bomb","Power of Nature","Legendary Ascent","Unruly Claw","Power Draw","Weed Out","Icy Barrier","Irritating Pollen","Falling Star","Extend","Full Metal Body","Ultra Wall","Stormy Winds","Unit Color 2","Burning Fighter","Gale Shuriken","More Poison","Blissful Support","Roadblock","Precognitive Aura","Hay Fever","Final Beam","Pollen Stench","Matter Exchange","Gather Fire","Resolute Flame","Downpour","Murmurs of the Sea","Meet Up","Breath of the Leaves","Dragon Guard","Feather Arrow","Shining Mane","Disgusting Pollen","Slice Off","Wish Upon a Star","Iceberg Shield","Aero Trail","Own Tempo","Commotion","Jet Geyser","Final Hour","Earthen Aura","Night Cry","Hot Poison","Flower Shield","Jungle Totem","Energy Reload","Heat Cyclone","Cursed Whirlpool","Fabled Defense","Table Service","Psychic Transfer","Wall of Sand","Curative Pollen","Ultra Road","Illuminate","Blessings of the Frost","Queenly Reward","Hazardous Evolution","Floral Heal","Overheat","Secret Alleyway","Go for a Swim","Phantom Winds","Primal Vibes","Darkest Impulse","Buzzap","Dragon Veil","Holy Shield","Powder Protection","Dark Spell","Methane Leak","Ripples","Knockout Gas","Double Drive","Mist Concealment","Fresh Squeezed","Protective Shell","Molting","Blazing Energy","Mantine Surf","Harmonics","Benevolent Boss","Mysterious Ears","Ozone Wall","Aroma of Gratitude","Sprint","DAMAGE","HAND","Vessel of Life","Grass Cushion","Charging Up","Hard Shell Evolution","Roaring Resolve","Path of Life","Effect Spore","Charmed Charm","Happiness Supplement","Almighty Evolution","Nine Temptations","Unit Color 1","Unit Color 3","Floating Shell","Mysterious Guidance","Fluffy Pillow","Unseen Flash","MISSING","Mirror Counter","Mountain Pass","Thunderclap Zone","Powerful Squall","Blizzard Veil","Electro Shaker","Flare Effect","Poisonous Nest","Aqua Effect","Electric Effect","Nuzzly Gathering","Magnetic Warp","Bright Heal","Renegade Pulse","Water Down","Dance of the Ancients","Flower Supplement","Super Dynamo","Magnetic Flow","Miracle Shift","Enervating Pollen","Crystal Type","Shift Gear","Buzzap Thunder","Pull Up","Frenzied Escape","Captivating Rhythm","Victory Heal","Explosive Fire Dance","Snowed In","Vitality Cheer","Miracle Guard","Sand Flap","Venom Spray","Carry Off","Attract Energy","Fire Immunity","Evolution Helper","Prismatic Body","Vase Body","Lolling About","Call Signal","Speed Cheer","Blinking Lights","Raging Roar","Royal Guard","Key of Secrets","Scar Charge","Heatproof","Air Mail","Metal Symbol","Blessing of the Moone","Bulldoze","Ascension DNA","Hard Coat","Boiling Blood","Honey Gather","Initialize","Electric Start","Shadow Shield","Gnawing Curse","Princess's Cheers","Sticky Membrane","Steelworker","Quick-Ripening Herb","Floral Path to the Sky","Wild Dash","Shady Tail","Lost Out","Queen's Call","Stellar Wish","Power Huddle","Change Clothes","Ancient Custom","Dry Skin","Voice of the Sands","Lamentation","Antibodies","Shocking Light","Space Beacon","Tear Away","Wonder Lock","Treasure Hunt","Panic Spores","Scoop-Up Block","Adventurous Appetite","Dark Ambition","Defensive Scales","Violent Appetite","Disk Reload","Elusive Master","3-D Reset","Intimidating Ring","Devo Flash","Bursting Up","Darker Ring","Shining Vine","Swaying Strangle","Power Cheer","Whirlpool Suction","Spiritborne Evolution","Grim Marking","Dance of Tribute","Shadow Box","Obnoxious Whirring","Dusty Defense","Smug Face","Armor of the Sunne","Fighter's Roar","Ultra Burst","Sleepy Voice","Scampering Tail","Arf Arf Bark","Carry and Run","Swaddling Leaves","Pure Heart","Emergency Exit","Electric Swamp","Psychic Zone","Tag Transport","Secret Territory","Durable Blade","Tag Coach","Shadow Connection","Captivating Wink","Grind Up","Drowsing","Hydrating Drops","Troubleshooting","Shadow Void","Metamorphosis Gene","Despotic Fang","High Density Armor","Hyper Hypnosis","Mighty Shield","Tasting","Shadow Ear","Farewell Letter","Tenacious Bind","Fermenting Liquid","Shortcut","King's Song","Shining Spirit","Hand Block","Memories of Dawn","Energy Keeper","Drive Change","Sparkle Veil","Intuition","Flare Navigate","Six Feet Under","Color Change","Sparkling Induction","Royal Flash","Aqua Tube","Giant Water Shuriken","Zap Zone","Destiny Burst","Upside-Down Evolution","Stance Change","Blazing Mane","Slippery Soles","Giant Fan","Heavy Bumper","Leave It to the Wind","Bouffer","Sealing Scream"] \ No newline at end of file diff --git a/generated/illustrators.json b/generated/illustrators.json new file mode 100644 index 0000000..fad3719 --- /dev/null +++ b/generated/illustrators.json @@ -0,0 +1 @@ +["Kagemaru Himeno","Ryo Ueda","Midori Harada","Mizue","5ban Graphics","Ken Sugimori","Ayaka Yoshida","Sumiyoshi Kizuki","Masakazu Fukuda","Mitsuhiro Arita","Kouki Saitou","Keiji Kinebuchi","Sachiko Adachi","Toyste Beach","Takabon","Naoki Saito","Nakaoka","Shizurow","Tomokazu Komiya","Shin Nagasawa","TOKIYA","Mikiko Takeda","Yukiko Baba","Naoyo Kimura","sui","Kyoko Umemoto","Yusuke Ohmura","kawayoo","match","Suwama Chiaki","Hajime Kusajima","Tomoko Wakai","Atsuko Nishida","Hiroaki Ito","Masahiko Ishii","OOYAMA","kodama","Miki Tanaka","Eske Yoshinob","Sanosuke Sakuma","Kanako Eo","Wataru Kawahara","Ken Ikuji","Aya Kusube","Kent Kanetsuna","Yuka Morii","MAHOU","Hiroki Fuchino","Akira Komayama","Shigenori Negishi","Anesaki Dynamic","Takumi Akabane","Wataru Kawahara/Direc. Shinji Higuchi","Takao Unno","Hideaki Hakozaki","Hisao Nakamura","\"Big Mama\" Tagawa","Hiromichi Sugiyama","Yumi","Mina Nakai","Hironobu Yoshida","tetsuya koizumi","Saya Tsuruta","Noriko Hotta","Megumi Mizutani","nagimiso","Misa Tsutsui","Hitoshi Ariga","Takashi Yamaguchi","Tomokazu","You Iribi","Yoshinobu Saito","Daisuke Iwamoto","Toshinao Aoki","Hikaru Koike","Keiko Fukuyama","Katsura Tabata","Satoshi Shirai","Shin-ichi Yoshikawa","Jungo Suzuki","Hasuno","Kyoko Koizumi","Yusuke Shimada","Hideki Ishikawa","Ryota Saito","Maiko Fujiwara","Yusuke\nOhmura","Kazuo Yazawa","Mt. TBT","Sekio","Makoto Imai","chibi","HYOGONOSUKE","Yuri Umemura","Daisuke Ito","kirisAki","sowsow","Kazuyuki Kano","ryoma uratsuka","Kenkichi Toyama","Mana Ibe","DemizuPosuka","SATOSHI NAKAI","Masako Yamashita","Lee HyunJung","HiRON","Tomoaki Imakuni","Reiko Tanoue","Shinji Higuchi + Sachiko Eba","Shinji Higuchi + Noriko Takaya","GAME FREAK inc.","BERUBURI","0313","CR CG gangs","Motofumi Fujiwara","Asako Ito","PLANETA","Pani Kobayashi","Shinji Higuchi + Noriko Takaya/樋口真嗣+高屋法子","Shin-ichi Yoshida","Kimiya Masago","Studio Bora Inc.","Kazuaki Aihara","Yusuke Ishikawa","Kai Ishikawa","Hideyuki Nakajima","Hizuki Misono","Sachi Matoba","Yuichi Sawayama","Milky Isobe","Midroi Harada","Emi Miwa","Shibuzoh.","K. Hoshiba","Emi Yoshida","Asuka Iwashita","otumami","Satoshi Ohta","hatachu","Hiroki Asanuma","sadaji","PLANETA Igarashi","Big Mama\" Tagawa\"","so-taro","kanahei","Nobuyuki Fujimoto","miki kudo","Eri Yamaki","Saya Tsuruta","aky CG Works","M. Akiyama","Imakuni?","Kouji Tajima","K. Utsunomiya","Mikio Menjo","Aimi Tomita","Zu-Ka","T. Honda","Hideki Kazama","Atsuko Ujiie","Illus.&Direc.The Pokémon Company Art Team","Ryota Murayama","Emi Ando","take","AKIRA EGAWA","Christopher Rush","Kunihiko Yuyama","Shinji Higuchi","Craig Turvey","James Turner","Junsei Kuninobu","Nabana Kensaku","PLANETA Tsuji","K. Hoshiba","K Hoshiba","Tokumi Akabane","Yosuke Da Silva","Shinji Higuchi + Sachiko Eba/樋口真嗣 + 江場左知子","Etsuya Hattori","Benimaru Itoh","Gakuji Nomoto","Shinji Higuchi + Sachiko Eba/樋口真嗣+江場左知子","KEIICHIRO ITO","Ryuta Fuse","MikiTanaka","Yasuki Watanabe","Masakazu\nFukuda","ConceptLab","Hiroyuki Yamamoto","Kent Kanetsuna/Direc. Shinji Higuchi","Tomohiro Kitakaze","Mitsuhiro\nArita","Keiko Moritsugu","Ken Ikugi","PLANETA Otani","2017 Pikachu Project","MPC Film","Uta","Framestore","inose yukie","Ken Sugimori\nYusuke Ohmura","Sakiko Maeda","Noriko Uono","Dr.Ooyama","Illus.&Direc.The Pokémon Company Art-team","Shinji Higuchi + Sachiko Eba 樋口 真嗣 + 江場 左知子","Shinji Higuchi + Noriko Takaya 樋口 真嗣 + 高屋 法子","Shinji Higuchi + Sachiko Eba/樋口 真嗣 + 江場 左知子","Ken Sugimori Yusuke Ohmura","Tomomi Kaneko","Misaki Hashimoto","Huang Tzu En","Fumie Kittaka","Avec Yoko"] \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..c19c73e --- /dev/null +++ b/package.json @@ -0,0 +1,30 @@ +{ + "name": "tcgdex-compiler", + "version": "1.0.0", + "main": "index.js", + "repository": "git@git.delta-wings.net:tcgdex/compiler.git", + "author": "Avior ", + "license": "MIT", + "private": false, + "scripts": { + "gen:all": "yarn gen:types && yarn gen:illustrators && yarn gen:hp && yarn gen:tags && yarn gen:retreat && yarn gen:categories && yarn gen:rarities && yarn gen:cards && yarn gen:expansions", + "gen:types": "ts-node web/types/generator.ts", + "gen:illustrators": "ts-node web/illustrators/generator.ts", + "gen:hp": "ts-node web/hp/generator.ts", + "gen:tags": "ts-node web/tags/generator.ts", + "gen:retreat": "ts-node web/retreat/generator.ts", + "gen:categories": "ts-node web/categories/generator.ts", + "gen:rarities": "ts-node web/rarities/generator.ts", + "gen:cards": "ts-node web/cards/generator.ts", + "gen:expansions": "ts-node web/expansions/generator.ts", + "cards:test": "tsc --noEmit --project tsconfig-cards.json", + "cards:compile": "tsc --project tsconfig-cards.json" + }, + "dependencies": { + "@types/glob": "^7.1.1", + "@types/node": "^13.7.0", + "glob": "^7.1.6", + "ts-node": "^8.6.2", + "typescript": "^3.7.5" + } +} diff --git a/sdk b/sdk new file mode 160000 index 0000000..02b6d53 --- /dev/null +++ b/sdk @@ -0,0 +1 @@ +Subproject commit 02b6d5332a79f3e6d5fc446485e864ea8b7e54ec diff --git a/tsconfig-cards.json b/tsconfig-cards.json new file mode 100644 index 0000000..6bdfc8e --- /dev/null +++ b/tsconfig-cards.json @@ -0,0 +1,9 @@ +{ + "include": ["db/cards/**/**/*.ts"], + "compilerOptions": { + "target": "es5", + "module": "commonjs", + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true + } +} diff --git a/yarn.lock b/yarn.lock new file mode 100644 index 0000000..0762e89 --- /dev/null +++ b/yarn.lock @@ -0,0 +1,153 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +"@types/events@*": + version "3.0.0" + resolved "https://registry.yarnpkg.com/@types/events/-/events-3.0.0.tgz#2862f3f58a9a7f7c3e78d79f130dd4d71c25c2a7" + integrity sha512-EaObqwIvayI5a8dCzhFrjKzVwKLxjoG9T6Ppd5CEo07LRKfQ8Yokw54r5+Wq7FaBQ+yXRvQAYPrHwya1/UFt9g== + +"@types/glob@^7.1.1": + version "7.1.1" + resolved "https://registry.yarnpkg.com/@types/glob/-/glob-7.1.1.tgz#aa59a1c6e3fbc421e07ccd31a944c30eba521575" + integrity sha512-1Bh06cbWJUHMC97acuD6UMG29nMt0Aqz1vF3guLfG+kHHJhy3AyohZFFxYk2f7Q1SQIrNwvncxAE0N/9s70F2w== + dependencies: + "@types/events" "*" + "@types/minimatch" "*" + "@types/node" "*" + +"@types/minimatch@*": + version "3.0.3" + resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.3.tgz#3dca0e3f33b200fc7d1139c0cd96c1268cadfd9d" + integrity sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA== + +"@types/node@*", "@types/node@^13.7.0": + version "13.7.1" + resolved "https://registry.yarnpkg.com/@types/node/-/node-13.7.1.tgz#238eb34a66431b71d2aaddeaa7db166f25971a0d" + integrity sha512-Zq8gcQGmn4txQEJeiXo/KiLpon8TzAl0kmKH4zdWctPj05nWwp1ClMdAVEloqrQKfaC48PNLdgN/aVaLqUrluA== + +arg@^4.1.0: + version "4.1.3" + resolved "https://registry.yarnpkg.com/arg/-/arg-4.1.3.tgz#269fc7ad5b8e42cb63c896d5666017261c144089" + integrity sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA== + +balanced-match@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" + integrity sha1-ibTRmasr7kneFk6gK4nORi1xt2c= + +brace-expansion@^1.1.7: + version "1.1.11" + resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" + integrity sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA== + dependencies: + balanced-match "^1.0.0" + concat-map "0.0.1" + +buffer-from@^1.0.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.1.tgz#32713bc028f75c02fdb710d7c7bcec1f2c6070ef" + integrity sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A== + +concat-map@0.0.1: + version "0.0.1" + resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" + integrity sha1-2Klr13/Wjfd5OnMDajug1UBdR3s= + +diff@^4.0.1: + version "4.0.2" + resolved "https://registry.yarnpkg.com/diff/-/diff-4.0.2.tgz#60f3aecb89d5fae520c11aa19efc2bb982aade7d" + integrity sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A== + +fs.realpath@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" + integrity sha1-FQStJSMVjKpA20onh8sBQRmU6k8= + +glob@^7.1.6: + version "7.1.6" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6" + integrity sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA== + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^3.0.4" + once "^1.3.0" + path-is-absolute "^1.0.0" + +inflight@^1.0.4: + version "1.0.6" + resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" + integrity sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk= + dependencies: + once "^1.3.0" + wrappy "1" + +inherits@2: + version "2.0.4" + resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" + integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== + +make-error@^1.1.1: + version "1.3.5" + resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.5.tgz#efe4e81f6db28cadd605c70f29c831b58ef776c8" + integrity sha512-c3sIjNUow0+8swNwVpqoH4YCShKNFkMaw6oH1mNS2haDZQqkeZFlHS3dhoeEbKKmJB4vXpJucU6oH75aDYeE9g== + +minimatch@^3.0.4: + version "3.0.4" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" + integrity sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA== + dependencies: + brace-expansion "^1.1.7" + +once@^1.3.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" + integrity sha1-WDsap3WWHUsROsF9nFC6753Xa9E= + dependencies: + wrappy "1" + +path-is-absolute@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" + integrity sha1-F0uSaHNVNP+8es5r9TpanhtcX18= + +source-map-support@^0.5.6: + version "0.5.16" + resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.16.tgz#0ae069e7fe3ba7538c64c98515e35339eac5a042" + integrity sha512-efyLRJDr68D9hBBNIPWFjhpFzURh+KJykQwvMyW5UiZzYwoF6l4YMMDIJJEyFWxWCqfyxLzz6tSfUFR+kXXsVQ== + dependencies: + buffer-from "^1.0.0" + source-map "^0.6.0" + +source-map@^0.6.0: + version "0.6.1" + resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" + integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== + +ts-node@^8.6.2: + version "8.6.2" + resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-8.6.2.tgz#7419a01391a818fbafa6f826a33c1a13e9464e35" + integrity sha512-4mZEbofxGqLL2RImpe3zMJukvEvcO1XP8bj8ozBPySdCUXEcU5cIRwR0aM3R+VoZq7iXc8N86NC0FspGRqP4gg== + dependencies: + arg "^4.1.0" + diff "^4.0.1" + make-error "^1.1.1" + source-map-support "^0.5.6" + yn "3.1.1" + +typescript@^3.7.5: + version "3.7.5" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.7.5.tgz#0692e21f65fd4108b9330238aac11dd2e177a1ae" + integrity sha512-/P5lkRXkWHNAbcJIiHPfRoKqyd7bsyCma1hZNUGfn20qm64T6ZBlrzprymeu918H+mB/0rIg2gGK/BXkhhYgBw== + +wrappy@1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" + integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= + +yn@3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/yn/-/yn-3.1.1.tgz#1e87401a09d767c1d5eab26a6e4c185182d2eb50" + integrity sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==