chore(website): Update docusarus v3.8, improve build perf (#4209)

* Update docusaurus to v3.8, improve performance

Docusaurus:
- Update to v3.8.0
- Enable new faster features, rspack bundler cache and worker threads
- Update CI to cache rspack bundler cache
- Update dependencies to latest versions
- Update blog posts to use the truncate tag
- Update caniuse-lite

Removed duplicated type documentation generation for bot package

* Use .jsonc files for typedoc
And use the readme option instead of a custom script

* remvoe typedoc script

---------

Co-authored-by: Jonathan Ho <heiheiho000@gmail.com>
This commit is contained in:
Fleny
2025-06-02 07:47:19 +02:00
committed by GitHub
parent 4b75b11339
commit 70bcd16e8d
17 changed files with 768 additions and 640 deletions

View File

@@ -38,6 +38,13 @@ jobs:
run: yarn build:doc run: yarn build:doc
- run: yarn install --immutable - run: yarn install --immutable
working-directory: ./website working-directory: ./website
- name: Restore bundler cache
uses: actions/cache@v4
with:
key: ${{ runner.os }}-docusaurus-bundler-${{ github.sha }}
path: ./website/node_modules/.cache
restore-keys: |
${{ runner.os }}-docusaurus-bundler-
- name: Build website - name: Build website
run: yarn build run: yarn build
working-directory: ./website working-directory: ./website

1
.gitignore vendored
View File

@@ -18,6 +18,7 @@ node_modules
website/.yarn website/.yarn
website/api_reference/generated/**/*.md website/api_reference/generated/**/*.md
!website/api_reference/generated/_media/README.md
# testing # testing
coverage coverage

View File

@@ -10,7 +10,7 @@
"scripts": { "scripts": {
"build": "turbo build", "build": "turbo build",
"build:type": "turbo build:type", "build:type": "turbo build:type",
"build:doc": "typedoc --options ./typedoc.json && node scripts/finalizeTypedocs.js", "build:doc": "typedoc --options ./typedoc.jsonc",
"build:watch": "turbo watch build build:type", "build:watch": "turbo watch build build:type",
"release-build": "turbo build build:type", "release-build": "turbo build build:type",
"test:unit": "turbo test:unit", "test:unit": "turbo test:unit",

View File

@@ -0,0 +1,5 @@
{
"entryPoints": ["./src/index.ts"],
// Exclude other packages' dist folders to avoid duplicated types in the documentation
"exclude": ["../*/dist/**/*"]
}

View File

@@ -1,3 +0,0 @@
{
"entryPoints": ["./src/index.ts"]
}

View File

@@ -1,18 +0,0 @@
import { writeFile } from 'node:fs/promises'
import typedocConfig from '../typedoc.json' with { type: 'json' }
const typedocOutPath = typedocConfig.out
await writeFile(
`${typedocOutPath}/README.md`,
[
'[**Documentation**](README.md) • **Docs**',
'',
'***',
'',
'# 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'),
)

View File

@@ -3,6 +3,7 @@
"entryPointStrategy": "packages", "entryPointStrategy": "packages",
"entryPoints": ["packages/bot", "packages/gateway", "packages/rest", "packages/types", "packages/utils"], "entryPoints": ["packages/bot", "packages/gateway", "packages/rest", "packages/types", "packages/utils"],
"out": "./website/api_reference/generated", "out": "./website/api_reference/generated",
"readme": "./website/api_reference/generated/_media/README.md",
"cleanOutputDir": false, "cleanOutputDir": false,
"plugin": ["typedoc-plugin-markdown"], "plugin": ["typedoc-plugin-markdown"],
"commentStyle": "all", "commentStyle": "all",

View File

@@ -1,7 +1,3 @@
[**Documentation**](README.md) • **Docs**
***
# Discordeno # 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) Thank you for using Discordeno. These docs are generated automatically. If you see any issues please contact us on [Discord](https://discord.gg/ddeno)

View File

@@ -10,6 +10,8 @@ date: 2023-02-28T23:07:48Z
This is the changelog for Discordeno. This is the changelog for Discordeno.
<!-- truncate -->
## Description ## Description
This version began with the simple intention of trying to solve the headache of Deno installation. For a long time now, I have been unable to code on discordeno because Deno would not upgrade on my system. This meant I was stuck using Deno 1.20 while the CI would be using the latest Deno version. When I would push code, it would break as the deno format and linters and checkers would be all different. As new features were added to Deno, I was unable to use them and it made it difficult. However, because of Github Codespaces I was able to code on it for a while. Once Github Codespaces began introducing limits, I could no longer use Deno anywhere. This meant Discordeno went unmaintained for quite a while. I tried to fix Deno on my system for weeks but had no luck. However, I was not willing to remove Deno because I wanted to support existing users. Once Deno released `npm` support, I knew it was time to begin migrating the code of our library to NodeJS. This version began with the simple intention of trying to solve the headache of Deno installation. For a long time now, I have been unable to code on discordeno because Deno would not upgrade on my system. This meant I was stuck using Deno 1.20 while the CI would be using the latest Deno version. When I would push code, it would break as the deno format and linters and checkers would be all different. As new features were added to Deno, I was unable to use them and it made it difficult. However, because of Github Codespaces I was able to code on it for a while. Once Github Codespaces began introducing limits, I could no longer use Deno anywhere. This meant Discordeno went unmaintained for quite a while. I tried to fix Deno on my system for weeks but had no luck. However, I was not willing to remove Deno because I wanted to support existing users. Once Deno released `npm` support, I knew it was time to begin migrating the code of our library to NodeJS.

View File

@@ -10,6 +10,8 @@ date: 2023-04-03T17:01:03Z
As a team, we have recently made the decision to move away from Deno and migrate to Node.js. This was not a decision we made lightly, but rather one that was based on several factors. As a team, we have recently made the decision to move away from Deno and migrate to Node.js. This was not a decision we made lightly, but rather one that was based on several factors.
<!-- truncate -->
## Deno's Broken Promises: Why we had to make the switch ## Deno's Broken Promises: Why we had to make the switch
One of the primary reasons we decided to make the switch was because we found that Deno had become a worse version of Node.js. One of the primary reasons we decided to make the switch was because we found that Deno had become a worse version of Node.js.

View File

@@ -1,5 +1,3 @@
// Note: type annotations allow type checking and IDEs autocompletion
import type { Options as ClientRedirectOptions } from '@docusaurus/plugin-client-redirects' import type { Options as ClientRedirectOptions } from '@docusaurus/plugin-client-redirects'
import type { Options as PluginContentDocs } from '@docusaurus/plugin-content-docs' import type { Options as PluginContentDocs } from '@docusaurus/plugin-content-docs'
import type { Options as PresetClassicOptions, ThemeConfig } from '@docusaurus/preset-classic' import type { Options as PresetClassicOptions, ThemeConfig } from '@docusaurus/preset-classic'
@@ -24,7 +22,21 @@ const config: Config = {
trailingSlash: false, trailingSlash: false,
future: { future: {
experimental_faster: true, v4: {
// Used for https://docusaurus.io/blog/releases/3.8#worker-threads
removeLegacyPostBuildHeadAttribute: true,
useCssCascadeLayers: false,
},
experimental_faster: {
lightningCssMinimizer: true,
mdxCrossCompilerCache: true,
rspackBundler: true,
rspackPersistentCache: true,
ssgWorkerThreads: true,
swcHtmlMinimizer: true,
swcJsLoader: true,
swcJsMinimizer: true,
},
}, },
onBrokenLinks: 'throw', onBrokenLinks: 'throw',

View File

@@ -14,35 +14,34 @@
"write-heading-ids": "docusaurus write-heading-ids", "write-heading-ids": "docusaurus write-heading-ids",
"typecheck": "tsc", "typecheck": "tsc",
"lint": "biome lint --write", "lint": "biome lint --write",
"format": "biome format --write", "format": "biome format --write"
"setup-dd": ""
}, },
"dependencies": { "dependencies": {
"@docusaurus/core": "3.6.3", "@docusaurus/core": "^3.8.0",
"@docusaurus/faster": "^3.6.3", "@docusaurus/faster": "^3.8.0",
"@docusaurus/plugin-client-redirects": "^3.6.3", "@docusaurus/plugin-client-redirects": "^3.8.0",
"@docusaurus/plugin-content-docs": "^3.6.3", "@docusaurus/plugin-content-docs": "^3.8.0",
"@docusaurus/preset-classic": "3.6.3", "@docusaurus/preset-classic": "^3.8.0",
"@docusaurus/theme-common": "3.6.3", "@docusaurus/theme-common": "^3.8.0",
"@easyops-cn/docusaurus-search-local": "^0.45.0", "@easyops-cn/docusaurus-search-local": "^0.49.2",
"@mdx-js/react": "^3.1.0", "@mdx-js/react": "^3.1.0",
"chart.js": "^4.4.6", "chart.js": "^4.4.9",
"clsx": "^2.1.1", "clsx": "^2.1.1",
"prism-react-renderer": "^2.4.0", "prism-react-renderer": "^2.4.1",
"react": "^18.3.1", "react": "^18.3.1",
"react-chartjs-2": "^5.2.0", "react-chartjs-2": "^5.3.0",
"react-dom": "^18.3.1", "react-dom": "^18.3.1",
"reactflow": "^11.11.4", "reactflow": "^11.11.4",
"styled-components": "^6.1.13" "styled-components": "^6.1.18"
}, },
"devDependencies": { "devDependencies": {
"@biomejs/biome": "^1.9.4", "@biomejs/biome": "^1.9.4",
"@docusaurus/module-type-aliases": "3.6.3", "@docusaurus/module-type-aliases": "^3.8.0",
"@docusaurus/tsconfig": "3.6.3", "@docusaurus/tsconfig": "^3.8.0",
"@docusaurus/types": "3.6.3", "@docusaurus/types": "^3.8.0",
"@types/react": "^18.3.12", "@types/react": "^18.3.23",
"typescript": "5.7.2", "typescript": "5.8.3",
"webpack": "5.99.5" "webpack": "5.99.9"
}, },
"browserslist": { "browserslist": {
"production": [ "production": [

File diff suppressed because it is too large Load Diff