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
- 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: 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
- chore: regen and dedupe lockfile
- fix(docusaurus-typedoc-json-parser): absorb breaking changes and add versioning
- refactor: switch to using typedoc-json-parser plugin
- chore: add `update` script
- fix(deps): update dependency typedoc-json-parser to ^6.0.2
- fix(docusaurus-typedoc-json-parser): proper category yamls
- feat(docusaurus-typedoc-json-parser): first steps to proper type linking
- refactor(docusaurus-typedoc-json-parser): switch from constant to variable
- feat(docusaurus-typedoc-json-parser): render classes
- ci: use tags for actions
- chore: cleanup
- fix(typedoc-parser): fixed no auth requests
- refactor: depluginize the plugin
- chore: fix typecheck
- chore: update to yarn 3.2.4
- chore: remove unnecessary package script
- feat(json-parser): render enums
- chore(json-parser): remove useless script
- feat(json-parser): render functions
- feat(json-parser): add accessibility and static modifiers for class methods
- feat(json-parser): more steps towards proper reference linking
- chore(deps): update dependency typedoc-json-parser to ^7.0.0
- fix(deps): update dependency typedoc-json-parser to ^7.0.1
- feat(json-parser): even more steps to proper reference linking
- chore: update deps
- feat: add ReadOnlyPill code
- feat: add code for other pills
- fix: flex wrap items
- chore: update readme banner
  • Loading branch information
favna committed Apr 14, 2023
1 parent bc3cbbf commit 1e66654
Show file tree
Hide file tree
Showing 54 changed files with 1,370 additions and 3,935 deletions.
6 changes: 1 addition & 5 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
# Node modules
node_modules/

# Submodules
projects/

# Generated data
docs/Documentation/
.docusaurus/
json-parser/dist/

src/index.d.ts

docs/Guide/code/
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.

4 changes: 1 addition & 3 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
# Node modules
node_modules/

# Submodules
projects/

# Generated data
docs/Documentation/
.docusaurus/
build/
json-parser/dist/
20 changes: 20 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"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}/json-parser",
"env": {
"NODE_ENV": "development"
},
"console": "internalConsole",
"outputCapture": "std",
"outFiles": ["${workspaceFolder}/json-parser/dist/**/*.js"]
}
]
}
137 changes: 5 additions & 132 deletions docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@ const BaseUrl = 'https://sapphirejs.dev';
const Email = '[email protected]';
const Title = 'Sapphire Framework';

