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

chore: bump docusaurus to canary verison #428

Merged
merged 7 commits into from
Oct 31, 2024

Conversation

ruibaby
Copy link
Member

@ruibaby ruibaby commented Oct 12, 2024

Support for building projects via rspack has been added in the latest Canary version of Docusaurus, which significantly improves compilation speed.

❯ hyperfine --prepare 'pnpm clear' --runs 5 'DOCUSAURUS_FASTER=false pnpm build' 'DOCUSAURUS_FASTER=true pnpm build'
Benchmark 1: DOCUSAURUS_FASTER=false pnpm build
  Time (mean ± σ):     70.715 s ± 17.150 s    [User: 134.096 s, System: 31.651 s]
  Range (min … max):   52.330 s … 88.497 s    5 runs

Benchmark 2: DOCUSAURUS_FASTER=true pnpm build
  Time (mean ± σ):     30.094 s ±  4.572 s    [User: 64.061 s, System: 28.384 s]
  Range (min … max):   25.832 s … 37.655 s    5 runs

Summary
  DOCUSAURUS_FASTER=true pnpm build ran
    2.35 ± 0.67 times faster than DOCUSAURUS_FASTER=false pnpm build

see: facebook/docusaurus#10556 (comment)

None 

Copy link

vercel bot commented Oct 12, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
halo-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 31, 2024 9:36am

@f2c-ci-robot f2c-ci-robot bot added the do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. label Oct 12, 2024
@ruibaby
Copy link
Member Author

ruibaby commented Oct 14, 2024

/hold

@f2c-ci-robot f2c-ci-robot bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 14, 2024
Copy link
Member

@JohnNiang JohnNiang left a comment

Choose a reason for hiding this comment

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

/lgtm

@f2c-ci-robot f2c-ci-robot bot added lgtm Indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Oct 14, 2024
@f2c-ci-robot f2c-ci-robot bot removed the lgtm Indicates that a PR is ready to be merged. label Oct 15, 2024
@slorber
Copy link

slorber commented Oct 16, 2024

Thanks for trying it @ruibaby

I'm a bit disappointed by the limited gain here 😅 it should be even faster.

