mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-13 10:03:31 +01:00
docs: split docs.api.json into multiple json files
This commit is contained in:
26
packages/scripts/src/shared.ts
Normal file
26
packages/scripts/src/shared.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import { request } from 'undici';
|
||||
|
||||
export const PACKAGES = [
|
||||
'discord.js',
|
||||
'brokers',
|
||||
'builders',
|
||||
'collection',
|
||||
'core',
|
||||
'formatters',
|
||||
'next',
|
||||
'proxy',
|
||||
'rest',
|
||||
'util',
|
||||
'voice',
|
||||
'ws',
|
||||
];
|
||||
|
||||
export async function fetchVersions(pkg: string) {
|
||||
const response = await request(`https://docs.discordjs.dev/api/info?package=${pkg}`);
|
||||
return response.body.json() as Promise<string[]>;
|
||||
}
|
||||
|
||||
export async function fetchVersionDocs(pkg: string, version: string) {
|
||||
const response = await request(`https://docs.discordjs.dev/docs/${pkg}/${version}.api.json`);
|
||||
return response.body.json();
|
||||
}
|
||||
Reference in New Issue
Block a user