-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Add script to automatically update core packages #19448
Add script to automatically update core packages #19448
Conversation
bin/commander.js
Outdated
* Internal dependencies | ||
*/ | ||
const { readJSONFile, runShellScript, askForConfirmationToContinue } = require( './utils' ); | ||
const { updateCorePackages } = require( './update-core-packages' ); |
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.
Why this command is separate but not the others? Should we be consistent?
Should we create a dedicated folder for this tool, now that it's split into multiple files?
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.
Why this command is separate but not the others? Should we be consistent?
The main file got too big, I thought it was not a good idea to add the implementation of another command there. I think we should reorganize and split the commands into multiple files, I avoided doing this here to make reviewing easier. As soon as we land this PR I plan on proposing a PR that refactors our commands.
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 didn't test but this is cool.
I have just tested the WordPress core patch and everything works perfectly fine. Excellent work on this tool. As discussed in the private chat, it feels like it would be easier to have a way to run this script directly from |
I think this release tool entirely could be a separate repo/tool/package instead of just a script in the gutenberg repo. |
I feel we could just update the script a bit to generate a |
I love the idea, this way we could use it with all projects that use WordPress packages. It could also become a way to self-update Update 1: In WordPress core it would become: {
"scripts": {
"packages-update": "wp-scripts packages-update",
"postpackages-update": "npm run build"
}
} Update 2: I realized, that it doesn't cover the |
Hi @youknowriad, @gziolo, I have considered the idea of generating a .diff file but it is much slower because one needs to clone the wordpress-develop repository again (to not depend on the user having it previously cloned) and given that to generate the diff we need npm install and npm run build we would always need to do a full npm install on a blank repository which is very slow (e.g: chromium is downloaded). @gziolo I like the idea of making this part of @wordpress/scripts so other plugins/third parties can use this to update their package versions. |
I'm looking forward to it, thank you for working on this script. It's going to be totally awesome :) |
53b17d1
to
58ed668
Compare
This PR was updated to follow @gziolo suggestion, and the script is now part of @wordpress/scripts. I tested the script by setting the current path on the terminal to the WordPress develop directory and then executing "/Users/.../gutenberg/packages/scripts/bin/wp-scripts.js packages-update" followed by "npm run build". The generated patch can be checked in https://core.trac.wordpress.org/ticket/49204 and WordPress/wordpress-develop#132. The plan is to make the script easier to use. After the next package release we should add the following config in core:
So we can simply do npm run packages-update in core to update the WordPress packages. Third-party users can easily do the same by importing @wordpress/scripts. |
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.
Awesome work. It still needs to be documented in the README file and includes a new feature in the CHANGELOG file. You pick how you proceed, one or two PRs 🚢
It would be good to rewrite some blog posts about the scripts package |
@youknowriad – can you expand what should be covered? I'd be more than happy to take care of it. |
We could write a series of posts:
I know we have some of these in docs, but the blog post format works well I think for awareness. |
This ticket exposes the packages-update script implemented at WordPress/gutenberg#19448 on WordPress core. By running "npm run wp-packages-update" all the WordPress packages are updated to the latest version. The command is very useful when updating the Gutenberg editor core exposes. Props isabel_brison. Fixes #51491. git-svn-id: https://develop.svn.wordpress.org/trunk@49129 602fd350-edb4-49c9-b593-d223f7449a82
This ticket exposes the packages-update script implemented at WordPress/gutenberg#19448 on WordPress core. By running "npm run wp-packages-update" all the WordPress packages are updated to the latest version. The command is very useful when updating the Gutenberg editor core exposes. Props isabel_brison. Fixes #51491. git-svn-id: https://develop.svn.wordpress.org/trunk@49129 602fd350-edb4-49c9-b593-d223f7449a82
This ticket exposes the packages-update script implemented at WordPress/gutenberg#19448 on WordPress core. By running "npm run wp-packages-update" all the WordPress packages are updated to the latest version. The command is very useful when updating the Gutenberg editor core exposes. Props isabel_brison. Fixes #51491. Built from https://develop.svn.wordpress.org/trunk@49129 git-svn-id: http://core.svn.wordpress.org/trunk@48891 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This ticket exposes the packages-update script implemented at WordPress/gutenberg#19448 on WordPress core. By running "npm run wp-packages-update" all the WordPress packages are updated to the latest version. The command is very useful when updating the Gutenberg editor core exposes. Props isabel_brison. Fixes #51491. Built from https://develop.svn.wordpress.org/trunk@49129 git-svn-id: https://core.svn.wordpress.org/trunk@48891 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This ticket exposes the packages-update script implemented at WordPress/gutenberg#19448 on WordPress core. By running "npm run wp-packages-update" all the WordPress packages are updated to the latest version. The command is very useful when updating the Gutenberg editor core exposes. Props isabel_brison. Fixes #51491. git-svn-id: https://develop.svn.wordpress.org/trunk@49129 602fd350-edb4-49c9-b593-d223f7449a82
This ticket exposes the packages-update script implemented at WordPress/gutenberg#19448 on WordPress core. By running "npm run wp-packages-update" all the WordPress packages are updated to the latest version. The command is very useful when updating the Gutenberg editor core exposes. Props isabel_brison. Fixes #51491. Built from https://develop.svn.wordpress.org/trunk@49129
Description
This PR adds a script that automatically updates core WordPress packages to their latest version.
Patch with updates generated using this script https://core.trac.wordpress.org/ticket/49142 (PR: WordPress/wordpress-develop#128)
How has this been tested?
I opened the WordPress develop dir on the terminal.
I executed "/.../gutenberg/bin/commander.js update-core" against that folder and verified the package.json package-lock.json and the block PHP files were changed.