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

fix: Update docusaurus to 2.4.1; fix swizzled React components #2865

Merged
merged 16 commits into from
May 23, 2023

Conversation

traeok
Copy link
Member

@traeok traeok commented May 5, 2023

Your checklist for this pull request

🚨Please review the guidelines for contributing to this repository.

  • If the changes in this PR is part of the next future release, make this pull request against the docs-staging branch which will be published at the next release boundary. If the changes in this PR are part of the current release, use the default base branch, master. For more information about branches, see https://github.com/zowe/docs-site/tree/master#understanding-the-doc-branches.

  • If this PR relates to GitHub issues in docs-site or other repositories, please list in Description, prefixed with close, fix or resolve keywords.

Description (including links to related git issues)

This PR updates Docusaurus to the latest version (2.4.1). In addition, it resolves any broken React components as a result of updating from 2.0.0-beta.3. I've also made a couple adjustments to those components so that they do not break as a result of missing data. I built a list of breaking changes that I ran into from 2.0.0-beta.3 to 2.4.1:

  • versionMetadata has moved
    • 2.0.0-beta.3: Prop in DocItem component
    • 2.4.1: result of useDocsVersion in @docusaurus/theme-common/internal
  • themeConfig
    • hideableSidebar: true
      • 2.0.0-beta.3: available option in themeConfig
      • 2.4.1: moved to themeConfig {} -> docs {} -> sidebar {} -> hideable
    • googleAnalytics
      • 2.0.0-beta.3: available option in themeConfig
      • 2.4.1: moved to @docusaurus/preset-classic config
  • useAlgoliaContextualFacetFilters import has changed
    • 2.0.0-beta.3: Default export at @theme/hooks/useAlgoliaContextualFacetFilters
    • 2.4.1: Named export at @docusaurus/theme-search-algolia/client
  • useVersions, useLatestVersion, useActiveDocContext import has moved
    • 2.0.0-beta.3: @theme/hooks/useDocs
    • 2.4.1: @docusaurus/plugin-content-docs/client
  • InitialMDXComponents import has moved
    • 2.0.0-beta.3: @theme-init/MDXComponents
    • 2.4.1: @theme/MDXComponents
  • useActiveVersion import has moved
    • 2.0.0-beta.3: @theme/hooks/useDocs
    • 2.4.1: @docusaurus/plugin-content-docs/client
  • useTitleFormatter import has moved
    • 2.0.0-beta.3: @docusaurus/theme-common
    • 2.4.1: @docusaurus/theme-common/internal
  • useActivePlugin import has moved
    • 2.0.0-beta.3: @theme/hooks/useDocs
    • 2.4.1: @docusaurus/plugin-content-docs/client
  • useDocVersionSuggestions import has moved
    • 2.0.0-beta.3: @theme/hooks/useDocs
    • 2.4.1: @docusaurus/plugin-content-docs/client
  • useTOCHighlight import has moved
    • 2.0.0-beta.3: @theme/hooks/useTOCHighlight
    • 2.4.1: @docusaurus/theme-common/internal
    • Note: This is now an internal function, probably shouldn't be used
  • colorMode.switchConfig is deprecated
    - Note from docusaurus PR 6771: If you want to customize the icons for light and dark mode, swizzle IconLightMode, IconDarkMode, or ColorModeToggle instead

❤️Thank you!

@netlify
Copy link

netlify bot commented May 5, 2023

Deploy Preview for zowe-docs-master failed.

Name Link
🔨 Latest commit af336f3
🔍 Latest deploy log https://app.netlify.com/sites/zowe-docs-master/deploys/645e5aaa469e8800084f6883

@traeok traeok changed the title chore: Update docusaurus to 2.4.0; fix swizzled React components chore: Update docusaurus to 2.4.0; fix swizzled React components May 5, 2023
@traeok traeok force-pushed the fix/update-docusaurus-fc branch from 0c8118b to f1dc7b8 Compare May 5, 2023 17:40
@traeok
Copy link
Member Author

traeok commented May 5, 2023

The Netlify builds are still failing from time to time. This is likely due to RAM limitations as the free runner has up to 11GB, and all 11GB is not guaranteed to be free. The site peaks around 8GB during asset processing and without disabling minification, it is difficult to avoid this much RAM usage especially when using Docusaurus v2. More info here: facebook/docusaurus#4765

