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
This commit is contained in:
Jonathan Desrosiers 2021-06-16 22:56:32 +00:00
parent 52e65717f9
commit 81182b52ef

View File

@ -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,