mirror of
https://github.com/tcgdex/compiler.git
synced 2025-04-22 10:42:09 +00:00
Include OpenAPI (#19)
* done Signed-off-by: Avior <github@avior.me> * Fixed no such file or directory error Signed-off-by: Avior <github@avior.me> * Fixed problem * Fixed fix
This commit is contained in:
parent
f5c22f87c0
commit
41c6ceab45
9
main.ts
9
main.ts
@ -18,8 +18,17 @@ const VERSION = 'v2'
|
|||||||
console.log('Prefetching pictures')
|
console.log('Prefetching pictures')
|
||||||
await fetchRemoteFile('https://assets.tcgdex.net/datas.json')
|
await fetchRemoteFile('https://assets.tcgdex.net/datas.json')
|
||||||
|
|
||||||
|
// Cleanup
|
||||||
await fs.rm(`./dist/${VERSION}/${lang}`, { force: true, recursive: true })
|
await fs.rm(`./dist/${VERSION}/${lang}`, { force: true, recursive: true })
|
||||||
console.log('Let\'s GO !')
|
console.log('Let\'s GO !')
|
||||||
|
|
||||||
|
// Process definitions
|
||||||
|
try {
|
||||||
|
await fs.mkdir(`./dist/${VERSION}/definitions`)
|
||||||
|
await fs.copyFile('./db/meta/definitions/openapi.yaml', `./dist/${VERSION}/definitions/openapi.yaml`)
|
||||||
|
} catch {}
|
||||||
|
|
||||||
|
// process endpoints
|
||||||
for await (const file of paths) {
|
for await (const file of paths) {
|
||||||
const path = `./endpoints/${file}`
|
const path = `./endpoints/${file}`
|
||||||
console.log(file, 'Running Init')
|
console.log(file, 'Running Init')
|
||||||
|
@ -32,7 +32,7 @@ const globCache: Record<string, Array<string>> = {}
|
|||||||
export async function smartGlob(query: string): Promise<Array<string>> {
|
export async function smartGlob(query: string): Promise<Array<string>> {
|
||||||
if (!globCache[query]) {
|
if (!globCache[query]) {
|
||||||
globCache[query] = await new Promise((res) => {
|
globCache[query] = await new Promise((res) => {
|
||||||
glob(query, (err, matches) => res(matches))
|
glob(query, (_, matches) => res(matches))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
return globCache[query]
|
return globCache[query]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user