geeksblabla / geeksblabla.com

GeeksBlala website source code
https://geeksblabla.io
MIT License
279 stars 130 forks source link

Migrate Project to latest Gatsby release #334

Open yjose opened 2 years ago

yjose commented 2 years ago

Right now the project is using Gatsby v2 and we want to upgrade it to latest version

azihassan commented 2 years ago

Interested in this. Do you have an anti regression strategy ?

yjose commented 2 years ago

Unfortunately no. will make sure to test the new implementation manually when every you have the chance to open a new PR Good luck and let me know if you need my help on something

azihassan commented 2 years ago

Thanks, I'll look into it. But just a heads up :

I tried to upgrade just now, and it looks like some packages need to be upgraded too.

For example, node-sass 4.13.0 didn't support node v16. Following this, I downgraded my node install to v13 (nvm is a lifesaver here). But then I ran into

error babel-jest@27.4.5: The engine "node" is incompatible with this module. Expected version "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0". Got "13.3.0"

I downgraded it further to v12 and got :

error babel-preset-gatsby@2.4.0: The engine "node" is incompatible with this module. Expected version ">=14.15.0". Got "12.22.12"

So it looks like breaking changes might be inevitable.

yjose commented 2 years ago

Yeah please try to updates all deps to latest versions

azihassan commented 2 years ago

I briefly tested the deployed version and it looks OK

Just to be safe, I recommend that we try to deploy an episode using the upgraded code

azihassan commented 2 years ago

Quick update : still working on this. The gatsby-plugin-mdx 4.0.0 upgrade brought a bunch of breaking changes that I'm still trying to wrap my head around. The main problem I have is that it doesn't recognize frontmatter :

 ERROR #85901  GRAPHQL

There was an error in your GraphQL query:

Field "frontmatter" is not defined by type "MdxFilterInput".

File: gatsby-node.js:73:24

  GraphQLError: Field "frontmatter" is not defined by type "MdxFilterInput".

Right now gatsby-plugin-mdx is still in RC, but I remember reading that a stable version will be released this week. I'll look into it again once the stable version is out.

azihassan commented 2 years ago

Update : I tested the stable version a few days ago. The frontmatter error disappeared, but it doesn't recognize certain fields :

image

Commenting out the unrecognised fields causes the query to display the correct results.

Right now I'm still looking into why it fails for some fields and not others.