NASA-IMPACT / admg-casei

ADMG Inventory
https://impact.earthdata.nasa.gov/casei/
Apache License 2.0
1 stars 0 forks source link

Gatsby upgrade from v4 to v5 #535

Open Tammo-Feldmann opened 1 year ago

Tammo-Feldmann commented 1 year ago

What I'm changing

On this branch I'm migrating from Gatsby version 4 to version 5. There were a few requirements that needed to change to make this transition possible. Node 18 and React 18 are the most notable prerequisites and I also updated all Gatsby plugins to their latests versions. The reason to make this transition to Gatsby v5 is the new Slice API that Gatsby introduced specifically for faster build times in production. Since we have been seeing build time between 12min and 15min frequently, this could be a very useful initial step to speed up those build times.

How you can test it

This upgrade should not effect any existing features and all of our test should pass exactly the same as before. So, ideally we see no difference in the application behavior at all.

Tammo-Feldmann commented 1 year ago

I was able to update all dependencies to work with Gatsby v5. In the process I discovered today that ReachUI has not upgraded to React v18. This is, however, a requirement for Gatsby v5. At this point it looks like we have three options a) leave this PR open and hope that Reach UI will upgrade to React v18 eventually b) make the necessary upgrades ourselves c) replace reach UI components with another library.

Tammo-Feldmann commented 1 year ago

I discovered another thorny sticking point for us in trying to use the Gatsby Slice API to improve build time. The Gatsby docs explicitly state that their slice API does not support styled components and it looks like it might be a while before they do. Since we use styled components heavily in the CASEI code base, it's probably not an option for us to use the Gatsby Slice API. See docs and linked issue here.