Skip to content

Commit

Permalink
refactor: switch to json based docs
Browse files Browse the repository at this point in the history
- feat: start setting up the plugin for parsing
- feat: start parsing classes
- chore: add actual words
- permalink: http://whatthecommit.com/3d6431a17a3b67e8b1341a2c6e4362f8
- chore: it's working!
- permalink: http://whatthecommit.com/8d8c1f3903766b8ef27575d63115cac6
- feat: update framework json
- fix: fixed rendering custom files with css
- chore: update framework json to exclude externals
- feat: setup parsing sapphire classes and do a lot of link fixing
- refactor: switch to sapphire result
- fix: remove replaceall for Node 14 compat
- fix: actually remove replaceAll
- fix: fixed css extraction regex
- I thought I did this already
- fix: fixed broken link on welcome page
- chore: temporarily disable reporting broken links
- feat: much stuff
- change `classes` to `class` to match DJS
- add `typedef` and `namespace` linking
- fix linking of non-generic types
- update guide urls to match `class` change
- chore: bump deps
- chore: i'll explain when you're older!
- permalink: http://whatthecommit.com/91a07064bb814666919304a00161fc6c
- chore: dope
- permalink: http://whatthecommit.com/bab00ed1aa0abb17cce41f36deea1607
- chore: cleanup types
- feat: add variant to typedefs
- build: make it easier to debug
- fix: partially fix link extraction
- feat(docgen): add renderTypedef()
   - Moved parseSee() from /lib/renderer/renderClass.ts to /lib/renderer/utils.ts
   - Add /lib/renderer/renderTypedef.ts
     Which adds basic functionality in the website with things like title, description and extendedDescription
- chore: sort ts interfaces in docgen output
- chore: update doc types
- refactor: completely refactor how links are resolved
- fix: fixed links for `{@link` tags and propegate change to mdn and djs
- fix: use `replace` instead of `replaceAll`
- feat(docusaurus-discordjs-docgen): add functionality for enum and interface
- style(docusaurus-discordjs-docgen): use Array#flat() for typedef
- feat(docusaurus-discordjs-docgen): add constructor table functionality for classes
- feat(docusaurus-discordjs-docgen): align table content to center
- feat(docusaurus-discordjs-docgen): remove description column if all falsy
- feat(docusaurus-discordjs-docgen): add properties functionality for classes
- ci: add automatic vercel deploys workflow
- chore(docusaurus-typedoc-json-parser): initial commit
- chore(docusaurus-typedoc-json-parser): add doc fetching
- chore(docusaurus-typedoc-json-parser): add sidebar rendering
- fix(deps): update all non-major dependencies
- fix(deps): update dependency typedoc-json-parser to ^5.2.0
- feat(docusaurus-typedoc-json-parser): add basic renderers
- style(docusaurus-typedoc-json-parser): curly brackets and spacing
- style(docusaurus-typedoc-json-parser): template literals
- feat(docusaurus-typedoc-json-parser): add class extends and implements
- feat(docusaurus-typedoc-json-parser): add link parsing for the local project
- chore(docusaurus-typedoc-json-parser): add `start` script to bypass debugger
- feat(docusaurus-typedoc-json-parser): add comment info for classes
- chore: update dev deps
  • Loading branch information
favna committed Oct 22, 2022
1 parent 3b35b9d commit 6704487
Show file tree
Hide file tree
Showing 80 changed files with 62,164 additions and 18,506 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/automatic-vercel-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Automatic Vercel Deploys

on:
# TODO: Enable pre-merge
# schedule:
# - cron: '30 3 * * *'
workflow_dispatch:

jobs:
AutomaticVercelDeploy:
runs-on: ubuntu-latest
steps:
- name: Trigger Vercel Deploy
run: curl -X POST ${VERCEL_DEPLOY_HOOK_URL}
env:
VERCEL_DEPLOY_HOOK_URL: ${{ secrets.VERCEL_DEPLOY_HOOK_URL }}
48 changes: 0 additions & 48 deletions .github/workflows/update-submodules.yml

