lexical icon indicating copy to clipboard operation
lexical copied to clipboard

Feature: [lexical-website] Upgrade docusaurus-plugin-typedoc and typedoc-plugin-markdown

Open etrepum opened this issue 1 year ago • 6 comments
trafficstars

It seems that a lot of improvements have happened to docusaurus-plugin-typedoc, seems to fix some issues that I've noticed with how the docs are generated and organized, but it's a backwards incompatible change.

We should:

  • Upgrade these packages
  • Update the configuration accordingly (sidebars in particular, but we may also be able to get rid of some of our other plugins that exist just to work around previous bugs)
  • Update all of the static links to the documentation in the monorepo (the URL structure changes, but we also only have these references in the README files so it's not a big task)
  • Consider adding redirect routes in lexical-website so that old links redirect to their new location rather than 404

etrepum avatar May 09 '24 23:05 etrepum

Hi @etrepum! Can I be assigned to work on this problem?

TropicolX avatar May 20 '24 06:05 TropicolX

Hello, @etrepum I will work on this

inhwaS avatar Oct 18 '24 18:10 inhwaS

Hello @etrepum , I’ve updated all relevant code changes according to the changelog, but I’m encountering a module error.

Here’s the error message I received:

[ERROR] Error: Unable to build website for locale en.
    at tryToBuildLocale (/Users/inhwa.son/lexical/node_modules/@docusaurus/core/lib/commands/build.js:54:19)
    at async /Users/inhwa.son/lexical/node_modules/@docusaurus/core/lib/commands/build.js:65:9
    at async mapAsyncSequential (/Users/inhwa.son/lexical/node_modules/@docusaurus/utils/lib/jsUtils.js:21:24)
    at async Command.build (/Users/inhwa.son/lexical/node_modules/@docusaurus/core/lib/commands/build.js:63:5) {
  [cause]: TypeError: Cannot read properties of undefined (reading 'addTranslations')
      at _classThis.<anonymous> (/Users/inhwa.son/lexical/node_modules/typedoc-plugin-markdown/dist/index.js:94:34)
      at triggerEvents (/Users/inhwa.son/lexical/node_modules/typedoc/dist/lib/utils/events.js:192:43)
      at triggerApi (/Users/inhwa.son/lexical/node_modules/typedoc/dist/lib/utils/events.js:168:13)
      at eventsApi (/Users/inhwa.son/lexical/node_modules/typedoc/dist/lib/utils/events.js:61:18)
      at _classThis.trigger (/Users/inhwa.son/lexical/node_modules/typedoc/dist/lib/utils/events.js:390:13)
      at _classThis.convert (/Users/inhwa.son/lexical/node_modules/typedoc/dist/lib/converter/converter.js:210:18)
      at _classThis.convert (/Users/inhwa.son/lexical/node_modules/typedoc/dist/lib/application.js:296:44)
      at generateTypedoc (/Users/inhwa.son/lexical/node_modules/docusaurus-plugin-typedoc/dist/plugin.js:99:31)
      at async Object.pluginDocusaurus [as plugin] (/Users/inhwa.son/lexical/node_modules/docusaurus-plugin-typedoc/dist/plugin.js:40:9)
      at async initializePlugin (/Users/inhwa.son/lexical/node_modules/@docusaurus/core/lib/server/plugins/init.js:91:32)
}

You can check my commit from here. Can I ask how to fix these kind of module level errors? From codebase, I cannot find any usage of addTranslations

inhwaS avatar Oct 24 '24 21:10 inhwaS

Sorry, I am not familiar with all of the changes that have occurred in these packages and their dependencies. It looks like it expects typedoc to have this method https://github.com/typedoc2md/typedoc-plugin-markdown/blob/main/packages/typedoc-plugin-markdown/src/index.ts#L91

etrepum avatar Oct 24 '24 21:10 etrepum

Hello, @etrepum I would like to ask you about ./packages/lexical-website/docs/api/ folder. As you can see from the changelog, they say Screenshot 2024-10-25 at 10 48 22 Therefore, I am trying to change: https://github.com/facebook/lexical/blob/e96ee55b749c0fed8ac03d49044dd5594f0bc32e/packages/lexical-website/sidebars.js#L25

However, it seems that in the folder ./packages/lexical-website/docs/api/, all markdown files are generated during the build process. To manually include all relevant files, where should I refer? I don't believe it’s efficient to list all the file names here: Screenshot 2024-10-25 at 10 49 08 Is there a folder or file that manages the creation of all markdown files?

inhwaS avatar Oct 25 '24 17:10 inhwaS

I believe those files are generated by typedoc and the associated plugins. I agree that listing the files is probably not the best way to make the sidebar, but again I am not familiar with how these packages have changed so I really don't know much more about how to solve this

etrepum avatar Oct 25 '24 18:10 etrepum