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:
Florian Bouillon 2021-10-12 11:05:12 +02:00 committed by GitHub
parent f5c22f87c0
commit 41c6ceab45
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 1 deletions

View File

@ -18,8 +18,17 @@ const VERSION = 'v2'
console.log('Prefetching pictures')
await fetchRemoteFile('https://assets.tcgdex.net/datas.json')
// Cleanup
await fs.rm(`./dist/${VERSION}/${lang}`, { force: true, recursive: true })
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) {
const path = `./endpoints/${file}`
console.log(file, 'Running Init')

View File

@ -32,7 +32,7 @@ const globCache: Record<string, Array<string>> = {}
export async function smartGlob(query: string): Promise<Array<string>> {
if (!globCache[query]) {
globCache[query] = await new Promise((res) => {
glob(query, (err, matches) => res(matches))
glob(query, (_, matches) => res(matches))
})
}
return globCache[query]