Node.js has the v8 argument --max-old-space-size which defaults to 1400MB on 64-bit systems. If we set the value too high (e.g. 9216) the process will be killed by the system if it reaches that value. If the value is too low, Node.js garbage collection can fail and the process will end as a result.

The best option to reduce RAM usage here is to find the optimal value for --max-old-space-size. In addition, since minification should only affect initial loading for some users, I've added back the --no-minify arg in hopes that it will reduce the RAM footprint enough for Netlify to build successfully.

Update (5/8/23): I've removed --no-minify from the build arguments as it does not impact the RAM footprint enough to keep the Netlify runner from crashing.

@github-actions
Copy link

github-actions bot commented May 9, 2023

@github-actions github-actions bot temporarily deployed to pull request May 9, 2023 20:53 Inactive
@github-actions github-actions bot temporarily deployed to pull request May 9, 2023 21:20 Inactive
@github-actions github-actions bot temporarily deployed to pull request May 9, 2023 22:56 Inactive
@github-actions github-actions bot temporarily deployed to pull request May 9, 2023 23:23 Inactive
@github-actions github-actions bot temporarily deployed to pull request May 9, 2023 23:46 Inactive
@github-actions github-actions bot temporarily deployed to pull request May 10, 2023 05:16 Inactive
@github-actions github-actions bot temporarily deployed to pull request May 10, 2023 05:37 Inactive
@github-actions github-actions bot temporarily deployed to pull request May 10, 2023 12:25 Inactive
@github-actions github-actions bot temporarily deployed to pull request May 10, 2023 13:34 Inactive
@github-actions github-actions bot temporarily deployed to pull request May 10, 2023 14:04 Inactive
traeok and others added 2 commits May 10, 2023 10:12
@traeok
Copy link
Member Author

traeok commented May 10, 2023

Going to table this for now, as although the builds now succeed, there are a couple discrepancies with the layout that was introduced as a part of updating to Docusaurus 2.4.0. Hopefully I should be able to address those soon, but for now #2868 will resolve the random build failures - thanks @t1m0thyj !

This reverts commit 1009b66.

Signed-off-by: Trae Yelovich <[email protected]>
@t1m0thyj t1m0thyj marked this pull request as draft May 15, 2023 20:55
@traeok
Copy link
Member Author

traeok commented May 19, 2023

Pushing up commit shortly with following fixes:

  • Update to Docusaurus 2.4.1
  • Fixed all bugs from updating to 2.4.1 w/ React components
  • Fixed formatting for share buttons at top of documents
  • Remove TOC component as it is forbidden to swizzle, according to Docusaurus
    • Replaced with wrapper around TOCItem, which should be easier to maintain moving forward
  • Updated DocItem component so that it uses the new DocProvider recommended by Docusaurus
  • Added dynamic TPSR link, so that TPSR links redirect to the version the user is browsing
  • Fixed "Release Notes" link for latest version as it is currently hardcoded to v1.23 release notes
    • To reproduce on main branch: Click on version dropdown -> All versions -> click on "Release Notes" for the latest version
  • Fixed alignment issues with Yes/No feedback buttons
  • Fixed issue where markdown components had a circular include
  • Fixed some CSS rules for better formatting

@traeok traeok changed the title chore: Update docusaurus to 2.4.0; fix swizzled React components chore: Update docusaurus to 2.4.1; fix swizzled React components May 19, 2023
see PR #2865 for more info

Signed-off-by: Trae Yelovich <[email protected]>
@traeok traeok changed the title chore: Update docusaurus to 2.4.1; fix swizzled React components fix: Update docusaurus to 2.4.1; fix swizzled React components May 19, 2023
@traeok traeok marked this pull request as ready for review May 19, 2023 21:24
@github-actions github-actions bot temporarily deployed to pull request May 19, 2023 22:41 Inactive
@traeok traeok requested review from t1m0thyj and anaxceron May 23, 2023 14:20
@github-actions github-actions bot temporarily deployed to pull request May 23, 2023 14:44 Inactive
Copy link
Collaborator

@anaxceron anaxceron left a comment

Choose a reason for hiding this comment

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

Thanks for doing this -- looks great!

@anaxceron anaxceron merged commit 99e3ff9 into master May 23, 2023
@anaxceron anaxceron deleted the fix/update-docusaurus-fc branch May 23, 2023 14:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants