Opened 6 years ago
Closed 6 years ago
#45145 closed defect (bug) (fixed)
Keep `@wordpress` packages up to date
Reported by: | atimmer | Owned by: | youknowriad |
---|---|---|---|
Milestone: | 5.0 | Priority: | highest omg bbq |
Severity: | blocker | Version: | 5.0 |
Component: | Build/Test Tools | Keywords: | fixed-5.0 |
Focuses: | Cc: |
Description
For the 5.0 release we have to make sure we have the latest version of the packages that needs to be included in 5.0. I will be regularly updating the packages, this ticket will track those commits.
Attachments (20)
Change History (107)
#2
@
6 years ago
@atimmer: You need to run grunt webpack:dev
after upgrading these packages, particularly block-library
, which copies the PHP files for core dynamic blocks.
Also, remember to run unit tests after this, too, as I think one of the blocks changed their structure a little, which will break the block fixture tests.
#4
@
6 years ago
Didn't realize that the JavaScript packages could also contain PHP after [43751]. I'll keep that in mind.
This ticket was mentioned in Slack in #core-js by atimmer. View the logs.
6 years ago
#9
@
6 years ago
Can we avoid installing the submodules and all the mobile stuff? Asking because it now requires to have yarn installed which is currently not available on w.org and thus broke the build.
#10
@
6 years ago
@ocean90: Are you sure it was yarn
? That gets installed into packages/node_modules/.bin
, the build should be using that yarn
(that's what it does when I run it on my sandbox).
I think it's broken because it looks like the package-lock.json
changes were generated on MacOS, instead of Linux.
#11
@
6 years ago
@pento Ah, maybe it’s that. There’s definitely going on too much during the npm install these days. :)
#12
@
6 years ago
For clarity, I’ve signed off on @atimmer keeping the packages up-to-date. So any commit in that regard by him is fine by me.
#14
@
6 years ago
With this method, how do we test packages before they are a part of a tagged Gutenberg release?
This ticket was mentioned in Slack in #core-committers by ocean90. View the logs.
6 years ago
#16
@
6 years ago
Building of the 5.0 branch currently fails on Windows. Caused because now we download and build Gutenberg while building WP and the mobile
module there fails.
Seems this has to be fixed "upstream", opened https://github.com/WordPress/gutenberg/issues/11144.
#17
follow-up:
↓ 19
@
6 years ago
Also, I may be missing something but shouldn't we be including pre-build (release) versions of the external packages when building WordPress? When updated packages (that have been tested and released "upstream") are available we can update them in package.json, even if that means we need to update it quite regularly at the moment.
This is the proper way to include external packages :)
#18
follow-up:
↓ 23
@
6 years ago
Please generate ... on Linux
Is someone working on that? Building WordPress never required a specific operating system before, and shouldn’t now.
#19
in reply to:
↑ 17
@
6 years ago
- Priority changed from normal to highest omg bbq
- Severity changed from normal to blocker
Replying to azaozz:
When updated packages (that have been tested and released "upstream") are available we can update them in package.json, even if that means we need to update it quite regularly at the moment.
This is the proper way to include external packages :)
Replying to johnjamesjacoby:
Is someone working on that? Building WordPress never required a specific operating system before, and shouldn’t now.
100% in agreement here, [43824] and [43826] should be reverted restoring the previous processes
#23
in reply to:
↑ 18
;
follow-up:
↓ 26
@
6 years ago
- Owner pento deleted
Replying to johnjamesjacoby:
Is someone working on that? Building WordPress never required a specific operating system before, and shouldn’t now.
WordPress (in particular, the build server) has always required that package-lock.json
be generated on Linux, the difference is that we used to only create that file right before release. 🙂
It needs to be fixed, but it's extremely low priority, when the workaround is for the occasional package.json
updates to be done from a Linux box.
#24
@
6 years ago
when the workaround is for the occasional package.json updates to be done from a Linux box
This raises the barrier to entry significantly for some folks, and I’m uncomfortable with that. This seems like a workflow regression, and has caused issues here already. How was this decided? What alternatives are there?
#25
@
6 years ago
Maybe @nacin will remember why the build server requires a special package-lock.json
, I don't recall off the top of my head. I suspect it's just that it doesn't like when running npm install
causes the package-lock.json
file to change (in which case, the fix is pretty easy), but I haven't confirmed that.
The build server needs to be fixed, but there are only a handful of people with the ability to do that, and it's a low priority for all of them.
This doesn't really raise the barrier of entry at the moment, given that the only packages being updated are the @wordpress/
packages, which only a handful of people can do. It will raise the barrier if left unfixed, but no-one is arguing in favour of doing that.
#26
in reply to:
↑ 23
@
6 years ago
Replying to pento:
WordPress (in particular, the build server) has always required that
package-lock.json
be generated on Linux, the difference is that we used to only create that file right before release. 🙂
Adding to this, it was only ever committed to the release branch and never /trunk
.
Now that there is a package-lock.json
file in the primary working branch this requires committers to ensure that the npm lock file is committed is a Linux safe state for the build server to not crash
See also: #45088 - Update package-lock.json for Mac, Linux, and Windows cross-platform compatibility
#27
@
6 years ago
p.s. The build issue was originally raised in #38657, and fixed in [39368]:
Build: Remove
fsevents
fromnpm-shrinkwrap.json
fsevents
is macOS only, and npm-shrinkwrap tries to force it onto other architectures, causing build failures. Upstream: https://github.com/npm/npm/issues/2679.
#28
@
6 years ago
45145.diff updates to the latest version of the @wordpress/
packages, and adds the new @wordpress/format-library
and @wordpress/notices
packages.
It currently causes a JS error: https://github.com/WordPress/gutenberg/pull/11122
#30
follow-up:
↓ 32
@
6 years ago
After [43840], 45145.4.diff are the changes I get when running npm install
on MacOS. Applying that patch on Linux, then running npm install
just reverts them.
#32
in reply to:
↑ 30
;
follow-up:
↓ 34
@
6 years ago
Replying to pento:
After [43840], 45145.4.diff are the changes I get when running
npm install
on MacOS. Applying that patch on Linux, then runningnpm install
just reverts them.
I got the same results in my testing, of interest though was the only changes were related to the https://
/ https://
URLs, none of the optional
changes occured this time /shrug
#33
@
6 years ago
@pento thanks for taking care of this. Can confirm building of the 5.0 branch works properly on Windows 10 with the default installations of git, npm, etc. no tweaks needed :)
#34
in reply to:
↑ 32
;
follow-up:
↓ 35
@
6 years ago
Replying to johnjamesjacoby:
This raises the barrier to entry significantly for some folks...
Not exactly :) This generally concerns only the committers. package-lock.json
is an auto-generated file and currently there is a bug in npm that rewrites optional dependencies when generating it from different OS.
It is the committers' "job" to ensure we have the proper package-lock.json
and not introduce OS related changes there. As @netweb mentioned above, this is tracked in #45088.
Replying to netweb:
Building on Win10 still added ~10 "optional": true
apart from the http://
to https://
fixes. Can upload a diff to #45088 just as example.
#40
@
6 years ago
Looking at [43884], the render_block()
in wp-includes/blocks.php in particular. Couple of nitpicks:
- Thinking the normalization of the block
attrs
should be done in all cases, not just for dynamic blocks (it's better for the 'render_block' filter). - As we do
is_array( $block['attrs'] )
we don't need to cast it to array right after.
See 45145-blocks.php.diff.
#41
@
6 years ago
- Keywords has-patch commit added
Good catch, thanks @azaozz!
45145-blocks.php.diff is good to commit.
#45
@
6 years ago
45145.5.diff reflects the package updates in Gutenberg 4.4.0.
Installed the new versions and compiled and the new editor works great for me.
#46
@
6 years ago
@aduth Ah, your patch also has the updates to the script-loader.php
. I was working on a separate patch for PHP changes. Including them here makes sense though!
#47
@
6 years ago
Whoops, guess we overlapped work!
My patch includes changes to script-loader.php
. Notably this also includes the addition of a dependency between React and wp-polyfill
. Heads-up to @atimmer since it was mentioned at the relevant pull request to be on your "list".
Some workflow shortcuts which helped here:
- Use npm-check-updates to automate the version bumps
ncu '/^@wordpress\//' -a
- Use
git diff
since the last plugin version tag to find differences inscript-loader.php
-
git diff v4.3.0 master -U10 -- lib/client-assets.php
-
#48
@
6 years ago
Worth pointing out that neither of these patches include the version bump for React 16.6.3 which was included in the v4.4.0 plugin:
https://github.com/WordPress/gutenberg/pull/11840
I'm unsure if there's a more appropriate ticket for tracking these vendor dependencies, but raising as relevant to the 4.4.0 upgrade.
#49
@
6 years ago
Thanks for doing this update, @desrosj and @aduth!
packages-4-4-0.diff is looking good, lets bump the React version as well, though.
#50
@
6 years ago
Thanks @aduth! packages-4-4-0.2.diff is good to commit.
As a side note, the build server now ignores package-lock.json
changes, so there's no need to use Linux to generate it.
#52
follow-up:
↓ 53
@
6 years ago
45145.6.diff constitutes a first pass, including:
- An updated
package.json
thanks to thencu
tool as pointed out by Andrew in #comment:47. - A manually updated dependency tree in
script-loader.php
built from Gutenberg'spackages-dependencies.php
. - Manually merged changes from Gutenberg's
client-assets.php
. - A fix in
tools/webpack/packages.js
based on gb-12006.
As it's the middle of the night here, it's time for me to pass the baton. Please properly check the diff, in particular where it concerns TinyMCE (the line for a new plugin, tinymce-latest-lists
, was blindly copied to $vendor_scripts
), and there's a discrepancy where it reads wp_adv
(though it's probably Gutenberg the plugin which is wrong on this one).
#53
in reply to:
↑ 52
@
6 years ago
I realise that my previous comment may not be super clear on the fact that it is not a full diff of the PHP changes, so that still needs to be performed — just as an example, see git diff v4.4.0 master -U10 -- lib/compat.php
#54
@
6 years ago
We're 90% there. I uploaded 45145.7.diff which continues on from 45145.6.diff and:
- Applies patches generated from
git diff v4.4.0 master -- **/*.php
to these files:lib/class-wp-block-type.php
lib/class-wp-rest-block-renderer-controller.php
lib/class-wp-rest-blocks-controller.php
phpunit/class-block-type-test.php
phpunit/class-rest-block-renderer-controller-test.php
phpunit/class-rest-blocks-controller-test.php
- Includes the artefacts generated by running
npm install
- Adds
global $wp_locale
to the top ofwp_default_packages_vendor()
- Replaces the
tinymce-latest-lists
dependency withwp-tinymce-lists
which is already added bywp_register_tinymce_scripts()
There are some unit test failures that will be fixed when we update block-library
to include gutenberg#12149.
There is also still the wp_adv
discrepancy mentioned by @mcsf to address.
#55
@
6 years ago
Ideally we use wp_adv
in the plugin, but we couldn't because we use inline mode and the toolbars work differently. If wp_adv
has been updated, then it would be fine for WordPress 5.0, but it still wouldn't work with WordPress 4.9.8 and the plugin.
#56
@
6 years ago
Updated the patch
In addition to the last patch from Robert, this fixes an issue where the font styles were not loaded properly and updates the packages to the 4.5.1 version.
#57
@
6 years ago
there's a discrepancy where it reads wp_adv...
Right, as @iseulde points out that's not a discrepancy :)
Core uses the (old) wp_adv
for the "toggle toolbars" button, Gutenberg still uses kitchensink
. The TinyMCE wordpress
plugin (that handles toggling of toolbars) was fixed to make wp_adv
work properly in the Classic Block, but the Gutenberg's kitchensink
was kept as a back-compat for running Gutenberg on 4.9 (where the core fix is not present).
We should switch to using wp_adv
in Gutenberg as soon as it starts to require WP 5.0.
#58
@
6 years ago
Replaces the tinymce-latest-lists dependency with wp-tinymce-lists which is already added by wp_register_tinymce_scripts()
It might be worth to include https://github.com/WordPress/gutenberg/pull/12170 then.
#59
@
6 years ago
Right, seems that separately adding the lists
TinyMCE plugin is not needed. May be missing something but the included lists
plugin in core works as expected? Also couldn't find why it was added separately in Gutenberg. Lest remove tinymce-latest-lists
.
#63
@
6 years ago
In remove-wp-tinymce-lists.diff: remove separate enqueuing and loading of the lists
TinyMCE plugin.
That plugin doesn't need to be added/loaded separately. In production we load wp-tinymce.js.gz
, lists
is already included there. When SCRIPT_DEBUG is true or when running from /src
TinyMCE loads its plugins that are in wp-includes/js/tinymce/plugins
dir. There is no need or any advantages to load lists
separately.
#65
@
6 years ago
- Keywords commit fixed-5.0 removed
In 45145.8.diff:
Update packages:
- @wordpress/block-library@2.2.8
- @wordpress/components@7.0.3
- @wordpress/edit-post@3.1.3
- @wordpress/editor@9.0.3
- @wordpress/format-library@1.2.6
- @wordpress/list-reusable-blocks@1.1.16
- @wordpress/nux@3.0.4
Other changes:
- Fix a translator comment in
edit-form-blocks.php
- Rename the
gutenberg_
functions inblocks/latest-comments.php
. This is a manual port of GB12326.
#67
@
6 years ago
- Owner set to youknowriad
- Resolution set to fixed
- Status changed from assigned to closed
In 43949:
#68
@
6 years ago
- Keywords fixed-5.0 added; has-patch removed
- Resolution fixed deleted
- Status changed from closed to reopened
#71
@
6 years ago
- Keywords fixed-5.0 removed
Reopening because we need a small package update to backport this PR https://github.com/WordPress/gutenberg/pull/12342
#72
@
6 years ago
Updated packages
- @wordpress/block-library@2.2.9
- @wordpress/block-serialization-default-parser@2.0.1
- @wordpress/block-serialization-spec-parser@2.0.1
- @wordpress/blocks@6.0.3
- @wordpress/edit-post@3.1.4
- @wordpress/editor@9.0.4
- @wordpress/format-library@1.2.7
Other changes:
- Backport the parser changes.
In 43789: