mirror of
https://github.com/discordjs/discord.js.git
synced 2026-06-02 00:50:09 +00:00
17 lines
406 B
TypeScript
17 lines
406 B
TypeScript
import { sql } from '@vercel/postgres';
|
|
import { ENV } from './env';
|
|
|
|
export async function fetchLatestVersion(packageName: string): Promise<string> {
|
|
if (ENV.IS_LOCAL_DEV) {
|
|
return 'main';
|
|
}
|
|
|
|
try {
|
|
const { rows } = await sql`select version from documentation where name = ${packageName} order by version desc`;
|
|
|
|
return rows.map((row) => row.version).at(1) ?? 'main';
|
|
} catch {
|
|
return '';
|
|
}
|
|
}
|