mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-12 01:23:31 +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:
@@ -3,21 +3,24 @@ import { join } from 'node:path';
|
||||
import { ENV } from './env';
|
||||
|
||||
export async function fetchNode({
|
||||
entryPoint,
|
||||
item,
|
||||
packageName,
|
||||
version,
|
||||
}: {
|
||||
readonly entryPoint?: string | undefined;
|
||||
readonly item: any;
|
||||
readonly packageName: string;
|
||||
readonly version: string;
|
||||
}) {
|
||||
const normalizeItem = item.split(encodeURIComponent(':')).join('.').toLowerCase();
|
||||
const normalizedEntryPoint = entryPoint ? `${entryPoint}.` : '';
|
||||
const normalizeItem = item.replaceAll(':', '.').toLowerCase();
|
||||
|
||||
if (ENV.IS_LOCAL_DEV) {
|
||||
const fileContent = await readFile(
|
||||
join(
|
||||
process.cwd(),
|
||||
`../../packages/${packageName}/docs/${packageName}/split/${version}.${normalizeItem}.api.json`,
|
||||
`../../packages/${packageName}/docs/${packageName}/split/${version}.${normalizedEntryPoint}${normalizeItem}.api.json`,
|
||||
),
|
||||
'utf8',
|
||||
);
|
||||
@@ -27,7 +30,7 @@ export async function fetchNode({
|
||||
|
||||
const isMain = version === 'main';
|
||||
const fileContent = await fetch(
|
||||
`${process.env.BLOB_STORAGE_URL}/rewrite/${packageName}/${version}.${normalizeItem}.api.json`,
|
||||
`${process.env.BLOB_STORAGE_URL}/rewrite/${packageName}/${version}.${normalizedEntryPoint}${normalizeItem}.api.json`,
|
||||
{ next: { revalidate: isMain ? 0 : 604_800 } },
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user