VanOns / block-editor

A javascript-only wrapper for the WordPress block-editor
18 stars 13 forks source link

Some quick tips on updating the upstream Gutenberg packages? #2

Open JosephusPaye opened 1 year ago

JosephusPaye commented 1 year ago

Hi @mauricewijnia,

Thanks a lot for your work on this project! I've recently started integrating the block editor into a project of mine and your work here was a great help.

Could you please share (some quick dot points will do) how you go about updating the Gutenberg packages, and what to look out for when doing this?

More details The script https://github.com/VanOns/block-editor/blob/main/versions.sh that extracts the version numbers of the packages for a local Gutenberg clone is very useful. I was able to run that after making a slight change (see below), and installed the versions extracted.
versions.sh change Changed the `\d` character class to `[0-9]` due to https://stackoverflow.com/a/3185498 ```diff - VERSION=$(cat $FILE | egrep -o '"version": (".*")' | egrep -o '\d+\.\d+\.\d+') + VERSION=$(cat $FILE | egrep -o '"version": (".*")' | egrep -o '[0-9]+\.[0-9]+\.[0-9]+') ```
I then built the library and fixed a few issues like replacing [`ReactDOM.render()` with `createRoot()`](https://react.dev/blog/2022/03/08/react-18-upgrade-guide#updates-to-client-rendering-apis). Then I ran into other runtime issues that I'm now working my way through, like the one below that occurs whenever a dropdown menu is opened in the editor: it crashes the editor and shows a blank screen:
View error ![image](https://github.com/VanOns/block-editor/assets/5924865/bb94cc81-3770-4a12-af55-fd17402083eb)

Thanks!

LittleGit1 commented 1 year ago

This would also be very beneficial to me.