fix: handle older generated docs better

This commit is contained in:
iCrawl
2023-11-08 12:30:32 +01:00
parent fffe70a039
commit 2bda883a0f
6 changed files with 28 additions and 13 deletions

View File

@@ -1,6 +1,7 @@
import { readFile } from 'node:fs/promises';
import { join } from 'node:path';
import { connect } from '@planetscale/database';
import { N_RECENT_VERSIONS } from '~/util/constants';
const sql = connect({
url: process.env.DATABASE_URL!,
@@ -20,7 +21,7 @@ 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);
return rows.map((row) => row.version).slice(0, N_RECENT_VERSIONS);
}
export async function fetchModelJSON(packageName: string, version: string): Promise<unknown | null> {