chore(website): Cleanup docusaurus setup (#3355)

* Update docusaurus typescript setup for v3

And fix lint-staged and eslint

* Enable automatic JSX runtime

* Remove babel config and dependencies

* update yarn.lock

* add typecheck to site workflow

* update typedoc config

* downgrade docusaurus packages

* Update site.yml

* Type context and options in webpack-docusaurus-plugin.ts

---------

Co-authored-by: Matt Hatcher <3768988+MatthewSH@users.noreply.github.com>
This commit is contained in:
Fleny
2024-02-09 20:34:59 +00:00
committed by GitHub
co-authored by Matt Hatcher
parent 96becc331d
commit f0ac958903
35 changed files with 1101 additions and 675 deletions
+36 -3
View File
@@ -10,7 +10,6 @@ on:
paths:
- 'website/**'
- '.github/workflows/site.yml'
- 'jsdoc2md.json'
- 'typedoc.json'
- 'package.json'
- 'packages/**'
@@ -26,7 +25,6 @@ permissions:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
name: Build Docusaurus
@@ -73,7 +71,42 @@ jobs:
uses: actions/upload-pages-artifact@v3
with:
path: ./website/build
typecheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
- name: Get yarn cache directory path (root)
id: yarn-cache-dir-path-root
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
with:
path: ${{ steps.yarn-cache-dir-path-root.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: yarn install (root)
run: yarn install --immutable
- name: Build all pkg
run: yarn release-build
- name: Build docs
run: yarn build:doc
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
working-directory: ./website
- uses: actions/cache@v3
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-site-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-site-
- run: yarn install --immutable
working-directory: ./website
- run: yarn typecheck
working-directory: ./website
deploy:
environment:
name: github-pages
-10
View File
@@ -15,16 +15,6 @@ node_modules
!.yarn/releases
!.yarn/sdks
!.yarn/versions
proxies/*/.yarn/*
!proxies/*/.yarn/patches
!proxies/*/.yarn/plugins
!proxies/*/.yarn/releases
!proxies/*/.yarn/sdks
!proxies/*/.yarn/versions
site/api_reference/generated/classes
site/api_reference/generated/enums
site/api_reference/generated/interfaces
site/api_reference/generated/modules
website/api_reference/generated/classes/*.md
website/api_reference/generated/enums/*.md
website/api_reference/generated/interfaces/*.md
-24
View File
@@ -1,24 +0,0 @@
{
"babel": {
"babelrc": false,
"extensions": ["ts", "tsx"],
"ignore": ["**/*.(test|spec).ts"],
"plugins": ["@babel/proposal-class-properties", "@babel/proposal-object-rest-spread"],
"presets": [
[
"@babel/preset-env",
{
"targets": {
"node": true
}
}
],
"@babel/preset-typescript"
]
},
"plugins": ["plugins/markdown", "node_modules/jsdoc-babel"],
"source": {
"excludePattern": ".+\\.(test|spec).ts",
"includePattern": ".+\\.ts(doc|x)?$"
}
}
+3 -7
View File
@@ -44,12 +44,8 @@
},
"lint-staged": {
"*.{js,jsx,ts,tsx,md,html,css}": "yarn run prettier --ignore-unknown --write",
"*.{js,ts,tsx}": [
"yarn run eslint --fix --config ./packages/eslint-config-discordeno/index.js --resolve-plugins-relative-to ."
]
"!(website)/**/*.{js,ts,tsx}": "yarn run eslint --fix --config ./packages/eslint-config-discordeno/index.js --resolve-plugins-relative-to .",
"website/**/*.{js,ts,tsx}": "yarn run eslint --fix --config ./website/.eslintrc.yml --resolve-plugins-relative-to ./website"
},
"packageManager": "yarn@4.0.2",
"dependencies": {
"typedoc-plugin-missing-exports": "^2.2.0"
}
"packageManager": "yarn@4.0.2"
}
+1 -1
View File
@@ -1,4 +1,4 @@
type OptionalizeAux<T extends object> = Id<
export type OptionalizeAux<T extends object> = Id<
{
[K in KeysWithUndefined<T>]?: Optionalize<T[K]>
} & {
+4
View File
@@ -12,6 +12,7 @@ export * from './channel.js'
export * from './component.js'
export * from './embed.js'
export * from './emoji.js'
export * from './entitlement.js'
export * from './gatewayBot.js'
export * from './guild.js'
export * from './integration.js'
@@ -19,11 +20,14 @@ export * from './interaction.js'
export * from './invite.js'
export * from './member.js'
export * from './message.js'
export * from './onboarding.js'
export * from './presence.js'
export * from './reverse/index.js'
export * from './role.js'
export * from './scheduledEvent.js'
export * from './sku.js'
export * from './stageInstance.js'
export * from './stageInviteInstance.js'
export * from './sticker.js'
export * from './team.js'
export * from './template.js'
+84 -72
View File
@@ -52,6 +52,9 @@ import type {
CamelizedDiscordVoiceRegion,
CamelizedDiscordWebhook,
CamelizedDiscordWelcomeScreen,
// Type is required for typedoc
// eslint-disable-next-line @typescript-eslint/no-unused-vars
ChannelTypes,
CreateApplicationCommand,
CreateAutoModerationRuleOptions,
CreateChannelInvite,
@@ -97,6 +100,9 @@ import type {
GetScheduledEvents,
GetUserGuilds,
GetWebhookMessageOptions,
// Type is required for typedoc
// eslint-disable-next-line @typescript-eslint/no-unused-vars
GuildFeatures,
InteractionCallbackData,
InteractionResponse,
ListArchivedThreads,
@@ -110,6 +116,12 @@ import type {
ModifyGuildTemplate,
ModifyRolePositions,
ModifyWebhook,
// Type is required for typedoc
// eslint-disable-next-line @typescript-eslint/no-unused-vars
ScheduledEventEntityType,
// Type is required for typedoc
// eslint-disable-next-line @typescript-eslint/no-unused-vars
ScheduledEventStatus,
SearchMembers,
StartThreadWithMessage,
StartThreadWithoutMessage,
@@ -390,7 +402,7 @@ export interface RestManager {
* @param channelId - The ID of the forum channel to create the thread within.
* @param options - The parameters for the creation of the thread.
* @param {string} [reason] - An optional reason for the action, to be included in the audit log.
* @returns An instance of {@link CamelizedDiscordChannel} with a nested {@link Message} object.
* @returns An instance of {@link CamelizedDiscordChannel} with a nested {@link CamelizedDiscordChannel} object.
*
* @remarks
* Requires the `CREATE_MESSAGES` permission.
@@ -406,7 +418,7 @@ export interface RestManager {
*
* @param command - The command to create.
* @param options - Additional options for the endpoint
* @returns An instance of the created {@link ApplicationCommand}.
* @returns An instance of the created {@link CamelizedDiscordApplicationCommand}.
*
* @remarks
* ⚠️ Creating a command with the same name as an existing command for your application will overwrite the old command.
@@ -442,7 +454,7 @@ export interface RestManager {
* @param command - The command to create.
* @param guildId - The ID of the guild to create the command for.
* @param options - Additional options for the endpoint
* @returns An instance of the created {@link ApplicationCommand}.
* @returns An instance of the created {@link CamelizedDiscordApplicationCommand}.
*
* @remarks
* ⚠️ Creating a command with the same name as an existing command for your application will overwrite the old command.
@@ -463,7 +475,7 @@ export interface RestManager {
*
* @param templateCode - The code of the template.
* @param options - The parameters for the creation of the guild.
* @returns An instance of the created {@link Guild}.
* @returns An instance of the created {@link CamelizedDiscordGuild}.
*
* @remarks
* ⚠️ This route can only be used by bots in __fewer than 10 guilds__.
@@ -494,7 +506,7 @@ export interface RestManager {
*
* @param guildId - The ID of the guild to create the template from.
* @param options - The parameters for the creation of the template.
* @returns An instance of the created {@link Template}.
* @returns An instance of the created {@link CamelizedDiscordTemplate}.
*
* @remarks
* Requires the `MANAGE_GUILD` permission.
@@ -545,12 +557,12 @@ export interface RestManager {
* @param guildId - The ID of the guild to create the scheduled event in.
* @param options - The parameters for the creation of the scheduled event.
* @param {string} [reason] - An optional reason for the action, to be included in the audit log.
* @returns An instance of the created {@link ScheduledEvent}.
* @returns An instance of the created {@link CamelizedDiscordScheduledEvent}.
*
* @remarks
* Requires the `MANAGE_EVENTS` permission.
*
* A guild can only have a maximum of 100 events with a status of {@link ScheduledEventStatus.Active} or {@link ScheduledEventStatus.Scheduled} (inclusive).
* A guild can only have a maximum of 100 events with a status of {@link ScheduledEventStatus}.Active or {@link ScheduledEventStatus}.Scheduled (inclusive).
*
* Fires a _Guild Scheduled Event Create_ gateway event.
*
@@ -610,7 +622,7 @@ export interface RestManager {
*
* @param channelId - The ID of the channel to delete.
* @param {string} [reason] - An optional reason for the action, to be included in the audit log.
* @returns An instance of the deleted {@link Channel}.
* @returns nothing
*
* @remarks
* For community guilds, the _Rules_, _Guidelines_ and _Community Update_ channels cannot be deleted.
@@ -970,7 +982,7 @@ export interface RestManager {
* @param commandId - The ID of the command to edit the permissions of.
* @param bearerToken - The bearer token to use to make the request.
* @param options - The parameters for the edit of the command permissions.
* @returns An instance of the edited {@link ApplicationCommandPermission}.
* @returns An instance of the edited {@link CamelizedDiscordGuildApplicationCommandPermissions}.
*
* @remarks
* The bearer token requires the `applications.commands.permissions.update` scope to be enabled, and to have access to the guild whose ID has been provided in the parameters.
@@ -1019,7 +1031,7 @@ export interface RestManager {
* @returns An instance of the edited {@link CamelizedDiscordChannel}.
*
* @remarks
* If editing a channel of type {@link ChannelTypes.GroupDm}:
* If editing a channel of type {@link ChannelTypes}.GroupDm:
* - Fires a _Channel Update_ gateway event.
*
* If editing a thread channel:
@@ -1035,7 +1047,7 @@ export interface RestManager {
*
* - Only permissions the bot user has in the guild or parent channel can be allowed/denied __unless__ the bot user has a `MANAGE_ROLES` permission override in the channel.
*
* - If modifying a channel of type {@link ChannelTypes.GuildCategory}:
* - If modifying a channel of type {@link ChannelTypes}.GuildCategory:
* - Fires a _Channel Update_ gateway event for each child channel impacted in this change.
* - Otherwise:
* - Fires a _Channel Update_ gateway event.
@@ -1096,7 +1108,7 @@ export interface RestManager {
* @param token - The interaction token to use, provided in the original interaction.
* @param messageId - The ID of the message to edit.
* @param options - The parameters for the edit of the message.
* @returns An instance of the edited {@link Message}.
* @returns An instance of the edited {@link CamelizedDiscordMessage}.
*
* @remarks
* Unlike `editMessage()`, this endpoint allows the bot user to act without needing to see the channel the message is in.
@@ -1113,7 +1125,7 @@ export interface RestManager {
*
* @param commandId - The ID of the command to edit.
* @param options - The parameters for the edit of the command.
* @returns An instance of the edited {@link ApplicationCommand}.
* @returns An instance of the edited {@link CamelizedDiscordApplicationCommand}.
*
* @see {@link https://discord.com/developers/docs/interactions/application-commands#edit-global-application-command}
*/
@@ -1125,12 +1137,12 @@ export interface RestManager {
* @param shardId - The ID of the shard the guild is in.
* @param options - The parameters for the edit of the guild.
* @param {string} [reason] - An optional reason for the action, to be included in the audit log.
* @returns An instance of the edited {@link Guild}.
* @returns An instance of the edited {@link CamelizedDiscordGuild}.
*
* @remarks
* Requires the `MANAGE_GUILD` permission.
*
* If attempting to add or remove the {@link GuildFeatures.Community} feature:
* If attempting to add or remove the {@link GuildFeatures}.Community feature:
* - Requires the `ADMINISTRATOR` permission.
*
* Fires a _Guild Update_ gateway event.
@@ -1144,7 +1156,7 @@ export interface RestManager {
* @param guildId - The ID of the guild the command is registered in.
* @param commandId - The ID of the command to edit.
* @param options - The parameters for the edit of the command.
* @returns An instance of the edited {@link ApplicationCommand}.
* @returns An instance of the edited {@link CamelizedDiscordApplicationCommand}.
*
* @see {@link https://discord.com/developers/docs/interactions/application-commands#edit-guild-application-command}
*/
@@ -1183,7 +1195,7 @@ export interface RestManager {
* @param guildId - The ID of the guild to edit a template of.
* @param templateCode - The code of the template to edit.
* @param options - The parameters for the edit of the template.
* @returns An instance of the edited {@link Template}.
* @returns An instance of the edited {@link CamelizedDiscordTemplate}.
*
* @remarks
* Requires the `MANAGE_GUILD` permission.
@@ -1199,7 +1211,7 @@ export interface RestManager {
* @param channelId - The ID of the channel to edit the message in.
* @param messageId - The IDs of the message to edit.
* @param options - The parameters for the edit of the message.
* @returns An instance of the edited {@link Message}.
* @returns An instance of the edited {@link CamelizedDiscordMessage}.
*
* @remarks
* If editing another user's message:
@@ -1216,7 +1228,7 @@ export interface RestManager {
*
* @param token - The interaction token to use, provided in the original interaction.
* @param options - The parameters for the edit of the response.
* @returns An instance of the edited {@link Message}.
* @returns An instance of the edited {@link CamelizedDiscordMessage}.
*
* @remarks
* Unlike `editMessage()`, this endpoint allows the bot user to act without needing to see the channel the message is in.
@@ -1303,14 +1315,14 @@ export interface RestManager {
* @param guildId - The ID of the guild to edit the scheduled event in.
* @param eventId - The ID of the scheduled event to edit.
* @param {string} [reason] - An optional reason for the action, to be included in the audit log.
* @returns An instance of the edited {@link ScheduledEvent}.
* @returns An instance of the edited {@link CamelizedDiscordScheduledEvent}.
*
* @remarks
* Requires the `MANAGE_EVENTS` permission.
*
* To start or end an event, modify the event's `status` property.
*
* The `entity_metadata` property is discarded for events whose `entity_type` is not {@link ScheduledEventEntityType.External}.
* The `entity_metadata` property is discarded for events whose `entity_type` is not {@link ScheduledEventEntityType}.External.
*
* Fires a _Guild Scheduled Event Update_ gateway event.
*
@@ -1426,7 +1438,7 @@ export interface RestManager {
* @param guildId - The ID of the guild to edit the welcome screen of.
* @param options - The parameters for the edit of the welcome screen.
* @param {string} [reason] - An optional reason for the action, to be included in the audit log.
* @returns An instance of the edited {@link WelcomeScreen}.
* @returns An instance of the edited {@link CamelizedDiscordWelcomeScreen}.
*
* @remarks
* Requires the `MANAGE_GUILD` permission.
@@ -1445,7 +1457,7 @@ export interface RestManager {
*
* @param guildId - The ID of the guild to edit the settings of the widget of.
* @param {string} [reason] - An optional reason for the action, to be included in the audit log.
* @returns An instance of the edited {@link GuildWidgetSettings}.
* @returns An instance of the edited {@link CamelizedDiscordGuildWidgetSettings}.
*
* @remarks
* Requires the `MANAGE_GUILD` permission.
@@ -1544,7 +1556,7 @@ export interface RestManager {
* @param guildId - The ID of the guild the command is registered in.
* @param commandId - The ID of the command to get the permissions of.
* @param options - The OAuth2 related optional parameters for the endpoint
* @returns An instance of {@link ApplicationCommandPermission}.
* @returns An instance of {@link CamelizedDiscordGuildApplicationCommandPermissions}.
*
* @remarks
* Then specifying the options object the access token passed-in requires the OAuth2 scope `applications.commands.permissions.update`
@@ -1561,7 +1573,7 @@ export interface RestManager {
*
* @param guildId - The ID of the guild to get the permissions objects of.
* @param options - The OAuth2 related optional parameters for the endpoint
* @returns A collection of {@link ApplicationCommandPermission} objects assorted by command ID.
* @returns A collection of {@link CamelizedDiscordGuildApplicationCommandPermissions} objects assorted by command ID.
*
* @remarks
* Then specifying the options object the access token passed-in requires the OAuth2 scope `applications.commands.permissions.update`
@@ -1577,7 +1589,7 @@ export interface RestManager {
*
* @param guildId - The ID of the guild to get the audit log of.
* @param options - The parameters for the fetching of the audit log.
* @returns An instance of {@link AuditLog}.
* @returns An instance of {@link CamelizedDiscordAuditLog}.
*
* @remarks
* Requires the `VIEW_AUDIT_LOG` permission.
@@ -1613,7 +1625,7 @@ export interface RestManager {
/**
* Gets the list of available voice regions.
*
* @returns A collection of {@link VoiceRegions | VoiceRegion} objects assorted by voice region ID.
* @returns A collection of {@link CamelizedDiscordVoiceRegion} objects assorted by voice region ID.
*/
getAvailableVoiceRegions: () => Promise<CamelizedDiscordVoiceRegion[]>
/**
@@ -1651,7 +1663,7 @@ export interface RestManager {
* @returns An instance of {@link CamelizedDiscordChannel}.
*
* @remarks
* If the channel is a thread, a {@link ThreadMember} object is included in the result.
* If the channel is a thread, a {@link CamelizedDiscordThreadMember} object is included in the result.
*
* @see {@link https://discord.com/developers/docs/resources/channel#get-channel}
*/
@@ -1750,7 +1762,7 @@ export interface RestManager {
*
* @param token - The interaction token to use, provided in the original interaction.
* @param messageId - The ID of the message to get.
* @returns An instance of {@link Message}.
* @returns An instance of {@link CamelizedDiscordMessage}.
*
* @remarks
* Unlike `getMessage()`, this endpoint allows the bot user to act without:
@@ -1768,7 +1780,7 @@ export interface RestManager {
* Gets a global application command by its ID.
*
* @param commandId - The ID of the command to get.
* @returns An instance of {@link ApplicationCommand}.
* @returns An instance of {@link CamelizedDiscordApplicationCommand}.
*
* @see {@link https://discord.com/developers/docs/interactions/application-commands#get-global-application-command}
*/
@@ -1776,7 +1788,7 @@ export interface RestManager {
/**
* Gets the list of your bot's global application commands.
*
* @returns A collection of {@link ApplicationCommand} objects assorted by command ID.
* @returns A collection of {@link CamelizedDiscordApplicationCommand} objects assorted by command ID.
*
* @see {@link https://discord.com/developers/docs/interactions/application-commands#get-global-application-commands}
*/
@@ -1786,7 +1798,7 @@ export interface RestManager {
*
* @param guildId - The ID of the guild to get.
* @param options - The parameters for the fetching of the guild.
* @returns An instance of {@link Guild}.
* @returns An instance of {@link CamelizedDiscordGuild}.
*
* @see {@link https://discord.com/developers/docs/resources/guild#get-guild}
*/
@@ -1796,7 +1808,7 @@ export interface RestManager {
*
* @param bearerToken - The access token of the user, if unspecified the bot token is used instead
* @param options - The parameters for the fetching of the guild.
* @returns An instance of {@link Guild}.
* @returns An instance of {@link CamelizedDiscordGuild}.
*
* @remarks
* If used with an access token, the token needs to have the `guilds` scope
@@ -1809,7 +1821,7 @@ export interface RestManager {
*
* @param guildId - The ID of the guild the command is registered in.
* @param commandId - The ID of the command to get.
* @returns An instance of {@link ApplicationCommand}.
* @returns An instance of {@link CamelizedDiscordApplicationCommand}.
*
* @see {@link https://discord.com/developers/docs/interactions/application-commands#get-guild-application-command}
*/
@@ -1818,7 +1830,7 @@ export interface RestManager {
* Gets the list of application commands registered by your bot in a guild.
*
* @param guildId - The ID of the guild the commands are registered in.
* @returns A collection of {@link ApplicationCommand} objects assorted by command ID.
* @returns A collection of {@link CamelizedDiscordApplicationCommand} objects assorted by command ID.
*
* @see {@link https://discord.com/developers/docs/interactions/application-commands#get-global-application-commandss}
*/
@@ -1827,7 +1839,7 @@ export interface RestManager {
* Gets the preview of a guild by a guild's ID.
*
* @param guildId - The ID of the guild to get the preview of.
* @returns An instance of {@link GuildPreview}.
* @returns An instance of {@link CamelizedDiscordGuildPreview}.
*
* @remarks
* If the bot user is not in the guild, the guild must be discoverable.
@@ -1862,7 +1874,7 @@ export interface RestManager {
* Gets a template by its code.
*
* @param templateCode - The code of the template to get.
* @returns An instance of {@link Template}.
* @returns An instance of {@link CamelizedDiscordTemplate}.
*
* @remarks
* Requires the `MANAGE_GUILD` permission.
@@ -1874,7 +1886,7 @@ export interface RestManager {
* Gets the list of templates for a guild.
*
* @param guildId - The ID of the guild to get the list of templates for.
* @returns A collection of {@link Template} objects assorted by template code.
* @returns A collection of {@link CamelizedDiscordTemplate} objects assorted by template code.
*
* @remarks
* Requires the `MANAGE_GUILD` permission.
@@ -1898,7 +1910,7 @@ export interface RestManager {
* Gets the list of integrations attached to a guild.
*
* @param guildId - The ID of the guild to get the list of integrations from.
* @returns A collection of {@link Integration} objects assorted by integration ID.
* @returns A collection of {@link CamelizedDiscordIntegration} objects assorted by integration ID.
*
* @remarks
* Requires the `MANAGE_GUILD` permission.
@@ -1920,7 +1932,7 @@ export interface RestManager {
* Gets the list of invites for a guild.
*
* @param guildId - The ID of the guild to get the invites from.
* @returns A collection of {@link InviteMetadata | Invite} objects assorted by invite code.
* @returns A collection of {@link CamelizedDiscordInviteMetadata} objects assorted by invite code.
*
* @remarks
* Requires the `MANAGE_GUILD` permission.
@@ -1933,7 +1945,7 @@ export interface RestManager {
*
* @param channelId - The ID of the channel from which to get the message.
* @param messageId - The ID of the message to get.
* @returns An instance of {@link Message}.
* @returns An instance of {@link CamelizedDiscordMessage}.
*
* @remarks
* Requires that the bot user be able to see the contents of the channel in which the message was posted.
@@ -1949,7 +1961,7 @@ export interface RestManager {
*
* @param channelId - The ID of the channel from which to get the messages.
* @param options - The parameters for the fetching of the messages.
* @returns A collection of {@link Message} objects assorted by message ID.
* @returns A collection of {@link CamelizedDiscordMessage} objects assorted by message ID.
*
* @remarks
* Requires that the bot user be able to see the contents of the channel in which the messages were posted.
@@ -1963,7 +1975,7 @@ export interface RestManager {
/**
* Returns the list of sticker packs available.
*
* @returns A collection of {@link StickerPack} objects assorted by sticker ID.
* @returns A collection of {@link CamelizedDiscordStickerPack} objects assorted by sticker ID.
*
* @see {@link https://discord.com/developers/docs/resources/sticker#list-sticker-packs}
*/
@@ -1972,7 +1984,7 @@ export interface RestManager {
* Gets the initial message response to an interaction.
*
* @param token - The interaction token to use, provided in the original interaction.
* @returns An instance of {@link Message}.
* @returns An instance of {@link CamelizedDiscordMessage}.
*
* @remarks
* Unlike `getMessage()`, this endpoint allows the bot user to act without:
@@ -1988,7 +2000,7 @@ export interface RestManager {
* Gets the pinned messages for a channel.
*
* @param channelId - The ID of the channel to get the pinned messages for.
* @returns A collection of {@link Message} objects assorted by message ID.
* @returns A collection of {@link CamelizedDiscordMessage} objects assorted by message ID.
*
* @remarks
* Requires that the bot user be able to see the contents of the channel in which the messages were posted.
@@ -2010,7 +2022,7 @@ export interface RestManager {
* Requires the `READ_MESSAGE_HISTORY` permission.
* Requires the `MANAGE_THREADS` permission.
*
* Returns threads of type {@link ChannelTypes.GuildPrivateThread}.
* Returns threads of type {@link ChannelTypes}.GuildPrivateThread.
*
* Threads are ordered by the `archive_timestamp` property included in the metadata of the object in descending order.
*
@@ -2027,7 +2039,7 @@ export interface RestManager {
* @remarks
* Requires the `READ_MESSAGE_HISTORY` permission.
*
* Returns threads of type {@link ChannelTypes.GuildPrivateThread}.
* Returns threads of type {@link ChannelTypes}.GuildPrivateThread.
*
* Threads are ordered by the `id` property in descending order.
*
@@ -2052,13 +2064,13 @@ export interface RestManager {
*
* @param channelId - The ID of the channel to get the archived threads for.
* @param options - The parameters for the fetching of threads.
* @returns An instance of {@link ArchivedThreads}.
* @returns An instance of {@link CamelizedDiscordArchivedThreads}.
*
* @remarks
* Requires the `READ_MESSAGE_HISTORY` permission.
*
* If called on a channel of type {@link ChannelTypes.GuildText}, returns threads of type {@link ChannelTypes.GuildPublicThread}.
* If called on a channel of type {@link ChannelTypes.GuildNews}, returns threads of type {@link ChannelTypes.GuildNewsThread}.
* If called on a channel of type {@link ChannelTypes}.GuildText, returns threads of type {@link ChannelTypes}.GuildPublicThread.
* If called on a channel of type {@link ChannelTypes}.GuildNews, returns threads of type {@link ChannelTypes}.GuildNewsThread.
*
* Threads are ordered by the `archive_timestamp` property included in the metadata of the object in descending order.
*
@@ -2069,10 +2081,10 @@ export interface RestManager {
* Gets the list of roles for a guild.
*
* @param guildId - The ID of the guild to get the list of roles for.
* @returns A collection of {@link DisorcRole} objects assorted by role ID.
* @returns A collection of {@link CamelizedDiscordRole} objects assorted by role ID.
*
* @remarks
* ⚠️ This endpoint should be used sparingly due to {@link User} objects already being included in guild payloads.
* ⚠️ This endpoint should be used sparingly due to {@link CamelizedDiscordRole} objects already being included in guild payloads.
*
* @see {@link https://discord.com/developers/docs/resources/guild#get-guild-roles}
*/
@@ -2083,7 +2095,7 @@ export interface RestManager {
* @param guildId - The ID of the guild to get the scheduled event from.
* @param eventId - The ID of the scheduled event to get.
* @param options - The parameters for the fetching of the scheduled event.
* @returns An instance of {@link ScheduledEvent}.
* @returns An instance of {@link CamelizedDiscordScheduledEvent}.
*
* @see {@link https://discord.com/developers/docs/resources/guild-scheduled-event#get-guild-scheduled-event}
*/
@@ -2093,7 +2105,7 @@ export interface RestManager {
*
* @param guildId - The ID of the guild to get the scheduled events from.
* @param options - The parameters for the fetching of the scheduled events.
* @returns A collection of {@link ScheduledEvent} objects assorted by event ID.
* @returns A collection of {@link CamelizedDiscordScheduledEvent} objects assorted by event ID.
*
* @see {@link https://discord.com/developers/docs/resources/guild-scheduled-event#list-scheduled-events-for-guild}
*/
@@ -2104,7 +2116,7 @@ export interface RestManager {
* @param guildId - The ID of the guild to get the subscribers to the scheduled event from.
* @param eventId - The ID of the scheduled event to get the subscribers of.
* @param options - The parameters for the fetching of the subscribers.
* @returns A collection of {@link User} objects assorted by user ID.
* @returns A collection of {@link CamelizedDiscordUser} objects assorted by user ID.
*
* @remarks
* Requires the `MANAGE_EVENTS` permission.
@@ -2167,7 +2179,7 @@ export interface RestManager {
* @param messageId - The ID of the message to get the users for.
* @param reaction - The reaction for which to get the users.
* @param options - The parameters for the fetching of the users.
* @returns A collection of {@link User} objects assorted by user ID.
* @returns A collection of {@link CamelizedDiscordUser} objects assorted by user ID.
*
* @see {@link https://discord.com/developers/docs/resources/channel#get-reactions}
*/
@@ -2218,7 +2230,7 @@ export interface RestManager {
* Gets information about the vanity url of a guild.
*
* @param guildId - The ID of the guild to get the vanity url information for.
* @returns An instance of {@link VanityUrl}.
* @returns An instance of {@link CamelizedDiscordVanityUrl}.
*
* @remarks
* Requires the `MANAGE_GUILD` permission.
@@ -2232,7 +2244,7 @@ export interface RestManager {
* Gets the list of voice regions for a guild.
*
* @param guildId - The ID of the guild to get the voice regions for.
* @returns A collection of {@link VoiceRegions | VoiceRegion} objects assorted by voice region ID.
* @returns A collection of {@link CamelizedDiscordVoiceRegion} objects assorted by voice region ID.
*
* @see {@link https://discord.com/developers/docs/resources/guild#get-guild-voice-regions}
*/
@@ -2280,7 +2292,7 @@ export interface RestManager {
* Gets the welcome screen for a guild.
*
* @param guildId - The ID of the guild to get the welcome screen for.
* @returns An instance of {@link WelcomeScreen}.
* @returns An instance of {@link CamelizedDiscordWelcomeScreen}.
*
* @remarks
* If the welcome screen is not enabled:
@@ -2293,7 +2305,7 @@ export interface RestManager {
* Gets the guild widget by guild ID.
*
* @param guildId - The ID of the guild to get the widget of.
* @returns An instance of {@link GuildWidget}.
* @returns An instance of {@link CamelizedDiscordGuildWidget}.
*
* @remarks
* Fires an `INVITE_CREATED` Gateway event when an invite channel is defined and a new `Invite` is generated.
@@ -2305,7 +2317,7 @@ export interface RestManager {
* Gets the settings of a guild's widget.
*
* @param guildId - The ID of the guild to get the widget of.
* @returns An instance of {@link GuildWidgetSettings}.
* @returns An instance of {@link CamelizedDiscordGuildWidgetSettings}.
*
* @remarks
* Requires the `MANAGE_GUILD` permission.
@@ -2355,7 +2367,7 @@ export interface RestManager {
*
* @param channelId - The ID of the announcement channel.
* @param messageId - The ID of the message to cross-post.
* @returns An instance of the cross-posted {@link Message}.
* @returns An instance of the cross-posted {@link CamelizedDiscordMessage}.
*
* @remarks
* Requires the `SEND_MESSAGES` permission.
@@ -2391,7 +2403,7 @@ export interface RestManager {
* @param userId - The user ID of the thread member to remove.
*
* @remarks
* If the thread is of type {@link ChannelTypes.GuildPrivateThread}, requires to be the creator of the thread.
* If the thread is of type {@link ChannelTypes}.GuildPrivateThread, requires to be the creator of the thread.
* Otherwise, requires the `MANAGE_THREADS` permission.
*
* Requires the thread not be archived.
@@ -2442,7 +2454,7 @@ export interface RestManager {
*
* @param token - The interaction token to use, provided in the original interaction.
* @param options - The parameters for the creation of the message.
* @returns An instance of the created {@link Message}.
* @returns An instance of the created {@link CamelizedDiscordMessage}.
*
* @remarks
* ⚠️ Interaction tokens are only valid for _15 minutes_.
@@ -2464,7 +2476,7 @@ export interface RestManager {
* @param interactionId - The ID of the interaction to respond to.
* @param token - The interaction token to use, provided in the original interaction.
* @param options - The parameters for the creation of the message.
* @returns An instance of the created {@link Message}.
* @returns An instance of the created {@link CamelizedDiscordMessage}.
*
* @remarks
* ⚠️ Interaction tokens are only valid for _15 minutes_.
@@ -2487,12 +2499,12 @@ export interface RestManager {
* @param messageId - The ID of the message to use as the thread's point of origin.
* @param options - The parameters to use for the creation of the thread.
* @param {string} [reason] - An optional reason for the action, to be included in the audit log.
* @returns An instance of the created {@link Channel | Thread}.
* @returns An instance of the created {@link CamelizedDiscordChannel}.
*
* @remarks
* If called on a channel of type {@link ChannelTypes.GuildText}, creates a {@link ChannelTypes.GuildPublicThread}.
* If called on a channel of type {@link ChannelTypes.GuildNews}, creates a {@link ChannelTypes.GuildNewsThread}.
* Does not work on channels of type {@link ChannelTypes.GuildForum}.
* If called on a channel of type {@link ChannelTypes}.GuildText, creates a {@link ChannelTypes}.GuildPublicThread.
* If called on a channel of type {@link ChannelTypes}.GuildNews, creates a {@link ChannelTypes}.GuildNewsThread.
* Does not work on channels of type {@link ChannelTypes}.GuildForum.
*
* The ID of the created thread will be the same as the ID of the source message.
*
@@ -2526,7 +2538,7 @@ export interface RestManager {
* Synchronises a template with the current state of a guild.
*
* @param guildId - The ID of the guild to synchronise a template of.
* @returns An instance of the edited {@link Template}.
* @returns An instance of the edited {@link CamelizedDiscordTemplate}.
*
* @remarks
* Requires the `MANAGE_GUILD` permission.
@@ -2556,7 +2568,7 @@ export interface RestManager {
*
* @param commands - The list of commands to use to overwrite the previous list.
* @param options - Additional options for the endpoint.
* @returns A collection of {@link ApplicationCommand} objects assorted by command ID.
* @returns A collection of {@link CamelizedDiscordApplicationCommand} objects assorted by command ID.
*
* @remarks
* ❗ Commands that are not present in the `commands` array will be __deleted__.
@@ -2578,7 +2590,7 @@ export interface RestManager {
* @param guildId - The ID of the guild whose list of commands to overwrite.
* @param commands - The list of commands to use to overwrite the previous list.
* @param options - Additional options for the endpoint.
* @returns A collection of {@link ApplicationCommand} objects assorted by command ID.
* @returns A collection of {@link CamelizedDiscordApplicationCommand} objects assorted by command ID.
*
* @remarks
* ❗ Commands that are not present in the `commands` array will be __deleted__.
+1 -1
View File
@@ -102,6 +102,7 @@ export function guildBannerUrl(
* Builds a URL to the guild icon stored in the Discord CDN.
*
* @param guildId - The ID of the guild to get the link to the banner for.
* @param imageHash - The hash identifying the event cover image.
* @param options - The parameters for the building of the URL.
* @returns The link to the resource or `undefined` if no banner has been set.
*/
@@ -176,7 +177,6 @@ export function guildDiscoverySplashUrl(
* Builds the URL to a guild scheduled event cover stored in the Discord CDN.
*
* @param eventId - The ID of the scheduled event to get the cover of.
* @param imageHash - The hash identifying the event cover image.
* @param options - The parameters for the building of the URL.
* @returns The link to the resource or `undefined`.
*/
+28 -11
View File
@@ -1,10 +1,11 @@
/* eslint-disable @typescript-eslint/no-unsafe-argument */
/* eslint-disable @typescript-eslint/explicit-function-return-type */
import fs from 'node:fs'
import path from 'node:path'
// these two paths may vary depending on where you place this script, and your project structure including where typedoc generates its output files.
const typedocOutPath = await import('../typedoc.json', {
assert: { type: 'json' },
}).then((module) => module.default.out)
const typedocOutPath = await import('../typedoc.json', { assert: { type: 'json' } }).then((module) => module.default.out)
async function* walk(dir) {
for await (const d of await fs.promises.opendir(dir)) {
@@ -18,13 +19,33 @@ for await (let filepath of walk(typedocOutPath)) {
if (filepath.endsWith('.json')) continue
let file = fs.readFileSync(filepath, 'utf-8')
if (filepath.endsWith('generated/README.md')) {
if (filepath.endsWith(`generated${path.sep}README.md`)) {
file = [
'discordeno-monorepo / [Modules](modules.md)',
'',
'# Discordeno',
'',
'Thank you for using Discordeno. These docs are generated automatically. If you see any issues please contact us on [Discord](https://discord.gg/ddeno)',
'',
].join('\n')
}
if (filepath.endsWith(`generated${path.sep}modules.md`)) {
file = [
'[discordeno-monorepo](README.md) / Modules',
'',
'# discordeno-monorepo',
'',
'## Table of contents',
'',
'### Modules',
'',
'- [@discordeno/bot](modules/Bot)',
'- [@discordeno/gateway](modules/Gateway)',
'- [@discordeno/rest](modules/Rest)',
'- [@discordeno/types](modules/Types)',
'- [@discordeno/utils](modules/Utils)',
'',
].join('\n')
}
@@ -53,10 +74,9 @@ for await (let filepath of walk(typedocOutPath)) {
for (const form of cleanForms) {
// Clean the file of the ugly forms
file = file.replace(new RegExp(form.ugly, 'gi'), form.clean || '')
const lastIndex = filepath.lastIndexOf('/')
file = file.replace(new RegExp(form.ugly, 'gi'), form.clean ?? '')
// Clean the file name of the ugly forms
if (!filepath.endsWith(`${form.ugly}md`)) filepath = filepath.replace(new RegExp(form.ugly, 'gi'), form.clean || '')
if (!filepath.endsWith(`${form.ugly}md`)) filepath = filepath.replace(new RegExp(form.ugly, 'gi'), form.clean ?? '')
}
file = file.replace(/(?<!\\)(<|>|,|=|\{|\})/gi, `\\$1`)
@@ -68,13 +88,10 @@ for await (let filepath of walk(typedocOutPath)) {
filepath = filepath.replace('/md', '/README.md')
}
// if (filepath.includes('/generated/classes')) console.log('file in classes 2', filepath)
if (filepath.includes('/generated/modules/discordeno_')) {
const mod = filepath.substring(filepath.lastIndexOf('_') + 1)
filepath = filepath.substring(0, filepath.lastIndexOf('/')) + `/${mod[0].toUpperCase()}${mod.substring(1)}`
}
fs.writeFileSync(filepath, file, function (err, result) {
if (err) throw err
})
fs.writeFileSync(filepath, file)
}
-1
View File
@@ -2,7 +2,6 @@
"$schema": "https://typedoc.org/schema.json",
"entryPointStrategy": "packages",
"entryPoints": ["packages/bot", "packages/gateway", "packages/rest", "packages/types", "packages/utils"],
"skipErrorChecking": true,
"out": "./website/api_reference/generated/",
"cleanOutputDir": false,
"plugin": ["typedoc-plugin-markdown"],
+18 -3
View File
@@ -1,14 +1,29 @@
root: true
env:
browser: true
es2021: true
extends:
- plugin:react/recommended
- standard-with-typescript
- prettier
- plugin:react/recommended
- plugin:react/jsx-runtime
- plugin:prettier/recommended
overrides: []
parserOptions:
ecmaVersion: latest
sourceType: module
project: ['./tsconfig.json']
ignorePatterns:
- .docusaurus
- .yarn
- build
- node_modules
- api_reference
settings:
react:
version: 18.2.0
plugins:
- react
rules: {}
rules:
'@typescript-eslint/prefer-nullish-coalescing': off
'@typescript-eslint/strict-boolean-expressions': off
'@typescript-eslint/explicit-function-return-type': off
+5 -5
View File
@@ -6,8 +6,8 @@
### Modules
- [@discordeno/bot](modules/Bot.md)
- [@discordeno/gateway](modules/Gateway.md)
- [@discordeno/rest](modules/Rest.md)
- [@discordeno/types](modules/Types.md)
- [@discordeno/utils](modules/Utils.md)
- [@discordeno/bot](modules/Bot)
- [@discordeno/gateway](modules/Gateway)
- [@discordeno/rest](modules/Rest)
- [@discordeno/types](modules/Types)
- [@discordeno/utils](modules/Utils)
-4
View File
@@ -1,4 +0,0 @@
module.exports = {
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
plugins: ['babel-plugin-styled-components'],
}
-277
View File
@@ -1,277 +0,0 @@
// @ts-check
// Note: type annotations allow type checking and IDEs autocompletion
const { themes } = require('prism-react-renderer')
/** @type {import('@docusaurus/types').Config} */
const config = {
title: 'Discordeno',
tagline: 'Making Scalable Bots Easy!',
favicon: 'img/favicon.png',
// Set the production url of your site here
url: 'https://discordeno.js.org/',
// Set the /<baseUrl>/ pathname under which your site is served
// For GitHub pages deployment, it is often '/<projectName>/'
baseUrl: '/',
// GitHub pages deployment config.
// If you aren't using GitHub pages, you don't need these.
organizationName: 'discordeno', // Usually your GitHub org/user name.
projectName: 'discordeno', // Usually your repo name.
deploymentBranch: 'gh-pages',
trailingSlash: false,
webpack: {
jsLoader: isServer => ({
loader: require.resolve('esbuild-loader'),
options: {
loader: 'tsx',
format: isServer ? 'cjs' : undefined,
target: isServer ? 'node12' : 'es2017',
},
}),
},
onBrokenLinks: 'throw',
onBrokenMarkdownLinks: 'warn',
// Even if you don't use internalization, you can use this field to set useful
// metadata like html lang. For example, if your site is Chinese, you may want
// to replace "en" with "zh-Hans".
i18n: {
defaultLocale: 'en',
locales: ['en'],
},
presets: [
[
'classic',
/** @type {import('@docusaurus/preset-classic').Options} */
({
docs: {
sidebarPath: require.resolve('./sidebars.js'),
// Please change this to your repo.
// Remove this to remove the "edit this page" links.
editUrl:
'https://github.com/discordeno/discordeno/tree/main/website/',
},
blog: {
showReadingTime: true,
},
theme: {
customCss: require.resolve('./src/styling/index.css'),
},
}),
],
],
themeConfig:
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
({
// Replace with your project's social card
image: 'img/links-embed-image.png',
navbar: {
title: 'Discordeno',
logo: {
alt: 'Discordeno Logo',
src: 'img/logo.svg',
},
items: [
{
type: 'doc',
docId: 'intro',
position: 'left',
label: 'Documentation',
},
{
type: 'docSidebar',
sidebarId: 'old_docs',
position: 'left',
label: 'Old Docs',
docsPluginId: 'old_docs',
},
{
type: 'docSidebar',
sidebarId: 'tutorial',
position: 'left',
label: 'Tutorial',
docsPluginId: 'tutorial',
},
{
type: 'docSidebar',
sidebarId: 'api_reference',
position: 'left',
label: 'API Reference',
docsPluginId: 'api_reference',
},
{ to: '/blog', label: 'Blog', position: 'left' },
{
href: 'https://discord.gg/ddeno',
label: 'Discord',
position: 'right',
},
{
href: 'https://github.com/discordeno/discordeno',
label: 'GitHub',
position: 'right',
},
],
},
footer: {
style: 'light',
links: [
{
title: 'Docs',
items: [
{
label: 'Documentation',
to: '/docs/intro',
},
],
},
{
title: 'Old Docs',
items: [
{
label: 'Introduction',
to: '/old_docs/intro',
},
{
label: 'Getting Started',
to: '/old_docs/getting-started',
},
{
label: 'FAQ',
to: '/old_docs/frequently-asked-questions',
},
{
label: 'Benchmark',
to: '/old_docs/benchmark',
},
],
},
{
title: 'Tutorial',
items: [
{
label: 'Big Bot',
to: '/tutorial/big-bot-guide/step-by-step',
},
{
label: 'Node.js',
to: '/tutorial/nodejs/getting-started',
},
{
label: 'Amethyst',
to: '/tutorial/amethyst/intro',
},
],
},
{
title: 'API Reference',
items: [
{
label: 'Classes',
to: '/api_reference/category/classes-3',
},
{
label: 'Enums',
to: '/api_reference/category/enums-3',
},
{
label: 'Interfaces',
to: '/api_reference/category/interfaces-3',
},
{
label: 'Modules',
to: '/api_reference/category/modules-3',
},
],
},
{
title: 'Community',
items: [
{
label: 'Discord',
href: 'https://discord.gg/ddeno',
},
],
},
{
title: 'More',
items: [
{
label: 'Blog',
to: '/blog',
},
{
label: 'GitHub',
href: 'https://github.com/discordeno/discordeno',
},
],
},
],
copyright: `Copyright © 2021-${new Date().getFullYear()}, Discordeno.`,
},
prism: {
theme: themes.github,
darkTheme: themes.dracula,
},
}),
plugins: [
[
'@docusaurus/plugin-content-docs',
/** @type {import('@docusaurus/plugin-content-docs').Options} */
{
id: 'old_docs',
path: 'old_docs',
routeBasePath: 'old_docs',
sidebarPath: require.resolve('./sidebars.js'),
editUrl: 'https://github.com/discordeno/discordeno/tree/main/site/',
},
],
[
'@docusaurus/plugin-content-docs',
/** @type {import('@docusaurus/plugin-content-docs').Options} */
{
id: 'tutorial',
path: 'tutorial',
routeBasePath: 'tutorial',
sidebarPath: require.resolve('./sidebars.js'),
editUrl: 'https://github.com/discordeno/discordeno/tree/main/site/',
},
],
[
'@docusaurus/plugin-content-docs',
/** @type {import('@docusaurus/plugin-content-docs').Options} */
{
id: 'api_reference',
path: 'api_reference',
routeBasePath: 'api_reference',
sidebarPath: require.resolve('./sidebars.js'),
editUrl: 'https://github.com/discordeno/discordeno/tree/main/site/',
},
],
[
require.resolve('@easyops-cn/docusaurus-search-local'),
{
indexDocs: true,
indexPages: true,
docsRouteBasePath: ['/docs', '/tutorial', 'api_reference'],
language: ['en'],
hashed: true,
docsDir: ['docs', 'tutorial', 'api_reference'],
blogDir: [],
removeDefaultStopWordFilter: true,
highlightSearchTermsOnTargetPage: true,
searchResultLimits: 8,
searchResultContextMaxLength: 50,
},
],
'./webpack-docusaurus-plugin',
],
}
module.exports = config
+276
View File
@@ -0,0 +1,276 @@
// Note: type annotations allow type checking and IDEs autocompletion
import type { Options as PluginContentDocs } from '@docusaurus/plugin-content-docs'
import type {
Options as PresetClassicOptions,
ThemeConfig,
} from '@docusaurus/preset-classic'
import type { Config } from '@docusaurus/types'
import { themes } from 'prism-react-renderer'
const config: Config = {
title: 'Discordeno',
tagline: 'Making Scalable Bots Easy!',
favicon: 'img/favicon.png',
// Set the production url of your site here
url: 'https://discordeno.js.org/',
// Set the /<baseUrl>/ pathname under which your site is served
// For GitHub pages deployment, it is often '/<projectName>/'
baseUrl: '/',
// GitHub pages deployment config.
// If you aren't using GitHub pages, you don't need these.
organizationName: 'discordeno', // Usually your GitHub org/user name.
projectName: 'discordeno', // Usually your repo name.
deploymentBranch: 'gh-pages',
trailingSlash: false,
webpack: {
jsLoader: isServer => ({
loader: require.resolve('esbuild-loader'),
options: {
loader: 'tsx',
jsx: 'automatic',
format: isServer ? 'cjs' : undefined,
target: isServer ? 'node12' : 'es2017',
},
}),
},
onBrokenLinks: 'throw',
onBrokenMarkdownLinks: 'warn',
// Even if you don't use internalization, you can use this field to set useful
// metadata like html lang. For example, if your site is Chinese, you may want
// to replace "en" with "zh-Hans".
i18n: {
defaultLocale: 'en',
locales: ['en'],
},
presets: [
[
'classic',
{
docs: {
sidebarPath: require.resolve('./sidebars.ts'),
// Please change this to your repo.
// Remove this to remove the "edit this page" links.
editUrl:
'https://github.com/discordeno/discordeno/tree/main/website/',
},
blog: {
showReadingTime: true,
},
theme: {
customCss: require.resolve('./src/styling/index.css'),
},
} satisfies PresetClassicOptions,
],
],
themeConfig: {
// Replace with your project's social card
image: 'img/links-embed-image.png',
navbar: {
title: 'Discordeno',
logo: {
alt: 'Discordeno Logo',
src: 'img/logo.svg',
},
items: [
{
type: 'doc',
docId: 'intro',
position: 'left',
label: 'Documentation',
},
{
type: 'docSidebar',
sidebarId: 'old_docs',
position: 'left',
label: 'Old Docs',
docsPluginId: 'old_docs',
},
{
type: 'docSidebar',
sidebarId: 'tutorial',
position: 'left',
label: 'Tutorial',
docsPluginId: 'tutorial',
},
{
type: 'docSidebar',
sidebarId: 'api_reference',
position: 'left',
label: 'API Reference',
docsPluginId: 'api_reference',
},
{ to: '/blog', label: 'Blog', position: 'left' },
{
href: 'https://discord.gg/ddeno',
label: 'Discord',
position: 'right',
},
{
href: 'https://github.com/discordeno/discordeno',
label: 'GitHub',
position: 'right',
},
],
},
footer: {
style: 'light',
links: [
{
title: 'Docs',
items: [
{
label: 'Documentation',
to: '/docs/intro',
},
],
},
{
title: 'Old Docs',
items: [
{
label: 'Introduction',
to: '/old_docs/intro',
},
{
label: 'Getting Started',
to: '/old_docs/getting-started',
},
{
label: 'FAQ',
to: '/old_docs/frequently-asked-questions',
},
{
label: 'Benchmark',
to: '/old_docs/benchmark',
},
],
},
{
title: 'Tutorial',
items: [
{
label: 'Big Bot',
to: '/tutorial/big-bot-guide/step-by-step',
},
{
label: 'Node.js',
to: '/tutorial/nodejs/getting-started',
},
{
label: 'Amethyst',
to: '/tutorial/amethyst/intro',
},
],
},
{
title: 'API Reference',
items: [
{
label: 'Classes',
to: '/api_reference/category/classes-3',
},
{
label: 'Enums',
to: '/api_reference/category/enums-3',
},
{
label: 'Interfaces',
to: '/api_reference/category/interfaces-3',
},
{
label: 'Modules',
to: '/api_reference/category/modules-3',
},
],
},
{
title: 'Community',
items: [
{
label: 'Discord',
href: 'https://discord.gg/ddeno',
},
],
},
{
title: 'More',
items: [
{
label: 'Blog',
to: '/blog',
},
{
label: 'GitHub',
href: 'https://github.com/discordeno/discordeno',
},
],
},
],
copyright: `Copyright © 2021-${new Date().getFullYear()}, Discordeno.`,
},
prism: {
theme: themes.github,
darkTheme: themes.dracula,
},
} satisfies ThemeConfig,
plugins: [
[
'@docusaurus/plugin-content-docs',
{
id: 'old_docs',
path: 'old_docs',
routeBasePath: 'old_docs',
sidebarPath: require.resolve('./sidebars.js'),
editUrl: 'https://github.com/discordeno/discordeno/tree/main/site/',
} satisfies PluginContentDocs,
],
[
'@docusaurus/plugin-content-docs',
{
id: 'tutorial',
path: 'tutorial',
routeBasePath: 'tutorial',
sidebarPath: require.resolve('./sidebars.js'),
editUrl: 'https://github.com/discordeno/discordeno/tree/main/site/',
} satisfies PluginContentDocs,
],
[
'@docusaurus/plugin-content-docs',
{
id: 'api_reference',
path: 'api_reference',
routeBasePath: 'api_reference',
sidebarPath: require.resolve('./sidebars.js'),
editUrl: 'https://github.com/discordeno/discordeno/tree/main/site/',
} satisfies PluginContentDocs,
],
[
require.resolve('@easyops-cn/docusaurus-search-local'),
{
indexDocs: true,
indexPages: true,
docsRouteBasePath: ['/docs', '/tutorial', 'api_reference'],
language: ['en'],
hashed: true,
docsDir: ['docs', 'tutorial', 'api_reference'],
blogDir: [],
removeDefaultStopWordFilter: true,
highlightSearchTermsOnTargetPage: true,
searchResultLimits: 8,
searchResultContextMaxLength: 50,
},
],
'./webpack-docusaurus-plugin.ts',
],
}
export default config
+21 -19
View File
@@ -13,43 +13,45 @@
"write-translations": "docusaurus write-translations",
"write-heading-ids": "docusaurus write-heading-ids",
"typecheck": "tsc",
"lint": "eslint src --ext ts,tsx",
"lint": "eslint . --ext js,ts,tsx",
"format": "prettier --write \"**/*.{js,jsx,ts,tsx,md,mdx}\"",
"setup-dd": ""
},
"dependencies": {
"@babel/plugin-syntax-flow": "^7.23.3",
"@docusaurus/core": "3.0.1",
"@docusaurus/preset-classic": "3.0.1",
"@easyops-cn/docusaurus-search-local": "^0.38.1",
"@docusaurus/theme-common": "3.0.1",
"@easyops-cn/docusaurus-search-local": "^0.40.1",
"@mdx-js/react": "^3.0.0",
"babel-plugin-styled-components": "^2.1.4",
"chart.js": "^4.4.1",
"clsx": "^2.0.0",
"prism-react-renderer": "^2.3.0",
"clsx": "^2.1.0",
"prism-react-renderer": "^2.3.1",
"react": "^18.2.0",
"react-chartjs-2": "^5.2.0",
"react-dom": "^18.2.0",
"reactflow": "^11.10.1",
"styled-components": "^6.1.1"
"styled-components": "^6.1.6"
},
"devDependencies": {
"@docusaurus/module-type-aliases": "3.0.1",
"@tsconfig/docusaurus": "^2.0.2",
"@typescript-eslint/eslint-plugin": "^6.13.2",
"@typescript-eslint/parser": "^6.13.2",
"esbuild": "^0.19.8",
"@docusaurus/tsconfig": "3.0.1",
"@docusaurus/types": "3.0.1",
"@types/react": "^18.2.47",
"@typescript-eslint/eslint-plugin": "^6.18.0",
"@typescript-eslint/parser": "^6.18.0",
"esbuild": "^0.19.11",
"esbuild-loader": "^4.0.2",
"eslint": "^8.55.0",
"eslint": "^8.56.0",
"eslint-config-prettier": "^9.1.0",
"eslint-config-standard-with-typescript": "^40.0.0",
"eslint-plugin-import": "^2.29.0",
"eslint-plugin-n": "^16.3.1",
"eslint-config-standard-with-typescript": "^43.0.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-n": "^16.6.1",
"eslint-plugin-promise": "^6.1.1",
"eslint-plugin-react": "^7.33.2",
"prettier": "^3.1.0",
"terser-webpack-plugin": "^5.3.9",
"typescript": "5.3.2"
"prettier": "^3.1.1",
"terser-webpack-plugin": "^5.3.10",
"typescript": "5.3.3",
"webpack": "^5.89.0"
},
"browserslist": {
"production": [
@@ -64,6 +66,6 @@
]
},
"engines": {
"node": ">=16.14"
"node": ">=18.0"
}
}
+3 -4
View File
@@ -9,10 +9,9 @@
Create as many sidebars as you want.
*/
// @ts-check
import { type SidebarsConfig } from '@docusaurus/plugin-content-docs'
/** @type {import('@docusaurus/plugin-content-docs').SidebarsConfig} */
const sidebars = {
const sidebars: SidebarsConfig = {
// By default, Docusaurus generates a sidebar from the docs folder structure
tutorialSidebar: [{ type: 'autogenerated', dirName: '.' }],
tutorial: [{ type: 'autogenerated', dirName: '.' }],
@@ -32,4 +31,4 @@ const sidebars = {
*/
}
module.exports = sidebars
export default sidebars
+7 -7
View File
@@ -9,7 +9,7 @@ import {
Title,
Tooltip,
} from 'chart.js'
import React, { useEffect, useState } from 'react'
import { useEffect, useState } from 'react'
import { Chart } from 'react-chartjs-2'
ChartJS.register(
CategoryScale,
@@ -19,7 +19,7 @@ ChartJS.register(
LineElement,
Title,
Tooltip,
Legend
Legend,
)
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
@@ -142,17 +142,17 @@ export default function BenchmarkResultCharts(): JSX.Element {
useEffect(() => {
if (!data) {
;(async () => {
void (async () => {
setData(
JSON.parse(
(
await (
await fetch(
'https://raw.githubusercontent.com/discordeno/discordeno/benchies/benchmarksResult/data.js'
'https://raw.githubusercontent.com/discordeno/discordeno/benchies/benchmarksResult/data.js',
)
).text()
).slice(24)
)
).slice(24),
) as { entries: { Benchmark: [] } },
)
})()
}
@@ -181,7 +181,7 @@ export default function BenchmarkResultCharts(): JSX.Element {
{data ? (
Array.from(
collectBenchesPerTestCase(data.entries.Benchmark),
([key, value]) => ({ benchName: key, benches: value })
([key, value]) => ({ benchName: key, benches: value }),
).map((bench, index) => (
<BenchmarkResultChart
key={index}
@@ -1,13 +1,13 @@
import React, { useEffect, useState } from 'react'
import { useEffect, useState } from 'react'
import ReactFlow, {
Background,
Controls,
Edge,
Handle,
Node,
Position,
useEdgesState,
useNodesState,
type Edge,
type Node,
} from 'reactflow'
import 'reactflow/dist/style.css'
@@ -51,11 +51,13 @@ export default function BaseFlowChart({
}
window.addEventListener('resize', handleResize)
return () => window.removeEventListener('resize', handleResize)
return () => {
window.removeEventListener('resize', handleResize)
}
}, [])
const [nodes, setNodes, onNodesChange] = useNodesState(initialNodes)
const [edges, setEdges, onEdgesChange] = useEdgesState(initialEdges)
const [nodes] = useNodesState(initialNodes)
const [edges] = useEdgesState(initialEdges)
return (
<>
@@ -1,5 +1,4 @@
import React from 'react'
import { Edge, Node } from 'reactflow'
import { type Edge, type Node } from 'reactflow'
import 'reactflow/dist/style.css'
import BaseFlowChart, { defaultNodeOptions, multiplier } from './BaseFlowChart'
@@ -1,5 +1,4 @@
import React from 'react'
import { Edge, Node, Position } from 'reactflow'
import { type Edge, type Node, Position } from 'reactflow'
import 'reactflow/dist/style.css'
import BaseFlowChart, {
defaultGroupOptions,
@@ -1,14 +1,14 @@
import React, { useEffect, useState } from 'react'
import type React from 'react'
import { useEffect, useState } from 'react'
import ReactFlow, {
Background,
Controls,
Edge,
Handle,
Node,
NodeMouseHandler,
Position,
useEdgesState,
useNodesState,
type Edge,
type Node,
} from 'reactflow'
import 'reactflow/dist/style.css'
import {
@@ -18,12 +18,13 @@ import {
widthMultiplier,
} from './BaseFlowChart'
const handlers: {
[index: string]: {
const handlers: Record<
string,
{
transformers: string[]
event: string
}
} = {
> = {
handleChannelCreate: {
transformers: ['transformers.channel'],
event: 'events.channelCreate',
@@ -350,6 +351,8 @@ const handlers: {
export default function FlowChart({
handlerFilter = (handler: string) => true,
}: {
handlerFilter: (handler: string) => boolean
}) {
function getWindowDimensions() {
const { innerWidth: width, innerHeight: height } = window
@@ -369,7 +372,9 @@ export default function FlowChart({
}
window.addEventListener('resize', handleResize)
return () => window.removeEventListener('resize', handleResize)
return () => {
window.removeEventListener('resize', handleResize)
}
}, [])
const transformers = []
@@ -467,7 +472,6 @@ export default function FlowChart({
},
]
//@ts-ignore
for (const [index, handler] of Object.keys(handlers)
.filter(handlerFilter)
.entries()) {
@@ -528,7 +532,6 @@ export default function FlowChart({
}
}
//@ts-ignore
for (const [index, transformer] of transformers.entries()) {
initialNodes.push({
id: transformer,
@@ -544,7 +547,6 @@ export default function FlowChart({
})
}
//@ts-ignore
for (const [index, event] of events.entries()) {
initialNodes.push({
id: event,
@@ -647,12 +649,16 @@ export default function FlowChart({
},
)
const [nodes, setNodes, onNodesChange] = useNodesState(initialNodes)
const [edges, setEdges, onEdgesChange] = useEdgesState(initialEdges)
const [handlerIndex, setHandlerIndex] = useState(0)
const [nodes] = useNodesState(initialNodes)
const [edges, setEdges] = useEdgesState(initialEdges)
const [, setHandlerIndex] = useState(0)
const [userClick, setUserClick] = useState(false)
const nodeMouseHandler: NodeMouseHandler = (_, node, userTrigger = true) => {
const nodeMouseHandler = (
_: React.MouseEvent,
node: Node,
userTrigger = true,
) => {
if (userTrigger) setUserClick(true)
if (node.id.split('-')[0] === 'baseNode') {
edges.forEach(e => {
@@ -817,13 +823,19 @@ export default function FlowChart({
if (!userClick) {
nodeMouseHandler(
undefined,
{ id: Object.keys(handlers).filter(handlerFilter)[randomIndex] },
{
id: Object.keys(handlers).filter(handlerFilter)[randomIndex],
data: undefined,
position: undefined,
},
false,
)
}
setHandlerIndex(randomIndex)
}, 1000)
return () => clearInterval(interval)
return () => {
clearInterval(interval)
}
}, [userClick])
useEffect(() => {
@@ -831,7 +843,9 @@ export default function FlowChart({
const timeout = setTimeout(() => {
setUserClick(false)
}, 10000)
return () => clearTimeout(timeout)
return () => {
clearTimeout(timeout)
}
}
}, [userClick])
@@ -863,9 +877,15 @@ export default function FlowChart({
onNodeDoubleClick={nodeMouseHandler}
onNodeClick={nodeMouseHandler}
onClick={e => {
//@ts-ignore
if (e.target.className === 'react-flow__pane')
nodeMouseHandler(e, { id: ' - ', data: { label: ' - ' } })
const target = e.target as HTMLDivElement
if (target.className === 'react-flow__pane') {
nodeMouseHandler(e, {
id: ' - ',
data: { label: ' - ' },
position: undefined,
})
}
}}
nodeTypes={{
baseLineNode: () => (
-2
View File
@@ -1,5 +1,3 @@
import React from 'react'
export default function Footer() {
return (
<svg
+1 -2
View File
@@ -1,6 +1,5 @@
import Link from '@docusaurus/Link'
import { Header, Highlight, Button, HeaderBody } from '@site/src/styling'
import React from 'react'
import { Button, Header, HeaderBody, Highlight } from '@site/src/styling'
export default function DiscordenoHeader(): JSX.Element {
return (
+2 -2
View File
@@ -4,7 +4,7 @@ import {
FaqQuestion,
FaqSection,
} from '@site/src/styling'
import React from 'react'
import { useState } from 'react'
const Faq = ({
question,
@@ -15,7 +15,7 @@ const Faq = ({
answer: string
defaultExpanded?: boolean
}) => {
const [visible, setVisible] = React.useState(defaultExpanded ?? false)
const [visible, setVisible] = useState(defaultExpanded ?? false)
const toggleVisibility = () => {
setVisible(!visible)
@@ -1,5 +1,4 @@
import React from 'react'
import { FeatureList } from '@site/src/types'
import { type FeatureList } from '@site/src/types'
import clsx from 'clsx'
export default function Feature({ data }: FeatureList): JSX.Element {
@@ -1,6 +1,5 @@
import React from 'react'
import styles from '@site/src/styling/styles.module.css'
import { FeatureItem } from '@site/src/types'
import { type FeatureItem } from '@site/src/types'
import Feature from './feature'
const FeatureList: FeatureItem[] = [
@@ -1,4 +1,3 @@
import React from 'react'
import {
ReviewsBox,
ReviewsElement,
@@ -11,7 +10,7 @@ import {
StarContainer,
StarIcon,
} from '@site/src/styling'
import { DiscordLibraries, IReview } from '@site/src/types'
import { DiscordLibraries, type IReview } from '@site/src/types'
const reviewList: IReview[] = [
{
@@ -199,7 +198,7 @@ export default function DiscordenoReviews() {
</svg>
{String(review.bot.guild_count).replace(
/\B(?=(\d{3})+(?!\d))/g,
','
',',
)}{' '}
guilds
</div>
+7 -8
View File
@@ -1,18 +1,17 @@
import React from 'react'
import useDocusaurusContext from '@docusaurus/useDocusaurusContext'
import Layout from '@theme/Layout'
import DiscordenoHeader from '../components/header'
import { MainPage } from '../styling'
import DiscordenoFeatures from '../components/home/features'
import { useEffect, useState } from 'react'
import Footer from '../components/footer'
import DiscordenoReviews from '../components/home/reviews'
import DiscordenoHeader from '../components/header'
import DiscordenoFAQ from '../components/home/faq'
import DiscordenoFeatures from '../components/home/features'
import DiscordenoReviews from '../components/home/reviews'
import { MainPage } from '../styling'
export default function Home(): JSX.Element {
// Use loading to give time to JS to load
const [loading, setLoading] = React.useState(true)
const [loading, setLoading] = useState(true)
React.useEffect(() => {
useEffect(() => {
setTimeout(() => {
setLoading(false)
+2 -2
View File
@@ -308,7 +308,7 @@ export const StarContainer = styled.div`
align-items: center;
`
export const StarIcon = styled.svg`
export const StarIcon = styled.svg<{ active: boolean }>`
width: 20px;
height: 20px;
fill: ${props => (props.active ? 'currentColor' : '#CBD5E0')};
@@ -429,7 +429,7 @@ export const FaqQuestion = styled.h3`
}
`
export const FaqAnswer = styled.div`
export const FaqAnswer = styled.div<{ visible: boolean }>`
padding: ${({ visible }) => (visible ? '10px' : '0px')};
background-color: var(--ifm-footer-background-color);
color: #fff;
+3 -3
View File
@@ -1,11 +1,11 @@
export type FeatureList = {
export interface FeatureList {
data: {
feature: FeatureItem
featureList: FeatureItem[]
}
}
export type FeatureItem = {
export interface FeatureItem {
title: string
Svg: JSX.Element
description: JSX.Element
@@ -35,7 +35,7 @@ export enum DiscordLibraries {
CUSTOM = 'Custom', // Custom library
}
export type IReview = {
export interface IReview {
review: string // the review
bot: {
username: string // Clyde
+3 -2
View File
@@ -1,7 +1,8 @@
{
// This file is not used in compilation. It is here just for a nice editor experience.
"extends": "@tsconfig/docusaurus/tsconfig.json",
"extends": "@docusaurus/tsconfig",
"compilerOptions": {
"baseUrl": "."
"baseUrl": ".",
"downlevelIteration": true
}
}
@@ -3,16 +3,17 @@
* https://github.com/facebook/docusaurus/issues/4765#issuecomment-1679863984
*/
const TerserPlugin = require('terser-webpack-plugin')
import type { LoadContext, Plugin } from '@docusaurus/types'
import TerserPlugin, { esbuildMinify } from 'terser-webpack-plugin'
module.exports = function (context, options) {
export default function (context: LoadContext, options: unknown): Plugin {
return {
name: 'webpack-docusaurus-plugin',
configureWebpack(config, isServer, utils) {
const cacheOptions = { cache: process.env.CI !== 'true' }
const minimizer = new TerserPlugin({
minify: TerserPlugin.esbuildMinify,
minify: esbuildMinify,
})
const minimizers = config.optimization.minimizer?.map(m =>
m instanceof TerserPlugin ? minimizer : m,
+537 -154
View File
File diff suppressed because it is too large Load Diff
-10
View File
@@ -1984,7 +1984,6 @@ __metadata:
turbo: "npm:^1.11.3"
typedoc: "npm:0.25.7"
typedoc-plugin-markdown: "npm:3.17.1"
typedoc-plugin-missing-exports: "npm:^2.2.0"
typescript: "npm:5.3.3"
languageName: unknown
linkType: soft
@@ -5872,15 +5871,6 @@ __metadata:
languageName: node
linkType: hard
"typedoc-plugin-missing-exports@npm:^2.2.0":
version: 2.2.0
resolution: "typedoc-plugin-missing-exports@npm:2.2.0"
peerDependencies:
typedoc: 0.24.x || 0.25.x
checksum: db691b3494c8e112d7ea8621fcf79f1988ef8f0c9fc43eb5fc308fda0caa1b1e007c3d51db83236247cf9b52cdfec1186a7eb25ec3416fa03ef65f68b4e88e4e
languageName: node
linkType: hard
"typedoc@npm:0.25.7":
version: 0.25.7
resolution: "typedoc@npm:0.25.7"