Skip to content

Commit

Permalink
Build/Test Tools: Remove matchdep as a dependency.
Browse files Browse the repository at this point in the history
`matchdep` was introduced in [25243] to more easily manage `grunt-*` dependencies. The package has effectively been abandoned upstream, and the functionality can be replaced with a simple loop.

Props desrosj, spacedmonkey, swissspidy.
See #62221.

git-svn-id: https://develop.svn.wordpress.org/trunk@59797 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
desrosj committed Feb 10, 2025
1 parent 78bcb74 commit b93ecb8
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 127 deletions.
40 changes: 37 additions & 3 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,46 @@ module.exports = function(grunt) {
// First do `npm install` if package.json has changed.
installChanged.watchPackage();

// Load tasks.
require('matchdep').filterDev(['grunt-*', '!grunt-legacy-util']).forEach( grunt.loadNpmTasks );

// Load legacy utils.
grunt.util = require('grunt-legacy-util');

var gruntDependencies = {
'contrib': [
'clean',
'concat',
'copy',
'cssmin',
'jshint',
'qunit',
'uglify',
'watch'
],
'standard': [
'banner',
'file-append',
'jsdoc',
'patch-wordpress',
'replace-lts',
'rtlcss',
'sass',
'webpack'
]
};

// Load grunt-* tasks.
function loadGruntTasks( dependency ) {
var contrib = key === 'contrib' ? 'contrib-' : '';
grunt.loadNpmTasks( 'grunt-' + contrib + dependency );
}

for ( var key in gruntDependencies ) {
if ( ! gruntDependencies.hasOwnProperty( key ) ) {
continue;
}

gruntDependencies[key].forEach( loadGruntTasks );
}

// Load PostCSS tasks.
grunt.loadNpmTasks('@lodder/grunt-postcss');

Expand Down
123 changes: 0 additions & 123 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@
"grunt-webpack": "7.0.0",
"ink-docstrap": "1.3.2",
"install-changed": "1.1.0",
"matchdep": "~2.0.0",
"postcss": "8.4.49",
"prettier": "npm:wp-prettier@2.6.2",
"qunit": "~2.23.1",
Expand Down

0 comments on commit b93ecb8

Please sign in to comment.