mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-16 11:33:30 +01:00
feat: discord-api-types on docs
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { readFile } from 'node:fs/promises';
|
||||
import { join } from 'node:path';
|
||||
import { PACKAGES_WITH_ENTRY_POINTS } from './constants';
|
||||
import { ENV } from './env';
|
||||
|
||||
export async function fetchSitemap({
|
||||
@@ -11,13 +12,14 @@ export async function fetchSitemap({
|
||||
readonly packageName: string;
|
||||
readonly version: string;
|
||||
}) {
|
||||
const hasEntryPoint = PACKAGES_WITH_ENTRY_POINTS.includes(packageName);
|
||||
const normalizedEntryPoint = entryPoint ? `${entryPoint}.` : '';
|
||||
|
||||
if (ENV.IS_LOCAL_DEV) {
|
||||
const fileContent = await readFile(
|
||||
join(
|
||||
process.cwd(),
|
||||
`../../packages/${packageName}/docs/${packageName}/split/${version}.${normalizedEntryPoint}sitemap.api.json`,
|
||||
`${hasEntryPoint || normalizedEntryPoint ? `../../../discord-api-types` : `../../packages/${packageName}`}/docs/${packageName}/split/${version}.${normalizedEntryPoint}sitemap.api.json`,
|
||||
),
|
||||
'utf8',
|
||||
);
|
||||
@@ -27,7 +29,7 @@ export async function fetchSitemap({
|
||||
|
||||
const isMain = version === 'main';
|
||||
const fileContent = await fetch(
|
||||
`${process.env.BLOB_STORAGE_URL}/rewrite/${packageName}/${version}.${normalizedEntryPoint}sitemap.api.json`,
|
||||
`${process.env.CF_R2_DOCS_BUCKET_URL}/${packageName}/${version}.${normalizedEntryPoint}sitemap.api.json`,
|
||||
{
|
||||
next: { revalidate: isMain ? 0 : 604_800 },
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user