mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 08:03:30 +01:00
fix: generateSplitDocumentation for external docs on main (#10827)
* fix: generateSplitDocumentation for external docs on main * fix: remove console.log * chore: apply suggestion Co-authored-by: Almeida <github@almeidx.dev> * fix: mixes tag * chore: docs include collection --------- Co-authored-by: Almeida <github@almeidx.dev> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
@@ -71,6 +71,7 @@
|
||||
|
||||
"@betaDocumentation": true,
|
||||
"@internalRemarks": true,
|
||||
"@mixes": true,
|
||||
"@preapproved": true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/* eslint-disable jsdoc/valid-types */
|
||||
import { ApplicationCommandType, type RESTPostAPIChatInputApplicationCommandsJSONBody } from 'discord-api-types/v10';
|
||||
import { Mixin } from 'ts-mixer';
|
||||
import { validate } from '../../../util/validation.js';
|
||||
@@ -10,10 +11,10 @@ import { SharedChatInputCommandSubcommands } from './mixins/SharedSubcommands.js
|
||||
/**
|
||||
* A builder that creates API-compatible JSON data for chat input commands.
|
||||
*
|
||||
* @mixes CommandBuilder<RESTPostAPIChatInputApplicationCommandsJSONBody>
|
||||
* @mixes SharedChatInputCommandOptions
|
||||
* @mixes SharedNameAndDescription
|
||||
* @mixes SharedChatInputCommandSubcommands
|
||||
* @mixes {@link CommandBuilder}\<{@link discord-api-types/v10#(RESTPostAPIChatInputApplicationCommandsJSONBody:interface)}\>
|
||||
* @mixes {@link SharedChatInputCommandOptions}
|
||||
* @mixes {@link SharedNameAndDescription}
|
||||
* @mixes {@link SharedChatInputCommandSubcommands}
|
||||
*/
|
||||
export class ChatInputCommandBuilder extends Mixin(
|
||||
CommandBuilder<RESTPostAPIChatInputApplicationCommandsJSONBody>,
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
{
|
||||
"$schema": "https://developer.microsoft.com/json-schemas/tsdoc/v0/tsdoc.schema.json",
|
||||
"tagDefinitions": [
|
||||
{
|
||||
"tagName": "@mixes",
|
||||
"syntaxKind": "block"
|
||||
}
|
||||
]
|
||||
"extends": ["@discordjs/api-extractor/extends/tsdoc-base.json"]
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
"bundledPackages": [
|
||||
"discord-api-types",
|
||||
"@discordjs/builders",
|
||||
"@discordjs/collection",
|
||||
"@discordjs/formatters",
|
||||
"@discordjs/rest",
|
||||
"@discordjs/util",
|
||||
|
||||
@@ -457,13 +457,15 @@ function itemTsDoc(item: DocNode, apiItem: ApiItem) {
|
||||
const comment = node as DocComment;
|
||||
|
||||
const exampleBlocks = comment.customBlocks.filter(
|
||||
(block) => block.blockTag.tagName.toUpperCase() === StandardTags.example.tagNameWithUpperCase,
|
||||
(block) => block.blockTag.tagNameWithUpperCase === StandardTags.example.tagNameWithUpperCase,
|
||||
);
|
||||
|
||||
const defaultValueBlock = comment.customBlocks.find(
|
||||
(block) => block.blockTag.tagName.toUpperCase() === StandardTags.defaultValue.tagNameWithUpperCase,
|
||||
(block) => block.blockTag.tagNameWithUpperCase === StandardTags.defaultValue.tagNameWithUpperCase,
|
||||
);
|
||||
|
||||
const mixesBlocks = comment.customBlocks.filter((block) => block.blockTag.tagNameWithUpperCase === '@MIXES');
|
||||
|
||||
return {
|
||||
kind: DocNodeKind.Comment,
|
||||
deprecatedBlock: comment.deprecatedBlock
|
||||
@@ -497,6 +499,9 @@ function itemTsDoc(item: DocNode, apiItem: ApiItem) {
|
||||
seeBlocks: comment.seeBlocks
|
||||
.flatMap((block) => createNode(block.content).flat(1))
|
||||
.filter((val: any) => val.kind !== DocNodeKind.SoftBreak),
|
||||
mixesBlocks: mixesBlocks
|
||||
.flatMap((block) => createNode(block.content).flat(1))
|
||||
.filter((val: any) => val.kind !== DocNodeKind.SoftBreak),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -522,8 +527,7 @@ function itemInfo(item: ApiDeclaredItem) {
|
||||
const isAbstract = ApiAbstractMixin.isBaseClassOf(item) && item.isAbstract;
|
||||
const isOptional = ApiOptionalMixin.isBaseClassOf(item) && item.isOptional;
|
||||
const isDeprecated = Boolean(item.tsdocComment?.deprecatedBlock);
|
||||
const isExternal = Boolean(item.sourceLocation.fileUrl?.includes('node_modules'));
|
||||
|
||||
const isExternal = Boolean(sourceLine === undefined);
|
||||
const hasSummary = Boolean(item.tsdocComment?.summarySection);
|
||||
|
||||
return {
|
||||
@@ -587,6 +591,19 @@ function resolveFileUrl(item: ApiDeclaredItem) {
|
||||
sourceURL: href,
|
||||
};
|
||||
}
|
||||
} else if (fileUrl?.includes('/dist/') && fileUrl.includes('/main/packages/')) {
|
||||
const [, pkg] = fileUrl.split('/main/packages/');
|
||||
const pkgName = pkg!.split('/')[0];
|
||||
const version = 'main';
|
||||
|
||||
// https://github.com/discordjs/discord.js/tree/main/packages/builders/dist/index.d.ts
|
||||
let currentItem = item;
|
||||
while (currentItem.parent && currentItem.parent.kind !== ApiItemKind.EntryPoint)
|
||||
currentItem = currentItem.parent as ApiDeclaredItem;
|
||||
|
||||
return {
|
||||
sourceURL: `/docs/packages/${pkgName}/${version}/${currentItem.displayName}:${currentItem.kind}`,
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user