mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-11 09:03:29 +01:00
feat: local and preview detection
This commit is contained in:
@@ -1,8 +1,13 @@
|
||||
import { sql } from '@vercel/postgres';
|
||||
import { NextResponse, type NextRequest } from 'next/server';
|
||||
import { PACKAGES } from './util/constants';
|
||||
import { ENV } from './util/env';
|
||||
|
||||
async function fetchLatestVersion(packageName: string): Promise<string> {
|
||||
if (ENV.IS_LOCAL_DEV) {
|
||||
return 'main';
|
||||
}
|
||||
|
||||
const { rows } = await sql`select version from documentation where name = ${packageName} order by version desc`;
|
||||
|
||||
return rows.map((row) => row.version).at(1) ?? 'main';
|
||||
|
||||
Reference in New Issue
Block a user