Make WordPress Core

Changeset 61567


Ignore:
Timestamp:
01/30/2026 03:25:51 PM (7 months ago)
Author:
mcsf
Message:

Build: Fix copyBlockAssets's handling of folders.

When copying block-type assets from Gutenberg to Core, use Node's fs.cp
instead of fs.copy. The former has much better semantics for wholesale
copies.

Fixes build failures arising from the introduction of subdirectories in the
source directories of certain core block types.

Reviewed by youknowriad.

Fixes #64559.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/gutenberg/copy-gutenberg-build.js

    r61504 r61567  
    224224                        const blockScriptsSrc = path.join( scriptsSrc, blockName );
    225225                        if ( fs.existsSync( blockScriptsSrc ) ) {
    226                                 const files = fs.readdirSync( blockScriptsSrc );
    227                                 for ( const file of files ) {
    228                                         if ( file.endsWith( '.php' ) ) {
    229                                                 continue; // Skip PHP, copied from packages
     226                                fs.cpSync(
     227                                        blockScriptsSrc,
     228                                        blockDest,
     229                                        {
     230                                                recursive: true,
     231                                                // Skip PHP, copied from packages
     232                                                filter: f => ! f.endsWith( '.php' ),
    230233                                        }
    231                                         fs.copyFileSync(
    232                                                 path.join( blockScriptsSrc, file ),
    233                                                 path.join( blockDest, file )
    234                                         );
    235                                 }
     234                                );
    236235                        }
    237236
Note: See TracChangeset for help on using the changeset viewer.