mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-12 01:23:31 +01:00
refactor: use planetscale instead of custom api
This commit is contained in:
@@ -15,11 +15,12 @@ export async function fetchVersions(packageName: string): Promise<string[]> {
|
||||
return ['main'];
|
||||
}
|
||||
|
||||
const response = await fetch(`https://docs.discordjs.dev/api/info?package=${packageName}`, {
|
||||
next: { revalidate: 3_600 },
|
||||
});
|
||||
const { rows } = await sql.execute('select version from documentation where name = ? order by version desc', [
|
||||
packageName,
|
||||
]);
|
||||
|
||||
return response.json();
|
||||
// @ts-expect-error: https://github.com/planetscale/database-js/issues/71
|
||||
return rows[0].data;
|
||||
}
|
||||
|
||||
export async function fetchModelJSON(packageName: string, version: string): Promise<unknown> {
|
||||
|
||||
Reference in New Issue
Block a user