Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade Docusaurus - Enable Docusaurus Faster on website #468

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,5 @@ yarn-error.log
!.yarn/releases
!.yarn/sdks
!.yarn/versions

.idea
18 changes: 18 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,21 @@ enableGlobalCache: false
npmPublishAccess: public

yarnPath: .yarn/releases/yarn-4.0.1.cjs

# nodeLinker: node-modules

packageExtensions:
"@docusaurus/bundler@*":
dependencies:
"@docusaurus/faster": "*"
"@docusaurus/theme-common@*":
dependencies:
"@docusaurus/plugin-content-docs": "*"
"terser-webpack-plugin@*":
dependencies:
"@swc/core": "*"
"css-minimizer-webpack-plugin@*":
dependencies:
"lightningcss": "*"


12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@
],
"packageManager": "[email protected]",
"resolutions": {
"@docusaurus/core": "3.0.0",
"@docusaurus/module-type-aliases": "3.0.0",
"@docusaurus/preset-classic": "3.0.0",
"@docusaurus/theme-classic": "3.0.0",
"@docusaurus/theme-common": "3.0.0",
"@docusaurus/plugin-content-docs": "3.0.0",
"@docusaurus/core": "3.6.0",
"@docusaurus/module-type-aliases": "3.6.0",
"@docusaurus/preset-classic": "3.6.0",
"@docusaurus/theme-classic": "3.6.0",
"@docusaurus/theme-common": "3.6.0",
"@docusaurus/plugin-content-docs": "3.6.0",
"@types/react": "18.2.37"
},
"engines": {
Expand Down
3 changes: 0 additions & 3 deletions website-multi-docs/babel.config.js

This file was deleted.

11 changes: 11 additions & 0 deletions website-multi-docs/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,17 @@ const lightCodeTheme = themes.github;
const darkCodeTheme = themes.dracula;

const config = {
future: {
experimental_faster: {
swcJsLoader: true,
swcJsMinimizer: true,
swcHtmlMinimizer: true,
lightningCssMinimizer: true,
rspackBundler: false,
mdxCrossCompilerCache: true,
},
},

title: "My Site",
tagline: "Dinosaurs are cool",
url: "https://your-docusaurus-test-site.com",
Expand Down
13 changes: 7 additions & 6 deletions website-multi-docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@
"write-heading-ids": "docusaurus write-heading-ids"
},
"dependencies": {
"@docusaurus/core": "^3.0.0",
"@docusaurus/plugin-content-docs": "^3.0.0",
"@docusaurus/preset-classic": "^3.0.0",
"@docusaurus/theme-classic": "^3.0.0",
"@docusaurus/theme-common": "^3.0.0",
"@docusaurus/core": "3.6.0",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

Version consistency verified across website and website-multi-docs, but other packages need attention

The verification revealed mixed versioning patterns across the repository:

  • website and website-multi-docs correctly use exact version 3.6.0 for all Docusaurus packages
  • docusaurus-search-local package uses different version patterns:
    • Uses ^2 || ^3 for some packages
    • Uses ^3.0.0 for others
    • Uses exact version 3.0.0 for @docusaurus/tsconfig

This inconsistency in versioning patterns across the repository could lead to compatibility issues. Consider aligning all Docusaurus package versions to 3.6.0 across the entire repository for better consistency.

🔗 Analysis chain

LGTM! Consistent version updates across Docusaurus packages.

The alignment of all Docusaurus packages to exact version 3.6.0 (removing caret versioning) ensures build consistency, which is crucial for testing the new bundler.

Let's verify version consistency across all Docusaurus packages in the repository:

Also applies to: 19-22, 31-31

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any mismatched Docusaurus package versions
# Expected: All Docusaurus packages should be at version 3.6.0

echo "Checking Docusaurus package versions across all package.json files..."
fd package.json --type f --exec jq -r '.dependencies + .devDependencies | with_entries(select(.key | startswith("@docusaurus"))) | to_entries[] | "\(.key): \(.value)"'

Length of output: 367


Script:

#!/bin/bash
# Let's try a different approach to check package versions
# First, let's confirm the existence of package.json files
fd package.json --type f

# Then let's examine their content specifically for Docusaurus packages
echo "=== Checking Docusaurus package versions ==="
fd package.json --type f --exec cat {} \; | grep "@docusaurus.*\":" -A 1

# Additionally, let's check if there are any workspace configurations
echo "=== Checking for workspace configurations ==="
fd "package.json|yarn.lock|pnpm-workspace.yaml|lerna.json" --type f --max-depth 1

Length of output: 1977

"@docusaurus/faster": "3.6.0",
"@docusaurus/plugin-content-docs": "3.6.0",
"@docusaurus/preset-classic": "3.6.0",
"@docusaurus/theme-classic": "3.6.0",
"@docusaurus/theme-common": "3.6.0",
"@easyops-cn/docusaurus-search-local": "^workspace:*",
"@mdx-js/react": "^3.0.0",
"clsx": "^1.1.1",
Expand All @@ -27,7 +28,7 @@
"react-dom": "^18.2.0"
},
"devDependencies": {
"@docusaurus/module-type-aliases": "^3.0.0"
"@docusaurus/module-type-aliases": "3.6.0"
},
"browserslist": {
"production": [
Expand Down
3 changes: 0 additions & 3 deletions website/babel.config.js

This file was deleted.

11 changes: 11 additions & 0 deletions website/docusaurus.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
const buildType = process.env.BUILD_TYPE;

module.exports = {
future: {
experimental_faster: {
swcJsLoader: true,
swcJsMinimizer: true,
swcHtmlMinimizer: true,
lightningCssMinimizer: true,
rspackBundler: false,
mdxCrossCompilerCache: true,
},
},

title: "Docusaurus Search",
tagline:
"An offline/local search example using @easyops-cn/docusaurus-search-local",
Expand Down
10 changes: 6 additions & 4 deletions website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,17 @@
"docusaurus": "docusaurus",
"start": "docusaurus start",
"build": "docusaurus build",
"clear": "docusaurus clear",
"swizzle": "docusaurus swizzle",
"deploy": "docusaurus deploy",
"serve": "docusaurus serve"
},
"dependencies": {
"@docusaurus/core": "^3.0.0",
"@docusaurus/preset-classic": "^3.0.0",
"@docusaurus/theme-classic": "^3.0.0",
"@docusaurus/theme-common": "^3.0.0",
"@docusaurus/core": "3.6.0",
"@docusaurus/faster": "3.6.0",
"@docusaurus/preset-classic": "3.6.0",
"@docusaurus/theme-classic": "3.6.0",
"@docusaurus/theme-common": "3.6.0",
Comment on lines +15 to +19
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

Inconsistent Docusaurus dependency versions detected across packages

The verification reveals version inconsistencies across different packages in the repository:

  • website/package.json: Fixed version 3.6.0
  • website-multi-docs/package.json: Caret range ^3.0.0
  • docusaurus-search-local/package.json: Wide range ^2 || ^3

These inconsistencies could lead to compatibility issues. Consider:

  • Aligning versions in website-multi-docs to use the same fixed version 3.6.0
  • Updating docusaurus-search-local to specifically target version 3
🔗 Analysis chain

Verify dependency version consistency

Let's verify that all Docusaurus-related dependencies are consistently updated across the project to avoid version conflicts.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for inconsistent @docusaurus/* package versions across package.json files

# Find all package.json files
echo "Searching for @docusaurus/* dependencies in all package.json files:"
fd package.json --type f --exec sh -c '
    echo "\nChecking {}"
    cat {} | jq -r "
        if has(\"dependencies\") then
            .dependencies | to_entries[] | 
            select(.key | startswith(\"@docusaurus/\")) | 
            \"\(.key): \(.value)\"
        else
            empty
        end
    "
'

Length of output: 1111

"@easyops-cn/docusaurus-search-local": "workspace:*",
"@mdx-js/react": "^3.0.0",
"clsx": "^1.1.1",
Expand Down
Loading
Loading