TheOdinProject / theodinproject

Main Website for The Odin Project
http://www.theodinproject.com
MIT License
3.67k stars 2.07k forks source link

Chore: Update Mermaid to version 10 #3716

Closed JoshDevHub closed 1 month ago

JoshDevHub commented 1 year ago

We recently added support for mermaid diagramming to site. See here for the PR: https://github.com/TheOdinProject/theodinproject/pull/3708

With the latest version of mermaid installed (version 10.0.2), the CircleCI tests fail. This is caused by a webpack compilation issue that emerges from some incompatibility between TOP's webpacker config and mermaid's exports, which are ESM only in v10+.

With the latest version of mermaid installed, you can recreate the errors that happen in CI locally by running NODE_ENV=test RAILS_ENV=test rails webpacker:compile.

The three things that need to happen to resolve this issue:

  1. Run yarn install mermaid to install the latest version of mermaid.
  2. This line in the lesson preview component needs to become await mermaid.run(). This is due to changes in the mermaid API in v10.
  3. Make sure that NODE_ENV=test RAILS_ENV=test rails webpacker:compile runs without errors. This should guarantee that it will pass CI. This likely involves some small change to the webpacker config to properly grab mermaid's exports. Reading through this conversation in the mermaid PR should help with getting the full context for this problem.
KevinMulhern commented 1 year ago

Reopening: https://github.com/TheOdinProject/theodinproject/pull/3721