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

Docusaurus v3 upgrade #128

Merged
merged 16 commits into from
Feb 21, 2024
Merged

Docusaurus v3 upgrade #128

merged 16 commits into from
Feb 21, 2024

Conversation

lindboe
Copy link
Contributor

@lindboe lindboe commented Feb 15, 2024

Upgrades to Docusaurus v3, following these instructions: https://docusaurus.io/docs/migration/v3

This includes the following changes:

  1. Updating to MDX v3
  2. Updating to React 18, where I had to make a change to useIntersection for strict mode
  3. More official Typescript support from Docusaurus. Because of this, I made a few optional updates for better TS support
    a. Docusaurus config file is now TS
    b. The one component we swizzled (DocItem/Footer) is now based on the official TS version
    c. I added a few TS compiler options to more strictly check code and help prevent future bugs
  4. Upgrading prism, the code block renderer, which means we needed to explicitly add more languages we want to support.
    a. While doing this, I noticed we were referencing some languages prism doesn't actually support, so updated those to supported ones.

This upgrade should make it easier to make future improvements to Docusaurus components like search.

@morganick morganick self-requested a review February 16, 2024 19:33
@morganick morganick added the chore dependency upgrades label Feb 16, 2024
Copy link
Contributor

@morganick morganick left a comment

Choose a reason for hiding this comment

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

One change for this PR. Otherwise LGTM 👍 and works as expected.

Side note: Can we change the typecheck script to call tsc --noEmit? Also, there are four type errors when I run it.

src/theme/DocItem/Footer/index.tsx Show resolved Hide resolved
Copy link
Contributor

@Jpoliachik Jpoliachik left a comment

Choose a reason for hiding this comment

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

A couple of minor errors when I run yarn typecheck but looks good otherwise!

Tested locally and everything worked as expected. good stuff! 🚀

@lindboe
Copy link
Contributor Author

lindboe commented Feb 16, 2024

A couple of minor errors when I run yarn typecheck but looks good otherwise!

Interesting, that wasn't showing up yesterday when I ran it but it's happening on a fresh checkout 🤔 fixing...

@lindboe
Copy link
Contributor Author

lindboe commented Feb 16, 2024

Alright this should be good to go.

As a follow-on I went through the dependabot alerts and made a PR to try to address the few that weren't resolved by this upgrade: #130

Copy link
Contributor

@morganick morganick left a comment

Choose a reason for hiding this comment

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

Any reason we don't use tsc --noEmit for the typecheck command?

Otherwise, LGTM 👍

@lindboe
Copy link
Contributor Author

lindboe commented Feb 21, 2024

@morganick Oh yeah, --noEmit sounds fine to me, I'll add that. I think the typecheck command is just what docusaurus set by defualt.

@lindboe lindboe merged commit 7a5f2ed into main Feb 21, 2024
1 check passed
@lindboe lindboe deleted the docusaurus-upgrade branch February 21, 2024 22:20
cdanwards pushed a commit that referenced this pull request Feb 28, 2024
* Update for docusaurus v3 versions

* Fix non-terminating image, I think this is the intended one

* Fixing prism post-upgrade

- Requires more languages to be listed, not automatically included now
  - Markup-templating required by ejs, must specify explicitly or build
    breaks
- Update some language references in code blocks that aren't actually
  supported by prism

* Fix observer crash when navigating from homepage

* Update last plugin and clsx

* Actual fix for useIntersection

* Force a single resolution of react types

Multiple type versions lead to type errors like this one
https://github.com/software-mansion/react-native-svg/issues/1741\#issuecomment-1093812197

* Leave comment that gtag is not meant to work in dev

* Convert config to real typescript

* Re-swizzle DocItem/Footer as TS and add more fixes

* Type fixes and disallow unchecked indexed access

* Fix snippet typing issue with home page top bar

* Add a note about swizzling

* Don't emit on typecheck
cdanwards pushed a commit that referenced this pull request Feb 28, 2024
* Update for docusaurus v3 versions

* Fix non-terminating image, I think this is the intended one

* Fixing prism post-upgrade

- Requires more languages to be listed, not automatically included now
  - Markup-templating required by ejs, must specify explicitly or build
    breaks
- Update some language references in code blocks that aren't actually
  supported by prism

* Fix observer crash when navigating from homepage

* Update last plugin and clsx

* Actual fix for useIntersection

* Force a single resolution of react types

Multiple type versions lead to type errors like this one
https://github.com/software-mansion/react-native-svg/issues/1741\#issuecomment-1093812197

* Leave comment that gtag is not meant to work in dev

* Convert config to real typescript

* Re-swizzle DocItem/Footer as TS and add more fixes

* Type fixes and disallow unchecked indexed access

* Fix snippet typing issue with home page top bar

* Add a note about swizzling

* Don't emit on typecheck
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore dependency upgrades
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants