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 npm dependencies (especially @wordpress) #7695

Draft
wants to merge 23 commits into
base: trunk
Choose a base branch
from

Conversation

renatho
Copy link
Contributor

@renatho renatho commented Oct 29, 2024

Resolves #7692 #6123

Proposed Changes

Testing Instructions

New/Updated Hooks

Deprecated Code

Pre-Merge Checklist

  • PR title and description contain sufficient detail and accurately describe the changes
  • Acceptance criteria is met
  • Decisions are publicly documented
  • Adheres to coding standards (PHP, JavaScript, CSS, HTML)
  • All strings are translatable (without concatenation, handles plurals)
  • Follows our naming conventions (P6rkRX-4oA-p2)
  • Hooks (p6rkRX-1uS-p2) and functions are documented
  • New UIs are responsive and use a mobile-first approach
  • New UIs match the designs
  • Different user privileges (admin, teacher, subscriber) are tested as appropriate
  • Legacy courses (course without blocks) are tested
  • Code is tested on the minimum supported PHP and WordPress versions
  • User interface changes have been tested on the latest versions of Chrome, Firefox and Safari
  • "Needs Documentation" label is added if this change requires updates to documentation
  • Known issues are created as new GitHub issues

@renatho renatho self-assigned this Oct 29, 2024
@renatho renatho force-pushed the update/wordpress-dependencies branch from 427e4f8 to 41fe999 Compare October 29, 2024 21:15
@renatho renatho force-pushed the update/wordpress-dependencies branch from 41fe999 to 710033b Compare October 29, 2024 21:16
@Automattic Automattic deleted a comment from github-actions bot Oct 29, 2024
@Automattic Automattic deleted a comment from github-actions bot Oct 29, 2024
Copy link

Test the previous changes of this PR with WordPress Playground.

Copy link

Test the previous changes of this PR with WordPress Playground.

Copy link

Test the previous changes of this PR with WordPress Playground.

Copy link

Test the previous changes of this PR with WordPress Playground.

Copy link

github-actions bot commented Oct 30, 2024

WordPress Dependencies Report

The github-action-wordpress-dependencies-report action has detected some script changes between the commit 8ab8e3e and trunk. Please review and confirm the following are correct before merging.

Script Handle Added Dependencies Removed Dependencies Total Size Size Diff
js/admin/course-edit.js 10.2 kB +360 B ( +3.65% 🔼 )
js/admin/course-index.js 697 B -54 B ( -7.2% ⬇️ )
js/admin/event-logging.js 662 B +13 B ( +2.01% 🔼 )
js/admin/lesson-bulk-edit.js 700 B +14 B ( +2.05% 🔼 )
js/admin/lesson-quick-edit.js 727 B +14 B ( +1.97% 🔼 )
js/admin/message-menu-fix.js 190 B +19 B ( +11.12% 🔼 )
js/admin/meta-box-quiz-editor.js 6.58 kB -49 B ( -0.74% ⬇️ )
js/admin/lesson-edit.js 2.46 kB -113 B ( -4.4% ⬇️ )
js/admin/lesson-ai.js 2.28 kB +387 B ( +20.46% 🔼 )
js/admin/ordering.js 359 B +15 B ( +4.37% 🔼 )
js/admin/sensei-notice-dismiss.js 1.11 kB -56 B ( -4.81% ⬇️ )
js/admin/custom-navigation.js 282 B +15 B ( +5.62% 🔼 )
js/admin/reports.js 747 B -87 B ( -10.44% ⬇️ )
js/frontend/course-archive.js 171 B +15 B ( +9.62% 🔼 )
js/frontend/course-video/video-blocks-extension.js 5.55 kB -124 B ( -2.19% ⬇️ )
js/file-upload-question-type.js 794 B -72 B ( -8.32% ⬇️ )
js/grading-general.js 2.65 kB -58 B ( -2.15% ⬇️ )
js/image-selectors.js 227 B +20 B ( +9.67% 🔼 )
js/learners-bulk-actions.js 1.37 kB +157 B ( +12.92% 🔼 )
js/learners-general.js 2.09 kB +14 B ( +0.68% 🔼 )
js/modules-admin.js 2.03 kB -5 B ( -0.25% ⬇️ )
js/ranges.js 442 B +15 B ( +3.52% 🔼 )
js/settings.js 1.2 kB +14 B ( +1.19% 🔼 )
js/admin/settings/experimental-features.js 306 B +17 B ( +5.89% 🔼 )
js/user-dashboard.js 192 B +15 B ( +8.48% 🔼 )
js/question-answer-tinymce-editor.js 829 B -51 B ( -5.8% ⬇️ )
setup-wizard/index.js 17 kB +408 B ( +2.47% 🔼 )
home/index.js 21.8 kB +552 B ( +2.6% 🔼 )
data-port/import.js 14.8 kB +322 B ( +2.23% 🔼 )
data-port/export.js react 5.86 kB +399 B ( +7.32% 🔼 )
blocks/single-page.js 16.3 kB +389 B ( +2.45% 🔼 )
blocks/single-course.js 30.4 kB +111 B ( +0.37% 🔼 )
blocks/single-lesson.js 7.68 kB +286 B ( +3.87% 🔼 )
blocks/lesson-action-blocks.js 13.9 kB +249 B ( +1.84% 🔼 )
blocks/global-blocks.js 21.1 kB -69 B ( -0.33% ⬇️ )
blocks/quiz/index.js 35 kB +198 B ( +0.57% 🔼 )
blocks/quiz/ordering-promo/index.js react wp-element 1.45 kB +383 B ( +35.8% 🔼 )
blocks/shared.js 13.9 kB +31 B ( +0.23% 🔼 )
blocks/frontend.js 2.03 kB -116 B ( -5.41% ⬇️ )
blocks/core-pattern-polyfill/core-pattern-polyfill.js 5.11 kB +384 B ( +8.13% 🔼 )
blocks/email-editor.js 1 kB -41 B ( -3.92% ⬇️ )
admin/course-pre-publish-panel/index.js wp-element 4.4 kB +381 B ( +9.48% 🔼 )
admin/editor-wizard/index.js 13 kB +254 B ( +2% 🔼 )
admin/tour/course-tour/index.js 37.7 kB -1.52 kB ( -3.88% ⬇️ )
admin/tour/lesson-tour/index.js 35 kB -1.32 kB ( -3.64% ⬇️ )
admin/exit-survey/index.js react 2.9 kB +207 B ( +7.7% 🔼 )
admin/students/student-action-menu/index.js 5.22 kB +291 B ( +5.91% 🔼 )
admin/students/student-bulk-action-button/index.js 5.41 kB +380 B ( +7.57% 🔼 )
course-theme/learning-mode.js 6.19 kB +34 B ( +0.56% 🔼 )
course-theme/course-theme.editor.js 1.65 kB -78 B ( -4.51% ⬇️ )
course-theme/blocks/index.js 13.6 kB +380 B ( +2.89% 🔼 )
course-theme/learning-mode-templates/index.js react 3.52 kB +367 B ( +11.66% 🔼 )

This comment was automatically generated by the github-action-wordpress-dependencies-report action.

Copy link

Test the previous changes of this PR with WordPress Playground.

Copy link

Test the previous changes of this PR with WordPress Playground.

Copy link

Test the previous changes of this PR with WordPress Playground.

@renatho renatho force-pushed the update/wordpress-dependencies branch from 3e6bfe9 to 6ca3cf5 Compare October 31, 2024 13:45
Copy link

Test the previous changes of this PR with WordPress Playground.

Copy link

Test the previous changes of this PR with WordPress Playground.

@@ -119,6 +118,8 @@
"react": "17.0.2",
"react-dom": "17.0.2",
"resolve-url-loader": "5.0.0",
"sass": "1.35.2",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The @wordpress/scripts installs other minor versions (it uses the ^), and sass introduced a lot of deprecations because its API is changing.

I checked that Gutenberg codebase is still using it in the old way, so I also kept it using the same approach by installing the specific version.

Copy link
Contributor Author

@renatho renatho Oct 31, 2024

Choose a reason for hiding this comment

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

Before checking how Gutenberg was doing it, I tried to fix the deprecations but it's risky to break something and it's a big amount of work. So it's better to wait for Gutenberg decisions before changing it in Sensei. Notice that we also import scss files directly from Gutenberg and Calypso (which use the deprecated @import).

