Make WordPress Core


Ignore:
Timestamp:
01/16/2026 10:30:09 AM (7 months ago)
Author:
youknowriad
Message:

Build: Improve Gutenberg integration workflow.

This changeset improves the Gutenberg build integration to simplify the developer workflow and reinstore a flow similar to how package dependencies worked before the Gutenberg checkout-and-build approach was introduced.

Key improvements:

  • Automatic rebuild on ref change: Adds a new gutenberg:sync script that stores a hash of the built ref in .gutenberg-hash and only rebuilds when the ref changes.
  • Full integration on npm install: Running npm install now produces a fully working development environment with Gutenberg assets in src/.
  • Clean Gutenberg checkout: Restores Gutenberg's package.json after the build completes.
  • Stops copying .js.map files to wp-includes/js/dist since they reference non-existent paths.
  • Remove package.json files from the build folder.
  • Avoid closures and use prefixed functions.
  • Updates build checks to use jquery.js instead of edit-post.js as the build indicator.

Props youknowriad, ellatrix, mcsf, dmsnell, ntsekouras, jorgefilipecosta, tobiasbg, peterwilsoncc.
Fixes #64393.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/blocks/index.php

    r59159 r61492  
    1414
    1515// Include files required for core blocks registration.
    16 require BLOCKS_PATH . 'legacy-widget.php';
    17 require BLOCKS_PATH . 'widget-group.php';
    18 require BLOCKS_PATH . 'require-dynamic-blocks.php';
     16if ( file_exists( BLOCKS_PATH . 'legacy-widget.php' ) ) {
     17        require BLOCKS_PATH . 'legacy-widget.php';
     18}
     19if ( file_exists( BLOCKS_PATH . 'widget-group.php' ) ) {
     20        require BLOCKS_PATH . 'widget-group.php';
     21}
     22if ( file_exists( BLOCKS_PATH . 'require-dynamic-blocks.php' ) ) {
     23        require BLOCKS_PATH . 'require-dynamic-blocks.php';
     24}
    1925
    2026/**
     
    4450        static $core_blocks_meta;
    4551        if ( ! $core_blocks_meta ) {
     52                if ( ! file_exists( BLOCKS_PATH . 'blocks-json.php' ) ) {
     53                        return;
     54                }
    4655                $core_blocks_meta = require BLOCKS_PATH . 'blocks-json.php';
    4756        }
     
    151160 */
    152161function register_core_block_types_from_metadata() {
     162        if ( ! file_exists( BLOCKS_PATH . 'require-static-blocks.php' ) ) {
     163                return;
     164        }
    153165        $block_folders = require BLOCKS_PATH . 'require-static-blocks.php';
    154166        foreach ( $block_folders as $block_folder ) {
     
    170182 */
    171183function wp_register_core_block_metadata_collection() {
     184        if ( ! file_exists( BLOCKS_PATH . 'blocks-json.php' ) ) {
     185                return;
     186        }
    172187        wp_register_block_metadata_collection(
    173188                BLOCKS_PATH,
Note: See TracChangeset for help on using the changeset viewer.