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 2 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
8 changes: 8 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,11 @@ enableGlobalCache: false
npmPublishAccess: public

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

nodeLinker: node-modules

packageExtensions:
"@docusaurus/bundler@*":
dependencies:
"@docusaurus/faster": "*"

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
4 changes: 4 additions & 0 deletions website/docusaurus.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
const buildType = process.env.BUILD_TYPE;

module.exports = {
future: {
experimental_faster: true,
},
Copy link

Choose a reason for hiding this comment

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

💡 Codebase verification

Add documentation for experimental feature and its implications

The experimental feature is correctly configured and the required dependencies (@docusaurus/core and @docusaurus/faster v3.6.0) are properly installed. However, since there's no existing documentation about this experimental feature in the codebase, it's important to document its usage and implications.

 const buildType = process.env.BUILD_TYPE;
 
 module.exports = {
+  // Enable Docusaurus Faster (using @docusaurus/faster v3.6.0)
+  // This experimental feature uses Rspack instead of Webpack for improved build performance
+  // Note: If you experience issues with Yarn PnP, you may need to disable this feature
   future: {
     experimental_faster: true,
   },
🔗 Analysis chain

Document experimental feature and known limitations.

The experimental feature is correctly configured under the future namespace. However, given its experimental status and known limitations with Yarn PnP, consider adding comments to document:

  • The significant performance improvements for cold builds
  • Current limitations with Yarn PnP
  • Minimum required Docusaurus version (3.6.0)

Add documentation comments above the configuration:

 const buildType = process.env.BUILD_TYPE;
 
 module.exports = {
+  // Enable Docusaurus Faster for improved build performance
+  // Note: Requires Docusaurus >= 3.6.0
+  // - Cold builds: ~3.1s (vs ~11.8s without)
+  // - Known issue: Build fails with Yarn PnP enabled
   future: {
     experimental_faster: true,
   },

Let's verify if this experimental feature is documented in Docusaurus:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for documentation about the experimental_faster feature
rg -i "experimental[_\s]faster|docusaurus faster" README.md docs/

Length of output: 113


Script:

#!/bin/bash
# Let's first check if we're in the correct directory structure
fd -t d "website"

# Then search for any documentation about the experimental feature
cd website && rg -i "experimental[_\s]faster|docusaurus faster" .

# Also check package.json for Docusaurus version
cat website/package.json | jq '.dependencies["@docusaurus/core"], .dependencies["@docusaurus/faster"]'

Length of output: 325


Script:

#!/bin/bash
# Let's check package.json in the correct location
cat package.json | jq '.dependencies'

# Also search for any related documentation in the website directory
rg -i "performance|build.*speed|faster" . -g "!node_modules" -g "!build" -A 2 -B 2

Length of output: 6305


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