@@ -63,7 +63,7 @@ const NoticeActions = ( { actions } ) => {
return (
<div className="sensei-notice__actions">
{ actions.map( ( action ) => (
<NoticeAction key={ action.url } action={ action } />
<NoticeAction key={ action.label } action={ action } />
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Make sure the key will be always available since url is not always available.

issuer: styleSheetFiles,
type: 'asset/resource',
Copy link
Contributor Author

Choose a reason for hiding this comment

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

By default @wordpress/scripts is adding it as type: 'asset/inline', for style files.

Copy link
Member

@m1r0 m1r0 Nov 7, 2024

Choose a reason for hiding this comment

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

@renatho could you help me out with this? I've managed to break it when updating the packages and can't figure out why the inline SVGs are causing this error:

ERROR in ../node_modules/@automattic/data-stores/node_modules/@automattic/calypso-products/node_modules/@automattic/components/src/icons/protect.tsx 4:1
Module parse failed: Unexpected token (4:1)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
|
| const icon = (
> 	<SVG width="16" height="20" viewBox="0 0 16 20" fill="none" xmlns="http://www.w3.org/2000/svg">
...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @m1r0! I'll take a look and see if I can find the cause on Monday. 😉

Copy link
Member

Choose a reason for hiding this comment

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

I've managed to solve the above by updating @automattic/components and @automattic/tour-kit (related PRs Automattic/wp-calypso#90267 woocommerce/woocommerce#47129) but now the test suite is throwing Cannot unlock an object that was not locked before. 🙄 Are you familiar with this error?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I found that this is an error coming from Gutenberg: WordPress/gutenberg@1b18104#diff-a115d786e2db4593eaf8ecdf7126885b1fb7f2c936c2884de7f52a5ab00eb1e0R142-R144

But no idea of what it means without investigating deeper. :(

Copy link

github-actions bot commented Nov 1, 2024

Test the previous changes of this PR with WordPress Playground.

@renatho
Copy link
Contributor Author

renatho commented Nov 1, 2024

PR hand-off

If we don't have enough time to work complete this and we want to release it partially, we could reset to this commit: 21c0b6f, and do some tests in the site to make sure everything is working well from a user perspective.

In this commit: 21c0b6f, I started some more "aggressive" changes, and they are not complete. With that, we need to continue fixing other things.

The next steps:

JS unit tests

The commit d4d1f7e is a "draft". I sent it as a reference for ideas to solve the existing issues with tests. Later when we have the solution better defined we can amend to this commit or even remove it.

See this relevant PR related to this: WordPress/gutenberg#47388

I was getting ideas from Gutenberg repository, and I think there we can still find all answers we need, just exploring more.

Based on this comment, I thought it should be simpler, but I wasn't able to make it work yet, even in a fresh environment that I tried.

Styles

We import @wordpress/components and @wordpress/base-styles in scss files. The @wordpress/components was already updated (not deeply tested yet) and @wordpress/base-styles wasn't tested yet.

Although it shouldn't impact the next steps of this PR, see #7695 (comment) for more relevant things about styles.

E2E tests

Some related dependencies were already updated, but I didn't look at it yet.

Lint

I also didn't look at lint either. I suspect this one won't be very complex.

Final things

As described in the issue, make sure Sensei Pro continues working properly before it's merged.
Ideally, this issue should also be solved as part of this PR.

@renatho renatho removed their assignment Nov 1, 2024
@renatho renatho changed the title Update/wordpress dependencies Update npm dependencies (especially @wordpress) Nov 1, 2024
Copy link

github-actions bot commented Nov 5, 2024

Test the previous changes of this PR with WordPress Playground.

Copy link

github-actions bot commented Nov 5, 2024

Test the previous changes of this PR with WordPress Playground.

@m1r0 m1r0 force-pushed the update/wordpress-dependencies branch from ea247dc to cda2399 Compare November 5, 2024 16:06
Copy link

github-actions bot commented Nov 5, 2024

Test the previous changes of this PR with WordPress Playground.

@m1r0 m1r0 force-pushed the update/wordpress-dependencies branch from cda2399 to ab5f7be Compare November 6, 2024 11:08
Copy link

github-actions bot commented Nov 6, 2024

Test the previous changes of this PR with WordPress Playground.

Copy link

github-actions bot commented Nov 6, 2024

Test the previous changes of this PR with WordPress Playground.

Copy link

github-actions bot commented Nov 6, 2024

Test the previous changes of this PR with WordPress Playground.

Copy link

github-actions bot commented Nov 7, 2024

Test the previous changes of this PR with WordPress Playground.

@m1r0 m1r0 added this to the 4.24.4 milestone Nov 7, 2024
Copy link

Test the previous changes of this PR with WordPress Playground.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants