mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
feat: mainlib docs on new website (#9930)
* fix(ExceptText): don't display import("d..-types/v10"). in return type
* Squashed 'packages/api-extractor-model/' content from commit 39ecb196c
git-subtree-dir: packages/api-extractor-model
git-subtree-split: 39ecb196ca210bdf84ba6c9cadb1bb93571849d7
* Squashed 'packages/api-extractor/' content from commit 341ad6c51
git-subtree-dir: packages/api-extractor
git-subtree-split: 341ad6c51b01656d4f73b74ad4bdb3095f9262c4
* feat(api-extractor): add api-extractor and -model
* fix: package.json docs script
* fix(SourcLink): use <> instead of function syntax
* fix: make packages private
* fix: rest params showing in docs, added labels
* fix: missed two files
* feat: merge docs.json from docgen and docs.api.json
* fix: cpy-cli & pnpm-lock
* fix: increase icon size
* fix: icon size again
* feat: run both docs on mainlib
* chore: website fixes
* fix: more website fixes
* fix: tests and dev database script
* chore: comment out old docs
* fix: increase max fetch cache
* fix: env should always be a string
* fix: try to reapply patches
* fix: remove prepare for docgen
* fix: temporary cosmetic fixes
* fix: horizontal scroll
* feat: generate index for new docs
---------
Co-authored-by: Noel <buechler.noel@outlook.com>
This commit is contained in:
2
packages/docgen/bin/index.js
Executable file
2
packages/docgen/bin/index.js
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/usr/bin/env node
|
||||
require('../dist/bin/index.js');
|
||||
@@ -8,6 +8,7 @@ import { build } from '../src/index.js';
|
||||
export interface CLIOptions {
|
||||
custom: string;
|
||||
input: string[];
|
||||
newOutput: string;
|
||||
output: string;
|
||||
root: string;
|
||||
typescript: boolean;
|
||||
|
||||
@@ -8,10 +8,9 @@
|
||||
"lint": "prettier --check . && cross-env TIMING=1 eslint --format=pretty src",
|
||||
"format": "prettier --write . && cross-env TIMING=1 eslint --fix --format=pretty src",
|
||||
"fmt": "pnpm run format",
|
||||
"prepare": "pnpm run build",
|
||||
"prepack": "pnpm run format && pnpm run build"
|
||||
},
|
||||
"bin": "./dist/bin/index.js",
|
||||
"bin": "./bin/index.js",
|
||||
"exports": {
|
||||
".": {
|
||||
"require": {
|
||||
|
||||
@@ -268,5 +268,185 @@ export class Documentation {
|
||||
};
|
||||
}
|
||||
|
||||
public serializeNew() {
|
||||
return {
|
||||
metadata: {
|
||||
toolPackage: '@discordjs/docgen',
|
||||
toolVersion: Documentation.FORMAT_VERSION,
|
||||
schemaVersion: 1_011,
|
||||
oldestForwardsCompatibleVersion: 1_001,
|
||||
tsdocConfig: {
|
||||
$schema: 'https://developer.microsoft.com/json-schemas/tsdoc/v0/tsdoc.schema.json',
|
||||
noStandardTags: true,
|
||||
tagDefinitions: [
|
||||
{
|
||||
tagName: '@alpha',
|
||||
syntaxKind: 'modifier',
|
||||
},
|
||||
{
|
||||
tagName: '@beta',
|
||||
syntaxKind: 'modifier',
|
||||
},
|
||||
{
|
||||
tagName: '@defaultValue',
|
||||
syntaxKind: 'block',
|
||||
},
|
||||
{
|
||||
tagName: '@decorator',
|
||||
syntaxKind: 'block',
|
||||
allowMultiple: true,
|
||||
},
|
||||
{
|
||||
tagName: '@deprecated',
|
||||
syntaxKind: 'block',
|
||||
},
|
||||
{
|
||||
tagName: '@eventProperty',
|
||||
syntaxKind: 'modifier',
|
||||
},
|
||||
{
|
||||
tagName: '@example',
|
||||
syntaxKind: 'block',
|
||||
allowMultiple: true,
|
||||
},
|
||||
{
|
||||
tagName: '@experimental',
|
||||
syntaxKind: 'modifier',
|
||||
},
|
||||
{
|
||||
tagName: '@inheritDoc',
|
||||
syntaxKind: 'inline',
|
||||
},
|
||||
{
|
||||
tagName: '@internal',
|
||||
syntaxKind: 'modifier',
|
||||
},
|
||||
{
|
||||
tagName: '@label',
|
||||
syntaxKind: 'inline',
|
||||
},
|
||||
{
|
||||
tagName: '@link',
|
||||
syntaxKind: 'inline',
|
||||
allowMultiple: true,
|
||||
},
|
||||
{
|
||||
tagName: '@override',
|
||||
syntaxKind: 'modifier',
|
||||
},
|
||||
{
|
||||
tagName: '@packageDocumentation',
|
||||
syntaxKind: 'modifier',
|
||||
},
|
||||
{
|
||||
tagName: '@param',
|
||||
syntaxKind: 'block',
|
||||
allowMultiple: true,
|
||||
},
|
||||
{
|
||||
tagName: '@privateRemarks',
|
||||
syntaxKind: 'block',
|
||||
},
|
||||
{
|
||||
tagName: '@public',
|
||||
syntaxKind: 'modifier',
|
||||
},
|
||||
{
|
||||
tagName: '@readonly',
|
||||
syntaxKind: 'modifier',
|
||||
},
|
||||
{
|
||||
tagName: '@remarks',
|
||||
syntaxKind: 'block',
|
||||
},
|
||||
{
|
||||
tagName: '@returns',
|
||||
syntaxKind: 'block',
|
||||
},
|
||||
{
|
||||
tagName: '@sealed',
|
||||
syntaxKind: 'modifier',
|
||||
},
|
||||
{
|
||||
tagName: '@see',
|
||||
syntaxKind: 'block',
|
||||
},
|
||||
{
|
||||
tagName: '@throws',
|
||||
syntaxKind: 'block',
|
||||
allowMultiple: true,
|
||||
},
|
||||
{
|
||||
tagName: '@typeParam',
|
||||
syntaxKind: 'block',
|
||||
allowMultiple: true,
|
||||
},
|
||||
{
|
||||
tagName: '@virtual',
|
||||
syntaxKind: 'modifier',
|
||||
},
|
||||
{
|
||||
tagName: '@betaDocumentation',
|
||||
syntaxKind: 'modifier',
|
||||
},
|
||||
{
|
||||
tagName: '@internalRemarks',
|
||||
syntaxKind: 'block',
|
||||
},
|
||||
{
|
||||
tagName: '@preapproved',
|
||||
syntaxKind: 'modifier',
|
||||
},
|
||||
],
|
||||
supportForTags: {
|
||||
'@alpha': true,
|
||||
'@beta': true,
|
||||
'@defaultValue': true,
|
||||
'@decorator': true,
|
||||
'@deprecated': true,
|
||||
'@eventProperty': true,
|
||||
'@example': true,
|
||||
'@experimental': true,
|
||||
'@inheritDoc': true,
|
||||
'@internal': true,
|
||||
'@label': true,
|
||||
'@link': true,
|
||||
'@override': true,
|
||||
'@packageDocumentation': true,
|
||||
'@param': true,
|
||||
'@privateRemarks': true,
|
||||
'@public': true,
|
||||
'@readonly': true,
|
||||
'@remarks': true,
|
||||
'@returns': true,
|
||||
'@sealed': true,
|
||||
'@see': true,
|
||||
'@throws': true,
|
||||
'@typeParam': true,
|
||||
'@virtual': true,
|
||||
'@betaDocumentation': true,
|
||||
'@internalRemarks': true,
|
||||
'@preapproved': true,
|
||||
},
|
||||
reportUnsupportedHtmlElements: false,
|
||||
},
|
||||
},
|
||||
projectFolderUrl: 'https://github.com/discordjs/discord.js/tree/main/packages/discord.js',
|
||||
kind: 'Package',
|
||||
canonicalReference: 'discord.js!',
|
||||
docComment: '',
|
||||
name: 'discord.js',
|
||||
preserveMemberOrder: false,
|
||||
members: [
|
||||
...[...this.classes.values()].map((_class) => _class.serialize()),
|
||||
...[...this.functions.values()].map((_function) => _function.serialize()),
|
||||
...[...this.interfaces.values()].map((_interface) => _interface.serialize()),
|
||||
...[...this.typedefs.values()].map((_typedef) => _typedef.serialize()),
|
||||
...[...this.externals.values()].map((_external) => _external.serialize()),
|
||||
],
|
||||
custom: this.custom,
|
||||
};
|
||||
}
|
||||
|
||||
public static readonly FORMAT_VERSION = 30;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ interface CustomFiles {
|
||||
path?: string;
|
||||
}
|
||||
|
||||
export async function build({ input, custom: customDocs, root, output, typescript }: CLIOptions) {
|
||||
export async function build({ input, custom: customDocs, root, output, newOutput, typescript }: CLIOptions) {
|
||||
let data: (ChildTypes & RootTypes)[] | DeclarationReflection[] = [];
|
||||
if (typescript) {
|
||||
console.log('Parsing Typescript in source files...');
|
||||
@@ -82,5 +82,10 @@ export async function build({ input, custom: customDocs, root, output, typescrip
|
||||
writeFileSync(output, JSON.stringify(docs.serialize()));
|
||||
}
|
||||
|
||||
if (newOutput) {
|
||||
console.log(`Writing to ${newOutput}...`);
|
||||
writeFileSync(newOutput, JSON.stringify(docs.serializeNew()));
|
||||
}
|
||||
|
||||
console.log('Done!');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user