@@ -53,6 +53,7 @@ module.exports = function(grunt) {
5353 webpackFiles = [
5454 'wp-includes/assets/*' ,
5555 'wp-includes/css/dist' ,
56+ 'wp-includes/blocks/**/*.css' ,
5657 '!wp-includes/assets/script-loader-packages.min.php' ,
5758 '!wp-includes/assets/script-modules-packages.min.php' ,
5859 ] ,
@@ -587,97 +588,7 @@ module.exports = function(grunt) {
587588 certificates : {
588589 src : 'vendor/composer/ca-bundle/res/cacert.pem' ,
589590 dest : SOURCE_DIR + 'wp-includes/certificates/ca-bundle.crt'
590- } ,
591- // Gutenberg PHP infrastructure files (routes.php, pages.php, constants.php, pages/, routes/).
592- 'gutenberg-php' : {
593- options : {
594- process : function ( content ) {
595- // Fix boot module asset file path for Core's different directory structure.
596- return content . replace (
597- / _ _ D I R _ _ \s * \. \s * ( [ ' " ] ) \/ ..\/ \. .\/ m o d u l e s \/ b o o t \/ i n d e x \. m i n \. a s s e t \. p h p \1/ g,
598- 'ABSPATH . WPINC . \'/js/dist/script-modules/boot/index.min.asset.php\''
599- ) ;
600- }
601- } ,
602- files : [ {
603- expand : true ,
604- cwd : 'gutenberg/build' ,
605- src : [
606- 'routes.php' ,
607- 'pages.php' ,
608- 'constants.php' ,
609- 'pages/**/*.php' ,
610- 'routes/**/*.php' ,
611- ] ,
612- dest : WORKING_DIR + 'wp-includes/build/' ,
613- } ] ,
614- } ,
615- 'gutenberg-modules' : {
616- files : [ {
617- expand : true ,
618- cwd : 'gutenberg/build/modules' ,
619- src : [ '**/*' , '!**/*.map' ] ,
620- dest : WORKING_DIR + 'wp-includes/js/dist/script-modules/' ,
621- } ] ,
622- } ,
623- 'gutenberg-styles' : {
624- files : [ {
625- expand : true ,
626- cwd : 'gutenberg/build/styles' ,
627- src : [ '**/*' , '!**/*.map' ] ,
628- dest : WORKING_DIR + 'wp-includes/css/dist/' ,
629- } ] ,
630- } ,
631- 'gutenberg-theme-json' : {
632- options : {
633- process : function ( content , srcpath ) {
634- // Replace the local schema URL with the canonical public URL for Core.
635- if ( path . basename ( srcpath ) === 'theme.json' ) {
636- return content . replace (
637- '"$schema": "../schemas/json/theme.json"' ,
638- '"$schema": "https://schemas.wp.org/trunk/theme.json"'
639- ) ;
640- }
641- return content ;
642- }
643- } ,
644- files : [
645- {
646- src : 'gutenberg/lib/theme.json' ,
647- dest : WORKING_DIR + 'wp-includes/theme.json' ,
648- } ,
649- {
650- src : 'gutenberg/lib/theme-i18n.json' ,
651- dest : WORKING_DIR + 'wp-includes/theme-i18n.json' ,
652- } ,
653- ] ,
654- } ,
655- 'gutenberg-icons' : {
656- options : {
657- process : function ( content , srcpath ) {
658- // Remove the 'gutenberg' text domain from _x() calls in manifest.php.
659- if ( path . basename ( srcpath ) === 'manifest.php' ) {
660- return content . replace (
661- / _ x \( \s * ( [ ^ , ] + ) , \s * ( [ ^ , ] + ) , \s * [ ' " ] g u t e n b e r g [ ' " ] \s * \) / g,
662- '_x( $1, $2 )'
663- ) ;
664- }
665- return content ;
666- }
667- } ,
668- files : [
669- {
670- src : 'gutenberg/packages/icons/src/manifest.php' ,
671- dest : WORKING_DIR + 'wp-includes/icons/manifest.php' ,
672- } ,
673- {
674- expand : true ,
675- cwd : 'gutenberg/packages/icons/src/library' ,
676- src : '*.svg' ,
677- dest : WORKING_DIR + 'wp-includes/icons/library/' ,
678- } ,
679- ] ,
680- } ,
591+ }
681592 } ,
682593 sass : {
683594 colors : {
@@ -1412,21 +1323,20 @@ module.exports = function(grunt) {
14121323 } ,
14131324 {
14141325 expand : true ,
1415- cwd : BUILD_DIR + 'wp-includes/js/dist/' ,
1416- src : [ '*.js' ] ,
1417- dest : BUILD_DIR + 'wp-includes/js/dist/' ,
1418- } ,
1419- {
1420- expand : true ,
1421- cwd : BUILD_DIR + 'wp-includes/js/dist/vendor/' ,
1422- src : [ '**/*.js' ] ,
1423- dest : BUILD_DIR + 'wp-includes/js/dist/vendor/' ,
1326+ flatten : true ,
1327+ src : [
1328+ BUILD_DIR + 'wp-includes/js/dist/block-editor.js' ,
1329+ BUILD_DIR + 'wp-includes/js/dist/commands.js' ,
1330+ ] ,
1331+ dest : BUILD_DIR + 'wp-includes/js/dist/'
14241332 } ,
14251333 {
14261334 expand : true ,
1427- cwd : BUILD_DIR + 'wp-includes/js/dist/script-modules/' ,
1428- src : [ '**/*.js' ] ,
1429- dest : BUILD_DIR + 'wp-includes/js/dist/script-modules/' ,
1335+ flatten : true ,
1336+ src : [
1337+ BUILD_DIR + 'wp-includes/js/dist/vendor/**/*.js'
1338+ ] ,
1339+ dest : BUILD_DIR + 'wp-includes/js/dist/vendor/'
14301340 }
14311341 ]
14321342 }
@@ -1565,38 +1475,45 @@ module.exports = function(grunt) {
15651475 } ) ;
15661476
15671477 // Gutenberg integration tasks.
1568- grunt . registerTask ( 'gutenberg:verify ' , 'Verifies the installed Gutenberg version matches the expected SHA .' , function ( ) {
1478+ grunt . registerTask ( 'gutenberg-checkout ' , 'Checks out the Gutenberg repository .' , function ( ) {
15691479 const done = this . async ( ) ;
15701480 grunt . util . spawn ( {
15711481 cmd : 'node' ,
1572- args : [ 'tools/gutenberg/utils .js' ] ,
1482+ args : [ 'tools/gutenberg/checkout-gutenberg .js' ] ,
15731483 opts : { stdio : 'inherit' }
15741484 } , function ( error ) {
15751485 done ( ! error ) ;
15761486 } ) ;
15771487 } ) ;
15781488
1579- grunt . registerTask ( 'gutenberg:download ' , 'Downloads the built Gutenberg artifact .' , function ( ) {
1489+ grunt . registerTask ( 'gutenberg-build ' , 'Builds the Gutenberg repository .' , function ( ) {
15801490 const done = this . async ( ) ;
1581- const args = [ 'tools/gutenberg/download.js' ] ;
1582- if ( grunt . option ( 'force' ) ) {
1583- args . push ( '--force' ) ;
1584- }
15851491 grunt . util . spawn ( {
15861492 cmd : 'node' ,
1587- args,
1493+ args : [ 'tools/gutenberg/build-gutenberg.js' ] ,
15881494 opts : { stdio : 'inherit' }
15891495 } , function ( error ) {
15901496 done ( ! error ) ;
15911497 } ) ;
15921498 } ) ;
15931499
1594- grunt . registerTask ( 'gutenberg: copy' , 'Copies Gutenberg JS packages and block assets to WordPress Core.' , function ( ) {
1500+ grunt . registerTask ( 'gutenberg- copy' , 'Copies Gutenberg build output to WordPress Core.' , function ( ) {
15951501 const done = this . async ( ) ;
15961502 const buildDir = grunt . option ( 'dev' ) ? 'src' : 'build' ;
15971503 grunt . util . spawn ( {
15981504 cmd : 'node' ,
1599- args : [ 'tools/gutenberg/copy.js' , `--build-dir=${ buildDir } ` ] ,
1505+ args : [ 'tools/gutenberg/copy-gutenberg-build.js' , `--build-dir=${ buildDir } ` ] ,
1506+ opts : { stdio : 'inherit' }
1507+ } , function ( error ) {
1508+ done ( ! error ) ;
1509+ } ) ;
1510+ } ) ;
1511+
1512+ grunt . registerTask ( 'gutenberg-sync' , 'Syncs Gutenberg checkout and build if ref has changed.' , function ( ) {
1513+ const done = this . async ( ) ;
1514+ grunt . util . spawn ( {
1515+ cmd : 'node' ,
1516+ args : [ 'tools/gutenberg/sync-gutenberg.js' ] ,
16001517 opts : { stdio : 'inherit' }
16011518 } , function ( error ) {
16021519 done ( ! error ) ;
@@ -2039,35 +1956,26 @@ module.exports = function(grunt) {
20391956 } ) ;
20401957 } ) ;
20411958
2042- grunt . registerTask ( 'build:gutenberg' , [
2043- 'copy:gutenberg-php' ,
2044- 'gutenberg:copy' ,
2045- 'copy:gutenberg-modules' ,
2046- 'copy:gutenberg-styles' ,
2047- 'copy:gutenberg-theme-json' ,
2048- 'copy:gutenberg-icons' ,
2049- ] ) ;
2050-
20511959 grunt . registerTask ( 'build' , function ( ) {
20521960 if ( grunt . option ( 'dev' ) ) {
20531961 grunt . task . run ( [
2054- 'gutenberg:verify' ,
20551962 'build:js' ,
20561963 'build:css' ,
20571964 'build:codemirror' ,
2058- 'build:gutenberg' ,
1965+ 'gutenberg-sync' ,
1966+ 'gutenberg-copy' ,
20591967 'copy-vendor-scripts' ,
20601968 'build:certificates'
20611969 ] ) ;
20621970 } else {
20631971 grunt . task . run ( [
2064- 'gutenberg:verify' ,
20651972 'build:certificates' ,
20661973 'build:files' ,
20671974 'build:js' ,
20681975 'build:css' ,
20691976 'build:codemirror' ,
2070- 'build:gutenberg' ,
1977+ 'gutenberg-sync' ,
1978+ 'gutenberg-copy' ,
20711979 'copy-vendor-scripts' ,
20721980 'replace:source-maps' ,
20731981 'verify:build'
0 commit comments