Can you please run a faster build with DOCUSAURUS_PERF_LOGGER=true and share the log? (see facebook/docusaurus#4765)

Also added some troubleshooting notes here:

facebook/docusaurus#10556 (comment)

@ruibaby
Copy link
Member Author

ruibaby commented Oct 16, 2024

Hi @slorber Thanks for following up.

I tested again with a cold build and logger enabled, and here are the results:

cold builds:

❯ hyperfine --prepare 'pnpm clear' --runs 5 'DOCUSAURUS_FASTER=false pnpm build' 'DOCUSAURUS_FASTER=true pnpm build'
Benchmark 1: DOCUSAURUS_FASTER=false pnpm build
  Time (mean ± σ):     70.715 s ± 17.150 s    [User: 134.096 s, System: 31.651 s]
  Range (min … max):   52.330 s … 88.497 s    5 runs

Benchmark 2: DOCUSAURUS_FASTER=true pnpm build
  Time (mean ± σ):     30.094 s ±  4.572 s    [User: 64.061 s, System: 28.384 s]
  Range (min … max):   25.832 s … 37.655 s    5 runs

Summary
  DOCUSAURUS_FASTER=true pnpm build ran
    2.35 ± 0.67 times faster than DOCUSAURUS_FASTER=false pnpm build

logger enabled:

❯ DOCUSAURUS_FASTER=true DOCUSAURUS_PERF_LOGGER=true pnpm build

> @halo-dev/[email protected] build /Users/ryanwang/Workspace/github/ruibaby/docs
> docusaurus build

[PERF] Get locales to build - 130.58 ms
[INFO] [zh-Hans] Creating an optimized production build...
[PERF] Build > zh-Hans > Load site > Load plugins > Init plugins - 149.13 ms
[PERF] Build > zh-Hans > Load site > Load plugins > Load plugins content > Load classic@default > translatePluginContent() - 7.94 ms
[PERF] Build > zh-Hans > Load site > Load plugins > Load plugins content > Load google-gtag@default - 8.30 ms
[PERF] Build > zh-Hans > Load site > Load plugins > Load plugins content > Load pages@default > loadContent() - 9.15 ms
[PERF] Build > zh-Hans > Load site > Load plugins > Load plugins content > Load classic@default - 12.37 ms
[PERF] Build > zh-Hans > Load site > Load plugins > Load plugins content > Load pages@default - 12.65 ms
[PERF] Build > zh-Hans > Load site > Load plugins > Load plugins content > Load docs@default > loadContent() - 4.17 seconds!
[PERF] Build > zh-Hans > Load site > Load plugins > Load plugins content > Load docs@default > contentLoaded() - 40.46 ms
[PERF] Build > zh-Hans > Load site > Load plugins > Load plugins content > Load docs@default - 4.21 seconds!
[PERF] Build > zh-Hans > Load site > Load plugins > Load plugins content - 4.21 seconds!
[PERF] Build > zh-Hans > Load site > Load plugins - 4.37 seconds!
[PERF] Build > zh-Hans > Load site > Create site files - 28.67 ms
[PERF] Build > zh-Hans > Load site - 4.40 seconds!
[PERF] Build > zh-Hans > Creating rspack bundler configs - 70.99 ms
●  ━━━━━━━━━━━━━━━━━━━━━━━━━ (8%) setup compilation
● Client ━━━━━━━━━━━━━━━━━━━━━━━━━ (100%) emitting after emit                                          [PERF] Build > zh-Hans > Bundling with rspack - 6.86 seconds!
[PERF] Build > zh-Hans > SSG > Load App renderer > Server bundle size = 2.418 MB
[PERF] Build > zh-Hans > SSG > Load App renderer > Evaluate server bundle - 57.41 ms
[PERF] Build > zh-Hans > SSG > Load App renderer - 58.15 ms
[PERF] Build > zh-Hans > SSG > Generate static files - 4.98 seconds!
[PERF] Build > zh-Hans > SSG - 5.04 seconds!
[PERF] Build > zh-Hans > Deleting server bundle - 32.12 ms
[PERF] Build > zh-Hans > postBuild() - 60.33 ms
[WARNING] Docusaurus found broken anchors!

Please check the pages of your site in the list below, and make sure you don't reference any anchor that does not exist.
Note: it's possible to ignore broken anchors with the 'onBrokenAnchors' Docusaurus configuration, and let the build pass.

Exhaustive list of all broken anchors found:
- Broken anchor on source page path = /2.16/developer-guide/plugin/publish:
   -> linking to /2.16/developer-guide/plugin/introduction#%E7%89%88%E6%9C%AC%E6%8E%A7%E5%88%B6
- Broken anchor on source page path = /2.17/developer-guide/plugin/publish:
   -> linking to /2.17/developer-guide/plugin/introduction#%E7%89%88%E6%9C%AC%E6%8E%A7%E5%88%B6
- Broken anchor on source page path = /2.18/developer-guide/plugin/publish:
   -> linking to /2.18/developer-guide/plugin/introduction#%E7%89%88%E6%9C%AC%E6%8E%A7%E5%88%B6
- Broken anchor on source page path = /2.19/developer-guide/plugin/publish:
   -> linking to /2.19/developer-guide/plugin/introduction#%E7%89%88%E6%9C%AC%E6%8E%A7%E5%88%B6
- Broken anchor on source page path = /2.20.0-SNAPSHOT/developer-guide/plugin/publish:
   -> linking to /2.20.0-SNAPSHOT/developer-guide/plugin/introduction#%E7%89%88%E6%9C%AC%E6%8E%A7%E5%88%B6
- Broken anchor on source page path = /developer-guide/plugin/publish:
   -> linking to /developer-guide/plugin/introduction#%E7%89%88%E6%9C%AC%E6%8E%A7%E5%88%B6

[PERF] Build > zh-Hans > Broken links checker - 65.01 ms
[SUCCESS] Generated static files in "build".
[PERF] Build > zh-Hans - 16.53 seconds!
[PERF] Build - 16.53 seconds!
[INFO] Use `npm run serve` command to test your build locally.

@slorber
Copy link

slorber commented Oct 17, 2024

Ah 😄 didn't see the missing clear preparation command.

So, it's 2.35 faster in the end. Could be better but already a significant improvement!

Are you building multiple locales? Because the log shows it builds in 16s for zh-Hans, I assume there are 2 locales maybe.

@ruibaby
Copy link
Member Author

ruibaby commented Oct 17, 2024

@slorber Thanks to the work of docusaurus and rspack teams, the build is much faster now. Previously, we had to delete some old versions of documents due to the build speed issue.

There is also a problem with the zoom image plugin, because it limits the version number of docusaurus. We will merge this PR when docusaurus releases 3.6.

Thanks also to @hardfist for his effort at hardfist/docusaurus-rspack#1, which made it possible to integrate rspack into docusaurus.

@ruibaby
Copy link
Member Author

ruibaby commented Oct 17, 2024

Are you building multiple locales? Because the log shows it builds in 16s for zh-Hans, I assume there are 2 locales maybe.

Currently we only have zh-Hans

@slorber
Copy link

slorber commented Oct 17, 2024

Thanks

I find it weird if you have 1 locale that hyperfine reports 30.094 and the log reports 16.53 seconds

I don't know what's the problem with image zoom but it's not a core Docusaurus plugin so we are not really responsible for it 😅

@ruibaby
Copy link
Member Author

ruibaby commented Oct 17, 2024

I don't know what's the problem with image zoom but it's not a core Docusaurus plugin so we are not really responsible for it 😅

Yeah, I know the reason. Because this community plugin sets peerDependencies in package.json, the current canary version does not meet its expectations and fails to compile.

image

https://github.com/gabrielcsapo/docusaurus-plugin-image-zoom/blob/main/package.json#L39

@slorber
Copy link

slorber commented Oct 17, 2024

I see thanks. I'll look for a solution to this canary adoption problem, not the first time it came up.

@f2c-ci-robot f2c-ci-robot bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 31, 2024
@slorber
Copy link

slorber commented Oct 31, 2024

FYI canaries start with 3.5.2 (latest version) now, so I guess it should work better with community plugins now.

@f2c-ci-robot f2c-ci-robot bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 31, 2024
Signed-off-by: Ryan Wang <[email protected]>
@f2c-ci-robot f2c-ci-robot bot added release-note-none Denotes a PR that doesn't merit a release note. and removed do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Oct 31, 2024
@ruibaby
Copy link
Member Author

ruibaby commented Oct 31, 2024

/unhold

@f2c-ci-robot f2c-ci-robot bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 31, 2024
Copy link
Member

@guqing guqing left a comment

Choose a reason for hiding this comment

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

/approve

@ruibaby
Copy link
Member Author

ruibaby commented Oct 31, 2024

FYI canaries start with 3.5.2 (latest version) now, so I guess it should work better with community plugins now.

All is well, this PR will be merged

Copy link
Member

@JohnNiang JohnNiang left a comment

Choose a reason for hiding this comment

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

/lgtm

@f2c-ci-robot f2c-ci-robot bot added the lgtm Indicates that a PR is ready to be merged. label Oct 31, 2024
@f2c-ci-robot f2c-ci-robot bot merged commit aa466d9 into halo-dev:main Oct 31, 2024
5 checks passed
Copy link

f2c-ci-robot bot commented Oct 31, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: guqing, JohnNiang

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. release-note-none Denotes a PR that doesn't merit a release note.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants