Make WordPress Core

Changeset 62052


Ignore:
Timestamp:
03/19/2026 02:48:50 AM (2 days ago)
Author:
desrosj
Message:

Build/Test Tools: Copy block editor files to src after download.

The block editor-related files were previously present in the src directory and subject to version control. However, [61439] removed them from version control and has broken some workflows and testing setups that run the PHPUnit tests from src.

There is work ongoing to restore those files to version control with their respective change history. But until that happens, this updates the download.js script and gutenberg:download Grunt task to run build:gutenberg —dev every time the build asset is downloaded to ensure the files are present in src.

Props mywp459, amykamala, jorbin.
Fixes #64716. See #64393.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Gruntfile.js

    r62051 r62052  
    16081608            opts: { stdio: 'inherit' }
    16091609        }, function( error ) {
    1610             done( ! error );
     1610            if ( error ) {
     1611                done( false );
     1612                return;
     1613            }
     1614            /*
     1615             * Build block editor files into the src directory every time assets
     1616             * are downloaded. This prevents failures when running from src
     1617             * without running `build:dev` after those files were removed from
     1618             * version control in https://core.trac.wordpress.org/changeset/61438.
     1619             *
     1620             * See https://core.trac.wordpress.org/ticket/64393.
     1621             */
     1622            grunt.util.spawn( {
     1623                grunt: true,
     1624                args: [ 'build:gutenberg', '--dev' ],
     1625                opts: { stdio: 'inherit' }
     1626            }, function( buildError ) {
     1627                done( ! buildError );
     1628            } );
    16111629        } );
    16121630    } );
  • trunk/package.json

    r62050 r62052  
    142142        "gutenberg:copy": "node tools/gutenberg/copy.js",
    143143        "gutenberg:verify": "node tools/gutenberg/utils.js",
    144         "gutenberg:download": "node tools/gutenberg/download.js",
     144        "gutenberg:download": "node tools/gutenberg/download.js && grunt build:gutenberg --dev",
    145145        "vendor:copy": "node tools/vendors/copy-vendors.js",
    146146        "sync-gutenberg-packages": "grunt sync-gutenberg-packages",
  • trunk/tools/gutenberg/utils.js

    r62021 r62052  
    4343
    4444/**
    45  * Trigger a fresh download of the Gutenberg artifact by spawning download.js.
    46  * Exits the process if the download fails.
     45 * Trigger a fresh download of the Gutenberg artifact by spawning download.js,
     46 * then run `grunt build:gutenberg --dev` to copy the build to src/.
     47 * Exits the process if either step fails.
    4748 */
    4849function downloadGutenberg() {
    49     const result = spawnSync( 'node', [ path.join( __dirname, 'download.js' ) ], { stdio: 'inherit' } );
    50     if ( result.status !== 0 ) {
    51         process.exit( result.status ?? 1 );
     50    const downloadResult = spawnSync( 'node', [ path.join( __dirname, 'download.js' ) ], { stdio: 'inherit' } );
     51    if ( downloadResult.status !== 0 ) {
     52        process.exit( downloadResult.status ?? 1 );
     53    }
     54
     55    const buildResult = spawnSync( 'grunt', [ 'build:gutenberg', '--dev' ], { stdio: 'inherit', shell: true } );
     56    if ( buildResult.status !== 0 ) {
     57        process.exit( buildResult.status ?? 1 );
    5258    }
    5359}
Note: See TracChangeset for help on using the changeset viewer.