mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-12 09:33:32 +01:00
feat(api-extractor): support multiple entrypoints (#10829)
* feat(api-extractor): support multiple entrypoints * chore: initial support in generateSplitDocumentation * chore: bring in line with upstream * refactor: multiple entrypoints in scripts * fix: split docs * feat: website * fix: docs failing on next * fix: don't include dtypes for now * refactor: don't fetch entrypoint if there is none --------- Co-authored-by: iCrawl <buechler.noel@outlook.com>
This commit is contained in:
34
apps/website/src/util/fetchEntryPoints.ts
Normal file
34
apps/website/src/util/fetchEntryPoints.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
import { readFile } from 'node:fs/promises';
|
||||
import { join } from 'node:path';
|
||||
// import { sql } from '@vercel/postgres';
|
||||
import { ENV } from './env';
|
||||
|
||||
export async function fetchEntryPoints(packageName: string, version: string) {
|
||||
if (ENV.IS_LOCAL_DEV) {
|
||||
const fileContent = await readFile(
|
||||
join(process.cwd(), `../../packages/${packageName}/docs/${packageName}/split/${version}.entrypoints.api.json`),
|
||||
'utf8',
|
||||
);
|
||||
|
||||
return JSON.parse(fileContent);
|
||||
}
|
||||
|
||||
// try {
|
||||
// const { rows } = await sql<{
|
||||
// entryPoint: string;
|
||||
// }>`select entryPoint from documentation where name = ${packageName} and version = ${version} order by
|
||||
// case
|
||||
// when version = 'main' then 0
|
||||
// else 1
|
||||
// end,
|
||||
// case
|
||||
// when version = 'main' then null
|
||||
// else string_to_array(version, '.')::int[]
|
||||
// end desc;
|
||||
// `;
|
||||
|
||||
// return rows;
|
||||
// } catch {
|
||||
return [];
|
||||
// }
|
||||
}
|
||||
Reference in New Issue
Block a user