From 81182b52ef9a59dc157191d77e130fe166fb2adf Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Wed, 16 Jun 2021 22:56:32 +0000 Subject: [PATCH] Build/Test Tools: Ignore sourceMaps for non WordPress Core files. If a custom plugin or theme exists in the `build/wp-content` directory with a sourcemap, the build` script is currently returning a warning and failing. This improves the `verify:source-maps` task in Grunt to ignore directories and files that do not belong to WordPress Core. Props ryelle, afragen, johnbillion. Fixes #52689. git-svn-id: https://develop.svn.wordpress.org/trunk@51173 602fd350-edb4-49c9-b593-d223f7449a82 --- Gruntfile.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 4be458980b..a24e701e06 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -1546,8 +1546,14 @@ module.exports = function(grunt) { * @ticket 46218 */ grunt.registerTask( 'verify:source-maps', function() { - const path = `${ BUILD_DIR }**/*.js`; - const files = glob.sync( path ); + const files = buildFiles.reduce( ( acc, path ) => { + // Skip excluded paths and any path that isn't a file. + if ( '!' === path[0] || '**' !== path.substr( -2 ) ) { + return acc; + } + acc.push( ...glob.sync( `${ BUILD_DIR }/${ path }/*.js` ) ); + return acc; + }, [] ); assert( files.length > 0,