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

Automatically sync stable blocks from Gutenberg to wordpress-develop on release #2647

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -1247,6 +1247,11 @@ module.exports = function(grunt) {
*/
grunt.task.run( 'wp-packages:refresh-deps' );

/*
* Refresh the PHP files referring to stable @wordpress/block-library blocks.
*/
grunt.task.run( 'wp-packages:sync-stable-blocks' );

// Build the files stored in the src/ directory.
grunt.task.run( 'build:dev' );
} );
Expand Down Expand Up @@ -1698,6 +1703,12 @@ module.exports = function(grunt) {
} );
} );

grunt.registerTask( 'wp-packages:sync-stable-blocks', 'Refresh the PHP files referring to stable @wordpress/block-library blocks.', function() {
grunt.log.writeln( `Syncing stable blocks from @wordpress/block-library to src/` );
const { main } = require( __dirname + '/tools/release/sync-stable-blocks' );
Copy link
Member

Choose a reason for hiding this comment

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

Any reason we can't use?

Suggested change
const { main } = require( __dirname + '/tools/release/sync-stable-blocks' );
const { main } = require( './tools/release/sync-stable-blocks' );

Is there also any reason why it has to be required dynamically rather than in the header of the file?

main();
} );

// Patch task.
grunt.renameTask('patch_wordpress', 'patch');

Expand Down
60 changes: 1 addition & 59 deletions src/wp-includes/blocks/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,67 +6,9 @@
*/

// Include files required for core blocks registration.
require ABSPATH . WPINC . '/blocks/archives.php';
require ABSPATH . WPINC . '/blocks/avatar.php';
require ABSPATH . WPINC . '/blocks/block.php';
require ABSPATH . WPINC . '/blocks/calendar.php';
require ABSPATH . WPINC . '/blocks/categories.php';
require ABSPATH . WPINC . '/blocks/comment-author-name.php';
require ABSPATH . WPINC . '/blocks/comment-content.php';
require ABSPATH . WPINC . '/blocks/comment-date.php';
require ABSPATH . WPINC . '/blocks/comment-edit-link.php';
require ABSPATH . WPINC . '/blocks/comment-reply-link.php';
require ABSPATH . WPINC . '/blocks/comment-template.php';
require ABSPATH . WPINC . '/blocks/comments-pagination-next.php';
require ABSPATH . WPINC . '/blocks/comments-pagination-numbers.php';
require ABSPATH . WPINC . '/blocks/comments-pagination-previous.php';
require ABSPATH . WPINC . '/blocks/comments-pagination.php';
require ABSPATH . WPINC . '/blocks/comments-title.php';
require ABSPATH . WPINC . '/blocks/cover.php';
require ABSPATH . WPINC . '/blocks/file.php';
require ABSPATH . WPINC . '/blocks/gallery.php';
require ABSPATH . WPINC . '/blocks/home-link.php';
require ABSPATH . WPINC . '/blocks/image.php';
require ABSPATH . WPINC . '/blocks/latest-comments.php';
require ABSPATH . WPINC . '/blocks/latest-posts.php';
require ABSPATH . WPINC . '/blocks/legacy-widget.php';
require ABSPATH . WPINC . '/blocks/loginout.php';
require ABSPATH . WPINC . '/blocks/navigation-link.php';
require ABSPATH . WPINC . '/blocks/navigation-submenu.php';
require ABSPATH . WPINC . '/blocks/navigation.php';
require ABSPATH . WPINC . '/blocks/page-list.php';
require ABSPATH . WPINC . '/blocks/pattern.php';
require ABSPATH . WPINC . '/blocks/post-author-biography.php';
require ABSPATH . WPINC . '/blocks/post-author.php';
require ABSPATH . WPINC . '/blocks/post-comments.php';
require ABSPATH . WPINC . '/blocks/post-comments-form.php';
require ABSPATH . WPINC . '/blocks/post-content.php';
require ABSPATH . WPINC . '/blocks/post-date.php';
require ABSPATH . WPINC . '/blocks/post-excerpt.php';
require ABSPATH . WPINC . '/blocks/post-featured-image.php';
require ABSPATH . WPINC . '/blocks/post-navigation-link.php';
require ABSPATH . WPINC . '/blocks/post-template.php';
require ABSPATH . WPINC . '/blocks/post-terms.php';
require ABSPATH . WPINC . '/blocks/post-title.php';
require ABSPATH . WPINC . '/blocks/query-no-results.php';
require ABSPATH . WPINC . '/blocks/query-pagination-next.php';
require ABSPATH . WPINC . '/blocks/query-pagination-numbers.php';
require ABSPATH . WPINC . '/blocks/query-pagination-previous.php';
require ABSPATH . WPINC . '/blocks/query-pagination.php';
require ABSPATH . WPINC . '/blocks/query-title.php';
require ABSPATH . WPINC . '/blocks/query.php';
require ABSPATH . WPINC . '/blocks/read-more.php';
require ABSPATH . WPINC . '/blocks/rss.php';
require ABSPATH . WPINC . '/blocks/search.php';
require ABSPATH . WPINC . '/blocks/shortcode.php';
require ABSPATH . WPINC . '/blocks/site-logo.php';
require ABSPATH . WPINC . '/blocks/site-tagline.php';
require ABSPATH . WPINC . '/blocks/site-title.php';
require ABSPATH . WPINC . '/blocks/social-link.php';
require ABSPATH . WPINC . '/blocks/tag-cloud.php';
require ABSPATH . WPINC . '/blocks/template-part.php';
require ABSPATH . WPINC . '/blocks/term-description.php';
require ABSPATH . WPINC . '/blocks/widget-group.php';
require ABSPATH . WPINC . '/blocks/require-blocks.php';
Copy link
Member

Choose a reason for hiding this comment

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

Nit: Let's move /blocks/require-blocks.php as the first import before all special cases.


/**
* Registers core block types using metadata files.
Expand Down
64 changes: 64 additions & 0 deletions src/wp-includes/blocks/require-blocks.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<?php


// This file was autogenerated by tools/release/sync-stable-blocks.js, do not change manually!
// Include files required for core blocks registration.
require ABSPATH . WPINC . '/blocks/archives.php';
require ABSPATH . WPINC . '/blocks/avatar.php';
require ABSPATH . WPINC . '/blocks/block.php';
require ABSPATH . WPINC . '/blocks/calendar.php';
require ABSPATH . WPINC . '/blocks/categories.php';
require ABSPATH . WPINC . '/blocks/comment-author-name.php';
require ABSPATH . WPINC . '/blocks/comment-content.php';
require ABSPATH . WPINC . '/blocks/comment-date.php';
require ABSPATH . WPINC . '/blocks/comment-edit-link.php';
require ABSPATH . WPINC . '/blocks/comment-reply-link.php';
require ABSPATH . WPINC . '/blocks/comment-template.php';
require ABSPATH . WPINC . '/blocks/comments-pagination.php';
require ABSPATH . WPINC . '/blocks/comments-pagination-next.php';
require ABSPATH . WPINC . '/blocks/comments-pagination-numbers.php';
require ABSPATH . WPINC . '/blocks/comments-pagination-previous.php';
require ABSPATH . WPINC . '/blocks/comments-title.php';
require ABSPATH . WPINC . '/blocks/cover.php';
require ABSPATH . WPINC . '/blocks/file.php';
require ABSPATH . WPINC . '/blocks/gallery.php';
require ABSPATH . WPINC . '/blocks/home-link.php';
require ABSPATH . WPINC . '/blocks/image.php';
require ABSPATH . WPINC . '/blocks/latest-comments.php';
require ABSPATH . WPINC . '/blocks/latest-posts.php';
require ABSPATH . WPINC . '/blocks/loginout.php';
require ABSPATH . WPINC . '/blocks/navigation.php';
require ABSPATH . WPINC . '/blocks/navigation-link.php';
require ABSPATH . WPINC . '/blocks/navigation-submenu.php';
require ABSPATH . WPINC . '/blocks/page-list.php';
require ABSPATH . WPINC . '/blocks/pattern.php';
require ABSPATH . WPINC . '/blocks/post-author.php';
require ABSPATH . WPINC . '/blocks/post-author-biography.php';
require ABSPATH . WPINC . '/blocks/post-comments.php';
require ABSPATH . WPINC . '/blocks/post-comments-form.php';
require ABSPATH . WPINC . '/blocks/post-content.php';
require ABSPATH . WPINC . '/blocks/post-date.php';
require ABSPATH . WPINC . '/blocks/post-excerpt.php';
require ABSPATH . WPINC . '/blocks/post-featured-image.php';
require ABSPATH . WPINC . '/blocks/post-navigation-link.php';
require ABSPATH . WPINC . '/blocks/post-template.php';
require ABSPATH . WPINC . '/blocks/post-terms.php';
require ABSPATH . WPINC . '/blocks/post-title.php';
require ABSPATH . WPINC . '/blocks/query.php';
require ABSPATH . WPINC . '/blocks/query-no-results.php';
require ABSPATH . WPINC . '/blocks/query-pagination.php';
require ABSPATH . WPINC . '/blocks/query-pagination-next.php';
require ABSPATH . WPINC . '/blocks/query-pagination-numbers.php';
require ABSPATH . WPINC . '/blocks/query-pagination-previous.php';
require ABSPATH . WPINC . '/blocks/query-title.php';
require ABSPATH . WPINC . '/blocks/read-more.php';
require ABSPATH . WPINC . '/blocks/rss.php';
require ABSPATH . WPINC . '/blocks/search.php';
require ABSPATH . WPINC . '/blocks/shortcode.php';
require ABSPATH . WPINC . '/blocks/site-logo.php';
require ABSPATH . WPINC . '/blocks/site-tagline.php';
require ABSPATH . WPINC . '/blocks/site-title.php';
require ABSPATH . WPINC . '/blocks/social-link.php';
require ABSPATH . WPINC . '/blocks/tag-cloud.php';
require ABSPATH . WPINC . '/blocks/template-part.php';
require ABSPATH . WPINC . '/blocks/term-description.php';
63 changes: 2 additions & 61 deletions tests/phpunit/includes/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -302,68 +302,9 @@ function _wp_rest_server_class_filter() {
* @since 5.0.0
*/
function _unhook_block_registration() {
remove_action( 'init', 'register_block_core_archives' );
remove_action( 'init', 'register_block_core_avatar' );
remove_action( 'init', 'register_block_core_block' );
remove_action( 'init', 'register_block_core_calendar' );
remove_action( 'init', 'register_block_core_categories' );
remove_action( 'init', 'register_block_core_comment_author_name' );
remove_action( 'init', 'register_block_core_comment_content' );
remove_action( 'init', 'register_block_core_comment_date' );
remove_action( 'init', 'register_block_core_comment_edit_link' );
remove_action( 'init', 'register_block_core_comment_reply_link' );
remove_action( 'init', 'register_block_core_comment_template' );
remove_action( 'init', 'register_block_core_comments_pagination' );
remove_action( 'init', 'register_block_core_comments_pagination_next' );
remove_action( 'init', 'register_block_core_comments_pagination_numbers' );
remove_action( 'init', 'register_block_core_comments_pagination_previous' );
remove_action( 'init', 'register_block_core_comments_title' );
remove_action( 'init', 'register_block_core_cover' );
remove_action( 'init', 'register_block_core_file' );
remove_action( 'init', 'register_block_core_gallery' );
remove_action( 'init', 'register_block_core_home_link' );
remove_action( 'init', 'register_block_core_image' );
remove_action( 'init', 'register_block_core_latest_comments' );
remove_action( 'init', 'register_block_core_latest_posts' );
remove_action( 'init', 'register_block_core_legacy_widget' );
remove_action( 'init', 'register_block_core_loginout' );
remove_action( 'init', 'register_block_core_navigation' );
remove_action( 'init', 'register_block_core_navigation_link' );
remove_action( 'init', 'register_block_core_navigation_submenu' );
remove_action( 'init', 'register_block_core_page_list' );
remove_action( 'init', 'register_block_core_pattern' );
remove_action( 'init', 'register_block_core_post_author' );
remove_action( 'init', 'register_block_core_post_author_biography' );
remove_action( 'init', 'register_block_core_post_comments' );
remove_action( 'init', 'register_block_core_post_comments_form' );
remove_action( 'init', 'register_block_core_post_content' );
remove_action( 'init', 'register_block_core_post_date' );
remove_action( 'init', 'register_block_core_post_excerpt' );
remove_action( 'init', 'register_block_core_post_featured_image' );
remove_action( 'init', 'register_block_core_post_navigation_link' );
remove_action( 'init', 'register_block_core_post_template' );
remove_action( 'init', 'register_block_core_post_terms' );
remove_action( 'init', 'register_block_core_post_title' );
remove_action( 'init', 'register_block_core_query' );
remove_action( 'init', 'register_block_core_query_no_results' );
remove_action( 'init', 'register_block_core_query_pagination' );
remove_action( 'init', 'register_block_core_query_pagination_next' );
remove_action( 'init', 'register_block_core_query_pagination_numbers' );
remove_action( 'init', 'register_block_core_query_pagination_previous' );
remove_action( 'init', 'register_block_core_query_title' );
remove_action( 'init', 'register_block_core_read_more' );
remove_action( 'init', 'register_block_core_rss' );
remove_action( 'init', 'register_block_core_search' );
remove_action( 'init', 'register_block_core_shortcode' );
remove_action( 'init', 'register_block_core_site_logo' );
remove_action( 'init', 'register_block_core_site_tagline' );
remove_action( 'init', 'register_block_core_site_title' );
remove_action( 'init', 'register_block_core_social_link' );
remove_action( 'init', 'register_block_core_social_link' );
remove_action( 'init', 'register_block_core_tag_cloud' );
remove_action( 'init', 'register_block_core_template_part' );
remove_action( 'init', 'register_block_core_term_description' );
require __DIR__ . '/unregister-blocks-hooks.php';
remove_action( 'init', 'register_core_block_types_from_metadata' );
remove_action( 'init', 'register_block_core_legacy_widget' );
remove_action( 'init', 'register_block_core_widget_group' );
}
tests_add_filter( 'init', '_unhook_block_registration', 1000 );
62 changes: 62 additions & 0 deletions tests/phpunit/includes/unregister-blocks-hooks.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<?php

// This file was autogenerated by tools/release/sync-stable-blocks.js, do not change manually!
remove_action( 'init', 'register_block_core_archives' );
remove_action( 'init', 'register_block_core_avatar' );
remove_action( 'init', 'register_block_core_block' );
remove_action( 'init', 'register_block_core_calendar' );
remove_action( 'init', 'register_block_core_categories' );
remove_action( 'init', 'register_block_core_comment_author_name' );
remove_action( 'init', 'register_block_core_comment_content' );
remove_action( 'init', 'register_block_core_comment_date' );
remove_action( 'init', 'register_block_core_comment_edit_link' );
remove_action( 'init', 'register_block_core_comment_reply_link' );
remove_action( 'init', 'register_block_core_comment_template' );
remove_action( 'init', 'register_block_core_comments_pagination' );
remove_action( 'init', 'register_block_core_comments_pagination_next' );
remove_action( 'init', 'register_block_core_comments_pagination_numbers' );
remove_action( 'init', 'register_block_core_comments_pagination_previous' );
remove_action( 'init', 'register_block_core_comments_title' );
remove_action( 'init', 'register_block_core_cover' );
remove_action( 'init', 'register_block_core_file' );
remove_action( 'init', 'register_block_core_gallery' );
remove_action( 'init', 'register_block_core_home_link' );
remove_action( 'init', 'register_block_core_image' );
remove_action( 'init', 'register_block_core_latest_comments' );
remove_action( 'init', 'register_block_core_latest_posts' );
remove_action( 'init', 'register_block_core_loginout' );
remove_action( 'init', 'register_block_core_navigation' );
remove_action( 'init', 'register_block_core_navigation_link' );
remove_action( 'init', 'register_block_core_navigation_submenu' );
remove_action( 'init', 'register_block_core_page_list' );
remove_action( 'init', 'register_block_core_pattern' );
remove_action( 'init', 'register_block_core_post_author' );
remove_action( 'init', 'register_block_core_post_author_biography' );
remove_action( 'init', 'register_block_core_post_comments' );
remove_action( 'init', 'register_block_core_post_comments_form' );
remove_action( 'init', 'register_block_core_post_content' );
remove_action( 'init', 'register_block_core_post_date' );
remove_action( 'init', 'register_block_core_post_excerpt' );
remove_action( 'init', 'register_block_core_post_featured_image' );
remove_action( 'init', 'register_block_core_post_navigation_link' );
remove_action( 'init', 'register_block_core_post_template' );
remove_action( 'init', 'register_block_core_post_terms' );
remove_action( 'init', 'register_block_core_post_title' );
remove_action( 'init', 'register_block_core_query' );
remove_action( 'init', 'register_block_core_query_no_results' );
remove_action( 'init', 'register_block_core_query_pagination' );
remove_action( 'init', 'register_block_core_query_pagination_next' );
remove_action( 'init', 'register_block_core_query_pagination_numbers' );
remove_action( 'init', 'register_block_core_query_pagination_previous' );
remove_action( 'init', 'register_block_core_query_title' );
remove_action( 'init', 'register_block_core_read_more' );
remove_action( 'init', 'register_block_core_rss' );
remove_action( 'init', 'register_block_core_search' );
remove_action( 'init', 'register_block_core_shortcode' );
remove_action( 'init', 'register_block_core_site_logo' );
remove_action( 'init', 'register_block_core_site_tagline' );
remove_action( 'init', 'register_block_core_site_title' );
remove_action( 'init', 'register_block_core_social_link' );
remove_action( 'init', 'register_block_core_tag_cloud' );
remove_action( 'init', 'register_block_core_template_part' );
remove_action( 'init', 'register_block_core_term_description' );
Loading