This file was deleted.

5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ build/
.docusaurus/
.cache-loader/
docs/Documentation/
tsconfig.tsbuildinfo
*.tsbuildinfo

# misc
.DS_Store
Expand All @@ -32,3 +32,6 @@ npm-debug.log*
yarn-debug.log*
yarn-error.log*
*.log

# TODO: Remove later
dist/
24 changes: 0 additions & 24 deletions .gitmodules

This file was deleted.

17 changes: 17 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"configurations": [
{
"type": "pwa-node",
"request": "launch",
"runtimeArgs": ["run-script", "debug"],
"name": "Debug Docgen",
"runtimeExecutable": "npm",
"skipFiles": ["<node_internals>/**", "node_modules/tslib/**"],
"internalConsoleOptions": "openOnSessionStart",
"cwd": "${workspaceFolder}/docusaurus-discordjs-docgen",
"console": "internalConsole",
"outputCapture": "std",
"outFiles": ["${workspaceFolder}/docusaurus-discordjs-docgen/dist/**/*.js"]
}
]
}
44,646 changes: 44,646 additions & 0 deletions data/framework.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/General/Welcome.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,6 @@ If you don't understand something in the documentation, you are experiencing pro
in the right direction, please don't hesitate to join our official
[Sapphire Community Server](https://sapphirejs.dev/discord).

[frameworksdocs]: ../Documentation/api-framework/
[frameworksdocs]: ../Documentation/sapphire-framework/General/welcome
[djs]: https://discord.js.org/
[saphfw]: https://github.com/sapphiredev/framework
2 changes: 1 addition & 1 deletion docs/Guide/arguments/built-in-arguments.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ To facilitate creating commands and getting your bot running, Sapphire bundles a
[date]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date
[dmchannel]: https://discord.js.org/#/docs/main/stable/class/DMChannel
[guildchannel]: https://discord.js.org/#/docs/main/stable/class/GuildChannel
[emojiobject]: ../../Documentation/api-framework/interfaces/Resolvers.EmojiObject
[emojiobject]: ../../Documentation/sapphire-framework/interfaces/Resolvers.EmojiObject
[guildmember]: https://discord.js.org/#/docs/main/stable/class/GuildMember
[mdn-date]:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date#several_ways_to_create_a_date_object
Expand Down
6 changes: 3 additions & 3 deletions docs/Guide/arguments/using-arguments.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ export class MathsCommand extends Command {

The code above matches any number of members up to 5, so it will never return an array of 6 or more.

[pick]: ../../Documentation/api-framework/classes/Args#pick
[rest]: ../../Documentation/api-framework/classes/Args#rest
[repeat]: ../../Documentation/api-framework/classes/Args#repeat
[pick]: ../../Documentation/sapphire-framework/class/Args#pick
[rest]: ../../Documentation/sapphire-framework/class/Args#rest
[repeat]: ../../Documentation/sapphire-framework/class/Args#repeat
[iterator]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Iterators_and_Generators#iterators
4 changes: 2 additions & 2 deletions docs/Guide/arguments/using-flags.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -122,5 +122,5 @@ export class FlagsCommand extends Command {
}
```

[getflags]: ../../Documentation/api-framework/classes/Args#getflags
[rest]: ../../Documentation/api-framework/classes/Args#rest
[getflags]: ../../Documentation/sapphire-framework/class/Args#getflags
[rest]: ../../Documentation/sapphire-framework/class/Args#rest
8 changes: 4 additions & 4 deletions docs/Guide/arguments/using-options.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export class OptionsCommand extends Command {
}
```

[getoption]: ../../Documentation/api-framework/classes/Args#getOption
[getoptions]: ../../Documentation/api-framework/classes/Args#getOptions
[pick]: ../../Documentation/api-framework/classes/Args#pick
[rest]: ../../Documentation/api-framework/classes/Args#rest
[getoption]: ../../Documentation/sapphire-framework/class/Args#getOption
[getoptions]: ../../Documentation/sapphire-framework/class/Args#getOptions
[pick]: ../../Documentation/sapphire-framework/class/Args#pick
[rest]: ../../Documentation/sapphire-framework/class/Args#rest
4 changes: 2 additions & 2 deletions docs/Guide/getting-started/creating-a-basic-command.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,6 @@ export class PingCommand extends Command {
}
```

[command]: ../../Documentation/api-framework/classes/Command
[commandoptions]: ../../Documentation/api-framework/interfaces/CommandOptions
[command]: ../../Documentation/sapphire-framework/class/Command
[commandoptions]: ../../Documentation/sapphire-framework/interfaces/CommandOptions
[getting-started]: ./getting-started-with-sapphire
4 changes: 2 additions & 2 deletions docs/Guide/getting-started/getting-started-with-sapphire.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ And that's it for your `index.js` file! In the end, your directory should look l
└── index.js
```

[sapphire]: ../../Documentation/api-framework/classes/SapphireClient
[sapphire]: ../../Documentation/sapphire-framework/class/SapphireClient
[djs-client]: https://discord.js.org/#/docs/main/stable/class/Client
[baseuserdirectory]: ../../Documentation/api-framework/interfaces/SapphireClientOptions#baseuserdirectory
[baseuserdirectory]: ../../Documentation/sapphire-framework/interfaces/SapphireClientOptions#baseuserdirectory
[securing-your-token]: https://discordjs.guide/preparations/setting-up-a-bot-application.html#your-token
2 changes: 1 addition & 1 deletion docs/Guide/plugins/API/rate-limiting.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -143,4 +143,4 @@ export class UserRoute extends Route {

Now when a user gets rate limited they will receive a 429 error with a Retry-After header.

[rlm]: ../../../Documentation/api-utilities/classes/ratelimits_src.RateLimitManager
[rlm]: ../../../Documentation/sapphire-ratelimits/class/RateLimitManager
2 changes: 1 addition & 1 deletion docs/Guide/plugins/Logger/configuring-loglevel.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ to `Warn` then logger will not log `Info` log messages.

:::

[sapphire]: ../../../Documentation/api-framework/classes/SapphireClient
[sapphire]: ../../../Documentation/sapphire-framework/class/SapphireClient
6 changes: 3 additions & 3 deletions docs/Guide/plugins/i18next/getting-started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,6 @@ export class PingCommand extends Command {
}
```

[`saphclientoptions`]: ../../../Documentation/api-framework/interfaces/SapphireClientOptions
[`fetchlanguage`]: ../../../Documentation/api-plugins/classes/i18next_src.InternationalizationHandler#fetchlanguage
[`internationalizationcontext`]: ../../../Documentation/api-plugins/interfaces/i18next_src.InternationalizationContext
[`saphclientoptions`]: ../../../Documentation/sapphire-framework/interfaces/SapphireClientOptions
[`fetchlanguage`]: ../../../Documentation/sapphire-plugin-i18next/class/InternationalizationHandler#fetchlanguage
[`internationalizationcontext`]: ../../../Documentation/sapphire-plugin-i18next/interfaces/InternationalizationContext
4 changes: 2 additions & 2 deletions docs/Guide/preconditions/channel-types.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ Failure][reporting-precondition-failure].

:::

[runin]: ../../Documentation/api-framework/interfaces/CommandOptions#runin
[runintypes]: ../../Documentation/api-framework/enums/CommandOptionsRunTypeEnum
[runin]: ../../Documentation/sapphire-framework/interfaces/CommandOptions#runin
[runintypes]: ../../Documentation/sapphire-framework/enums/CommandOptionsRunTypeEnum
[reporting-precondition-failure]: ./reporting-precondition-failure
18 changes: 9 additions & 9 deletions docs/Guide/preconditions/command-cooldown.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,13 @@ Failure][reporting-precondition-failure].

:::

[cooldowndelay]: ../../Documentation/api-framework/interfaces/CommandOptions#cooldowndelay
[cooldownfilteredusers]: ../../Documentation/api-framework/interfaces/CommandOptions#cooldownfilteredusers
[cooldownlimit]: ../../Documentation/api-framework/interfaces/CommandOptions#cooldownlimit
[cooldownscope]: ../../Documentation/api-framework/interfaces/CommandOptions#cooldownscope
[defaultcooldown]: ../../Documentation/api-framework/interfaces/SapphireClientOptions#defaultcooldown
[sapphire]: ../../Documentation/api-framework/classes/SapphireClient
[scopes]: ../../Documentation/api-framework/enums/BucketScope
[cooldowndelay]: ../../Documentation/sapphire-framework/interfaces/CommandOptions#cooldowndelay
[cooldownfilteredusers]: ../../Documentation/sapphire-framework/interfaces/CommandOptions#cooldownfilteredusers
[cooldownlimit]: ../../Documentation/sapphire-framework/interfaces/CommandOptions#cooldownlimit
[cooldownscope]: ../../Documentation/sapphire-framework/interfaces/CommandOptions#cooldownscope
[defaultcooldown]: ../../Documentation/sapphire-framework/interfaces/SapphireClientOptions#defaultcooldown
[sapphire]: ../../Documentation/sapphire-framework/class/SapphireClient
[scopes]: ../../Documentation/sapphire-framework/enums/BucketScope
[reporting-precondition-failure]: ./reporting-precondition-failure
[timeutils]: ../../Documentation/api-utilities/modules/time_utilities_src
[timeenum]: ../../Documentation/api-utilities/enums/time_utilities_src.Time
[timeutils]: ../../Documentation/sapphire-time-utilities
[timeenum]: ../../Documentation/sapphire-time-utilities/typedefs/Time
12 changes: 6 additions & 6 deletions docs/Guide/preconditions/creating-your-own-preconditions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -122,12 +122,12 @@ For a command with these preconditions to pass the denial checks, the `InVoiceCh
as `AdminOnly` _or_ both `OwnerOnly` and `ModOnly`.

[creating-commands]: ../getting-started/creating-a-basic-command
[precondition]: ../../Documentation/api-framework/classes/Precondition
[preconditionrun]: ../../Documentation/api-framework/classes/Precondition#messagerun
[preconditionok]: ../../Documentation/api-framework/classes/Precondition#ok
[preconditionerror]: ../../Documentation/api-framework/classes/Precondition#error
[preconditions-option]: ../../Documentation/api-framework/interfaces/CommandOptions#preconditions
[preconditions-interface]: ../../Documentation/api-framework/interfaces/Preconditions
[precondition]: ../../Documentation/sapphire-framework/class/Precondition
[preconditionrun]: ../../Documentation/sapphire-framework/class/Precondition#messagerun
[preconditionok]: ../../Documentation/sapphire-framework/class/Precondition#ok
[preconditionerror]: ../../Documentation/sapphire-framework/class/Precondition#error
[preconditions-option]: ../../Documentation/sapphire-framework/interfaces/CommandOptions#preconditions
[preconditions-interface]: ../../Documentation/sapphire-framework/interfaces/Preconditions
[preconditions-augment]:
https://github.com/sapphiredev/examples/blob/main/examples/with-typescript-recommended/src/preconditions/OwnerOnly.ts#L13-L17
[reporting-precondition-failure]: ./reporting-precondition-failure
4 changes: 2 additions & 2 deletions docs/Guide/preconditions/handling-permissions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,6 @@ Failure][reporting-precondition-failure].

:::

[requireduserpermissions]: ../../Documentation/api-framework/interfaces/CommandOptions#requireduserpermissions
[requiredclientpermissions]: ../../Documentation/api-framework/interfaces/CommandOptions#requiredclientpermissions
[requireduserpermissions]: ../../Documentation/sapphire-framework/interfaces/CommandOptions#requireduserpermissions
[requiredclientpermissions]: ../../Documentation/sapphire-framework/interfaces/CommandOptions#requiredclientpermissions
[reporting-precondition-failure]: ./reporting-precondition-failure
8 changes: 4 additions & 4 deletions docs/Guide/preconditions/reporting-precondition-failure.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ throw a TypeScript error for trying to read property `silent` of type `unknown`.
:::

[listeners]: ../listeners/creating-your-own-listeners
[error]: ../../Documentation/api-framework/classes/UserError
[payload]: ../../Documentation/api-framework/interfaces/MessageCommandDeniedPayload
[context]: ../../Documentation/api-framework/classes/UserError#context
[preconditionerror]: ../../Documentation/api-framework/classes/Precondition#error
[error]: ../../Documentation/sapphire-framework/class/UserError
[payload]: ../../Documentation/sapphire-framework/interfaces/MessageCommandDeniedPayload
[context]: ../../Documentation/sapphire-framework/class/UserError#context
[preconditionerror]: ../../Documentation/sapphire-framework/class/Precondition#error
[creating-preconditions]: ./creating-your-own-preconditions
25 changes: 25 additions & 0 deletions docusaurus-discordjs-docgen/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"name": "docusaurus-discordjs-docgen",
"version": "0.0.1",
"description": "A Docusaurus v2 plugin to build API documentation based on @discordjs/ts-docgen output.",
"main": "dist/index.js",
"files": [
"dist/"
],
"scripts": {
"build": "tsc",
"watch": "tsc -w",
"debug": "node --inspect scripts/debug.mjs"
},
"dependencies": {
"@sapphire/docusaurus-plugin-ts2esm2cjs": "^1.1.3",
"@sapphire/result": "^2.6.0",
"@sapphire/utilities": "^3.11.0",
"common-tags": "^1.8.2",
"css": "^3.0.0"
},
"devDependencies": {
"@docusaurus/types": "2.1.0",
"@types/common-tags": "^1.8.1"
}
}
70 changes: 70 additions & 0 deletions docusaurus-discordjs-docgen/scripts/debug.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
import { fileURLToPath } from 'node:url';
import parser from '../dist/index.js';

const docusaurusDiscordjsDocgen = parser.default;

const siteDir = new URL('../../', import.meta.url);
const generatedFilesDir = new URL('.docusaurus/', siteDir);
const outDir = new URL('build/', siteDir);
const siteConfigPath = new URL('docusaurus.config.js', siteDir);

const docgenJsonFile = new URL('data/framework.json', siteDir);
const outDocs = new URL('docs/Documentation/sapphire-framework', siteDir);

docusaurusDiscordjsDocgen(
{
siteDir: fileURLToPath(siteDir),
generatedFilesDir: fileURLToPath(generatedFilesDir),
siteConfig: {
title: 'Sapphire',
url: 'https://sapphirejs.dev',
baseUrl: '/',
onBrokenLinks: 'warn',
onBrokenMarkdownLinks: 'warn',
onDuplicateRoutes: 'throw',
favicon: 'img/favicon.ico',
tagline:
'Sapphire is a next-gen Discord bot framework for developers of all skill levels to make the best JavaScript/TypeScript based bots possible.',
organizationName: 'sapphiredev',
projectName: 'framework',
baseUrlIssueBanner: true,
i18n: {
defaultLocale: 'en',
locales: ['en'],
localeConfigs: {}
},
staticDirectories: ['static'],
customFields: {},
scripts: [],
stylesheets: [],
clientModules: [],
titleDelimiter: '|',
noIndex: false
},
siteConfigPath: fileURLToPath(siteConfigPath),
outDir: fileURLToPath(outDir),
baseUrl: '/',
i18n: {
defaultLocale: 'en',
locales: ['en'],
currentLocale: 'en',
localeConfigs: {
en: {
label: 'English',
direction: 'ltr',
htmlLang: 'en'
}
}
},
codeTranslations: {}
},
{
id: 'framework',
docgenJsonFile: fileURLToPath(docgenJsonFile),
out: fileURLToPath(outDocs),
sidebar: {
categoryLabel: '@sapphire/framework',
position: 0
}
}
).loadContent();
Loading

0 comments on commit 6704487

Please sign in to comment.