Skip to content

Commit b93ecb8

Browse files
committed
Build/Test Tools: Remove matchdep as a dependency.
`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
1 parent 78bcb74 commit b93ecb8

File tree

3 files changed

+37
-127
lines changed

3 files changed

+37
-127
lines changed

Gruntfile.js

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,46 @@ module.exports = function(grunt) {
8383
// First do `npm install` if package.json has changed.
8484
installChanged.watchPackage();
8585

86-
// Load tasks.
87-
require('matchdep').filterDev(['grunt-*', '!grunt-legacy-util']).forEach( grunt.loadNpmTasks );
88-
8986
// Load legacy utils.
9087
grunt.util = require('grunt-legacy-util');
9188

89+
var gruntDependencies = {
90+
'contrib': [
91+
'clean',
92+
'concat',
93+
'copy',
94+
'cssmin',
95+
'jshint',
96+
'qunit',
97+
'uglify',
98+
'watch'
99+
],
100+
'standard': [
101+
'banner',
102+
'file-append',
103+
'jsdoc',
104+
'patch-wordpress',
105+
'replace-lts',
106+
'rtlcss',
107+
'sass',
108+
'webpack'
109+
]
110+
};
111+
112+
// Load grunt-* tasks.
113+
function loadGruntTasks( dependency ) {
114+
var contrib = key === 'contrib' ? 'contrib-' : '';
115+
grunt.loadNpmTasks( 'grunt-' + contrib + dependency );
116+
}
117+
118+
for ( var key in gruntDependencies ) {
119+
if ( ! gruntDependencies.hasOwnProperty( key ) ) {
120+
continue;
121+
}
122+
123+
gruntDependencies[key].forEach( loadGruntTasks );
124+
}
125+
92126
// Load PostCSS tasks.
93127
grunt.loadNpmTasks('@lodder/grunt-postcss');
94128

package-lock.json

Lines changed: 0 additions & 123 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@
6161
"grunt-webpack": "7.0.0",
6262
"ink-docstrap": "1.3.2",
6363
"install-changed": "1.1.0",
64-
"matchdep": "~2.0.0",
6564
"postcss": "8.4.49",
6665
"prettier": "npm:[email protected]",
6766
"qunit": "~2.23.1",

0 commit comments

Comments
 (0)