-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Automate updating JS packages #2621
Conversation
58aaa15
to
9974030
Compare
I'm looking forward to give it a spin on Monday/Tuesday 🎉 |
9974030
to
7403279
Compare
9d9518e
to
a3d7ef4
Compare
It's right that "backporting" here means updating the packages to the same packages used by Gutenberg? I think this can be misleading as backporting in WordPress is more about cherry-picking a commit from trunk into a branch which the command is clearly not doing. |
Good perspective. It should be reworded so it's all clear it's about bringing changes from Gutenberg to WP core 👍🏻 |
Good notes! I renamed |
b10c503
to
a452b08
Compare
…kages to their required versions and runs the build process
04ebbe8
to
38eceed
Compare
@@ -13,7 +13,7 @@ module.exports = function(grunt) { | |||
SOURCE_DIR = 'src/', | |||
BUILD_DIR = 'build/', | |||
WORKING_DIR = grunt.option( 'dev' ) ? SOURCE_DIR : BUILD_DIR, | |||
BANNER_TEXT = '/*! This file is auto-generated */', | |||
BANNER_TEXT = '/*! This file is auto-generated */', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My linting tool caught this. Seems fine to merge.
Gruntfile.js
Outdated
} ); | ||
} ); | ||
|
||
grunt.registerTask( 'browserslist:update', 'Update WordPress packages', function() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@desrosj, how do you feel about running this command every time we refresh WordPress packages from Gutenberg?
I know you open tickets to document the changes for supported browsers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gziolo this just downloads the latest browserlist database, it doesn't affect the browsers supported by WordPress in any way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know it’s expected to run this command regularly (browserslist/browserslist#492). It's perfectly fine for trunk
, but it might not be expected for older major WordPress releases when you want only to update packages to fix security vulnerabilities.
See also https://core.trac.wordpress.org/ticket/52331 as a reference. I know from experience that overall the goal is to minimize JS and CSS changes in minor releases so it doesn’t prime all caches for WordPress. Those changes to the list of browsers might impact the generated content of files in both CSS and JS when Babel polyfills or vendor prefixes get removed.
@desrosj opened https://core.trac.wordpress.org/ticket/55559 to document supported browsers in the 6.0 cycle with a note that the list shouldn’t change after RC1.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm that's a fair point. Let's make this opt-out then, and I'll add a CLI flag to enable it on demand.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need still to clarify the final strategy for browserslist
, but it can be revised later. Everything looks good and we successfully tested it with WordPress 6.0 Beta 3 🎉
Let’s land this useful utility tool to make the backporting from Gutenberg easier. We also have plans how to improve keeping blocks in sync between Gutenberg and WordPress core.
d3f20ad
to
d112751
Compare
d112751
to
0801f0c
Compare
Excellent, I will commit while we work on backports today 👍🏻 |
Committed with https://core.trac.wordpress.org/changeset/53311. |
What problem does this PR solve?
Trac ticket: https://core.trac.wordpress.org/ticket/55642
Updating
@wordpress
packages is currently a manual process that takes some reading and trial&error to figure out:browserslist
database@wordpress
packages@wordpress
required by the existing dependencies@wordpress
dependencies to the versions required by the@wordpress
packagesnpm build:dev
(see #2564)
This PR adds a single task called
sync-gutenberg-packages
that automates this entire process.Ideally, the next step will be a GitHub action that runs it for you.
Test plan
Run the following commands:
Then merge this branch into your local copy:
Then run the command:
Then run
git status
and confirm it reports the following:cc @gziolo