Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update node to version 20 #340

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft

Update node to version 20 #340

wants to merge 3 commits into from

Conversation

fluiddot
Copy link

@fluiddot fluiddot commented Dec 21, 2023

This PR is a follow-up on the Gutenberg PR WordPress/gutenberg#56331 to update Node to the same version used in Gutenberg.

More information can be found in:
https://make.wordpress.org/core/2023/12/20/updating-wordpress-to-use-more-modern-versions-of-node-js-npm-2/

The dependencies update has been performed by running the following commands:

  1. nvm use 16
  2. yarn upgrade @wordpress/scripts --latest
  3. nvm use 20
  4. yarn upgrade

This update is driven due to the fact that the peer dependency `eslint-plugin-jsdoc` needs to be updated to support node 20.
@fluiddot fluiddot added the dependencies Pull requests that update a dependency file label Dec 21, 2023
@fluiddot fluiddot self-assigned this Dec 21, 2023
"@wordpress/scripts": "^19.2.3",
"@wordpress/scripts": "^26.19.0",
Copy link
Author

@fluiddot fluiddot Dec 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's unclear the potential side-effects of updating this package. The fact that this repository doesn't have CI checks gives low confidence in introducing changes. In any case, I presume that this package is mainly used for the development workflow, so probably won't introduce regressions.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Each plugin is manually released separately, so there at least wouldn't be any immediate problems if one of them no longer builds properly.

I ran yarn everything to build all the plugins, and didn't see any issues that didn't exist before this change.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, thank you very much @ajlende for the information and for checking that all plugins can be built 🙇 .

@fluiddot fluiddot marked this pull request as ready for review December 21, 2023 11:01
@fluiddot fluiddot requested a review from geriux December 21, 2023 14:01
Copy link
Contributor

@ajlende ajlende left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The blocks that I maintain here look fine: Bauhaus Centenary, Event, Model Viewer, Starscape, and Waves.

It looks like the waves and book blocks are a bit broken, but it's probably because they're using old __experimental APIs in Gutenberg which have been deprecated and removed, not because of the changes in this PR.

I also had to make sure that I ran a manual yarn clean before yarn start for development because there were some extra files floating around causing errors.

It's probably worthwhile having someone more familiar with the layout grid test that one out since it's more widely used. But I'll give it one check of approval for the things that I maintain.

"@wordpress/scripts": "^19.2.3",
"@wordpress/scripts": "^26.19.0",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Each plugin is manually released separately, so there at least wouldn't be any immediate problems if one of them no longer builds properly.

I ran yarn everything to build all the plugins, and didn't see any issues that didn't exist before this change.

@fluiddot
Copy link
Author

The blocks that I maintain here look fine: Bauhaus Centenary, Event, Model Viewer, Starscape, and Waves.
It looks like the waves and book blocks are a bit broken, but it's probably because they're using old __experimental APIs in Gutenberg which have been deprecated and removed, not because of the changes in this PR.

Thanks @ajlende for testing some of the blocks. Following #340 (comment), since each plugin is released individually, in potential next releases we'd need to test if any regressions have been introduced.

I also had to make sure that I ran a manual yarn clean before yarn start for development because there were some extra files floating around causing errors.

Ah, interesting. I didn't experience this but I presume that changing the node version or dependency updates might be related.

It's probably worthwhile having someone more familiar with the layout grid test that one out since it's more widely used. But I'll give it one check of approval for the things that I maintain.

Ok, thanks 🙇 ! I'll share a list with the remaining blocks to check and reference the last contributors who worked on them.

Copy link
Author

@fluiddot fluiddot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As shared in #340 (comment), seems that all blocks can be built. However, I noticed that all unit tests are failing. Some of them don't pass either in master but before merging this PR, we should at least fix the unit tests that were succeeding before this change.

The error I encountered is the following:

The error below may be caused by using the wrong test environment, see https://jestjs.io/docs/configuration#testenvironment-string.
    Consider using the "jsdom" test environment.

    ReferenceError: window is not defined

      at Object.<anonymous> (node_modules/@wordpress/jest-preset-default/scripts/setup-globals.js:2:14)

@fluiddot
Copy link
Author

fluiddot commented Jan 11, 2024

Following #340 (review), I tried to address the issue when running tests but seems more complex than I originally thought. In the newer version of @wordpress/scripts, the Jest version is updated and leads to several errors that might imply updating the Jest configuration and possibly some of the WordPress packages. I tried to force the resolution of eslint-plugin-jsdoc (the package that fails when installing dependencies with node 20) to a newer version, but still Jest fails with the following error:

Jest encountered an unexpected token

    This usually means that you are trying to import a file which Jest cannot parse, e.g. it's not plain JavaScript.

    By default, if Jest sees a Babel config, it will use that to transform your files, ignoring "node_modules".

    Here's what you can do:
     • If you are trying to use ECMAScript Modules, see https://jestjs.io/docs/en/ecmascript-modules for how to enable it.
     • To have some of your "node_modules" files transformed, you can specify a custom "transformIgnorePatterns" in your config.
     • If you need a custom transformation specify a "transform" option in your config.
     • If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the "moduleNameMapper" config option.

    You'll find more details and examples of these config options in the docs:
    https://jestjs.io/docs/en/configuration.html

    Details:

    <root-path>/block-experiments/node_modules/@wordpress/i18n/node_modules/memize/dist/index.js:160
    export { memize as default };
    ^^^^^^

    SyntaxError: Unexpected token 'export'

      at Runtime.createScriptFromCode (node_modules/jest-runtime/build/index.js:1350:14)
      at Object.<anonymous> (node_modules/@wordpress/i18n/build/@wordpress/i18n/src/sprintf.js:4:1)
      at Object.<anonymous> (node_modules/@wordpress/i18n/build/@wordpress/i18n/src/index.js:1:1)
      at Object.<anonymous> (node_modules/@wordpress/keycodes/build/@wordpress/keycodes/src/index.js:15:1)
      at Object.<anonymous> (node_modules/@wordpress/compose/build/hooks/use-constrained-tabbing/@wordpress/compose/src/hooks/use-constrained-tabbing/index.js:4:1)
      at Object.<anonymous> (node_modules/@wordpress/compose/build/@wordpress/compose/src/index.js:21:1)
      at Object.<anonymous> (node_modules/@wordpress/data/build/redux-store/@wordpress/data/src/redux-store/index.js:13:1)
      at Object.<anonymous> (node_modules/@wordpress/data/build/@wordpress/data/src/registry.js:14:1)
      at Object.<anonymous> (node_modules/@wordpress/data/build/@wordpress/data/src/default-registry.js:4:1)
      at Object.<anonymous> (node_modules/@wordpress/data/build/@wordpress/data/src/index.js:9:1)

Until this gets resolved, I think we should pause this PR so I'm going to revert it to draft. As a follow-up, I'll open an issue with this information (#342).

@fluiddot fluiddot marked this pull request as draft January 11, 2024 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants