mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-12 09:33:32 +01:00
ci: deploy on vercel again
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { readFile } from 'node:fs/promises';
|
||||
import { join } from 'node:path';
|
||||
import { connect } from '@planetscale/database';
|
||||
import { cache } from 'react';
|
||||
import { N_RECENT_VERSIONS } from '~/util/constants';
|
||||
|
||||
const sql = connect({
|
||||
@@ -11,7 +12,7 @@ const sql = connect({
|
||||
},
|
||||
});
|
||||
|
||||
export async function fetchVersions(packageName: string): Promise<string[]> {
|
||||
export const fetchVersions = cache(async (packageName: string) => {
|
||||
if (process.env.NEXT_PUBLIC_LOCAL_DEV || process.env.NEXT_PUBLIC_VERCEL_ENV === 'preview') {
|
||||
return ['main'];
|
||||
}
|
||||
@@ -22,9 +23,9 @@ export async function fetchVersions(packageName: string): Promise<string[]> {
|
||||
|
||||
// @ts-expect-error: https://github.com/planetscale/database-js/issues/71
|
||||
return rows.map((row) => row.version).slice(0, N_RECENT_VERSIONS);
|
||||
}
|
||||
});
|
||||
|
||||
export async function fetchModelJSON(packageName: string, version: string): Promise<unknown | null> {
|
||||
export const fetchModelJSON = cache(async (packageName: string, version: string) => {
|
||||
if (process.env.NEXT_PUBLIC_LOCAL_DEV) {
|
||||
let res;
|
||||
|
||||
@@ -55,4 +56,4 @@ export async function fetchModelJSON(packageName: string, version: string): Prom
|
||||
|
||||
// @ts-expect-error: https://github.com/planetscale/database-js/issues/71
|
||||
return rows[0]?.data ?? null;
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user