/** @type {import('@docusaurus/types').Config} */
/** @type {import('@docusaurus/types').DocusaurusConfig} */
const config = {
title: 'Sapphire',
url: BaseUrl,
baseUrl: '/',
onBrokenLinks: 'warn',
onBrokenMarkdownLinks: 'warn',
// TODO: Re-enable after adding all JSON files. See temporary-errors-log-of-broken-links.md
onBrokenLinks: 'ignore',
// TODO: Re-enable after adding all JSON files. See temporary-errors-log-of-broken-links.md
onBrokenMarkdownLinks: 'ignore',
onDuplicateRoutes: 'warn',
favicon: 'favicon.ico',
tagline: Description,
Expand Down Expand Up @@ -47,135 +49,6 @@ const config = {
}
]
}
],
[
'docusaurus-plugin-typedoc',
{
id: 'framework',
entryPoints: ['./projects/framework/src/index.ts'],
tsconfig: './projects/framework/src/tsconfig.json',
readme: 'none',
out: 'Documentation/api-framework',
plugin: ['typedoc-plugin-mdn-links', 'typedoc-plugin-djs-links'],
sidebar: {
categoryLabel: '@sapphire/framework',
position: 0,
fullNames: true
}
}
],
[
'docusaurus-plugin-typedoc',
{
id: 'Pieces',
entryPoints: ['./projects/pieces/src/index.ts'],
tsconfig: './projects/pieces/src/tsconfig.json',
readme: 'none',
out: 'Documentation/api-pieces',
plugin: ['typedoc-plugin-mdn-links'],
sidebar: {
categoryLabel: '@sapphire/pieces',
position: 1,
fullNames: true
}
}
],
[
'docusaurus-plugin-typedoc',
{
id: 'Utilities',
entryPointStrategy: 'resolve',
entryPoints: [
'./projects/utilities/packages/async-queue/src/index.ts',
'./projects/utilities/packages/bitfield/src/index.ts',
'./projects/utilities/packages/cron/src/index.ts',
'./projects/utilities/packages/decorators/src/index.ts',
'./projects/utilities/packages/discord-utilities/src/index.ts',
'./projects/utilities/packages/discord.js-utilities/src/index.ts',
'./projects/utilities/packages/duration/src/index.ts',
'./projects/utilities/packages/event-iterator/src/index.ts',
'./projects/utilities/packages/fetch/src/index.ts',
'./projects/utilities/packages/lexure/src/index.ts',
'./projects/utilities/packages/node-utilities/src/index.ts',
'./projects/utilities/packages/phisherman/src/index.ts',
'./projects/utilities/packages/ratelimits/src/index.ts',
'./projects/utilities/packages/result/src/index.ts',
'./projects/utilities/packages/snowflake/src/index.ts',
'./projects/utilities/packages/stopwatch/src/index.ts',
'./projects/utilities/packages/time-utilities/src/index.ts',
'./projects/utilities/packages/timer-manager/src/index.ts',
'./projects/utilities/packages/timestamp/src/index.ts',
'./projects/utilities/packages/utilities/src/index.ts'
],
tsconfig: './tsconfig.typedoc.json',
readme: 'none',
out: 'Documentation/api-utilities',
plugin: ['typedoc-plugin-mdn-links', 'typedoc-plugin-djs-links'],
sidebar: {
categoryLabel: 'Sapphire Utilities',
position: 2
}
}
],
[
'docusaurus-plugin-typedoc',
{
id: 'Plugins',
entryPointStrategy: 'resolve',
entryPoints: [
'./projects/plugins/packages/api/src/index.ts',
'./projects/plugins/packages/editable-commands/src/index.ts',
'./projects/plugins/packages/hmr/src/index.ts',
'./projects/plugins/packages/i18next/src/index.ts',
'./projects/plugins/packages/logger/src/index.ts',
'./projects/plugins/packages/pattern-commands/src/index.ts',
'./projects/plugins/packages/scheduled-tasks/src/index.ts',
'./projects/plugins/packages/subcommands/src/index.ts',
'./projects/plugins/packages/utilities-store/src/index.ts'
],
tsconfig: './tsconfig.typedoc.json',
readme: 'none',
out: 'Documentation/api-plugins',
excludeExternals: true,
externalPattern: ['node_modules/@types/**'],
plugin: ['typedoc-plugin-mdn-links', 'typedoc-plugin-djs-links'],
sidebar: {
categoryLabel: 'Sapphire Plugins',
position: 3
}
}
],
[
'docusaurus-plugin-typedoc',
{
id: 'Type',
entryPoints: ['./projects/type/src/index.ts'],
tsconfig: './projects/type/src/tsconfig.json',
readme: './projects/type/README.md',
out: 'Documentation/api-type',
plugin: ['typedoc-plugin-mdn-links'],
sidebar: {
categoryLabel: '@sapphire/type',
position: 4,
fullNames: true
}
}
],
[
'docusaurus-plugin-typedoc',
{
id: 'Shapeshift',
entryPoints: ['./projects/shapeshift/src/index.ts'],
tsconfig: './projects/shapeshift/src/tsconfig.json',
readme: './projects/shapeshift/README.md',
out: 'Documentation/api-shapeshift',
plugin: ['typedoc-plugin-mdn-links'],
sidebar: {
categoryLabel: '@sapphire/shapeshift',
position: 5,
fullNames: true
}
}
]
],

Expand Down
33 changes: 33 additions & 0 deletions json-parser/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"name": "json-parser",
"version": "0.0.1",
"description": "Parses API documentation from typedoc-json-parser to markdown files for Docusaurus.",
"type": "module",
"main": "dist/cli.mjs",
"files": [
"dist/"
],
"scripts": {
"build": "tsup",
"debug": "node --inspect dist/cli.mjs",
"start": "NODE_NO_WARNINGS=1 node dist/cli.mjs",
"type-check": "tsc --noEmit"
},
"dependencies": {
"@sapphire/fetch": "^2.4.1",
"@sapphire/result": "^2.6.1",
"@sapphire/utilities": "^3.11.1",
"colorette": "^2.0.19",
"common-tags": "^1.8.2",
"css": "^3.0.0",
"typedoc-json-parser": "^7.2.0"
},
"devDependencies": {
"@docusaurus/types": "^2.4.0",
"@types/common-tags": "^1.8.1",
"dotenv": "^16.0.3",
"esbuild-plugin-file-path-extensions": "^1.0.0",
"tsup": "^6.7.0",
"typescript": "^5.0.4"
}
}
12 changes: 12 additions & 0 deletions json-parser/src/cli.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env node

import { docusaurusTypeDocJsonParser } from './parser';
import { config } from 'dotenv';
import { URLSearchParams } from 'node:url';

config();

await docusaurusTypeDocJsonParser({
githubContentUrl: `https://api.github.com/repos/sapphiredev/docs/contents/docs?${new URLSearchParams({ ref: 'main' })}`,
githubToken: process.env.GITHUB_TOKEN
});
Loading

0 comments on commit 1e66654

Please sign in to comment.