cloudchen / grunt-template-jasmine-requirejs

RequireJS template for grunt-contrib-jasmine task
111 stars 96 forks source link

Issue with matchdep #59

Closed scottsword closed 10 years ago

scottsword commented 10 years ago

Since the plugin is titled "grunt-template-jasmine-requirejs" any time that you are using matchdep to load your grunt tasks you get the following error: ">> Local Npm module "grunt-template-jasmine-requirejs" not found. Is it installed?".

The typical use case for loading grunt plugins with matchdep is: require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);

To be clear grunt-template-jasmine-requirejs is a grunt plugin helper, not an actual grunt plugin. The naming convention conveys the message that this is a normal grunt plugin. This is causing some hacky work arounds when using matchdep, but could be resolved if the project name was changed to any of the following: gruntTemplate-jasmine-requirejs jasmine-requirejs-shim jasmine-requirejs

jsoverson commented 10 years ago

to be clear, matchdep is used to get dependencies that match a pattern. Using it to broadly include modules based off of wildcards is a bit hacky itself.

I use it sometimes too, but I don't expect module maintainers to support changing the names of things to support that method of loading. The keyword 'gruntplugin' is what is used to denote grunt tasks, the grunt-* naming convention is for things related to grunt. If you happened to include grunt-cli or grunt-lib-phantomjs you'd run into the same issue.

matchdep.filterDev('grunt-*')
  .filter(function(module){return !module.match('grunt-template-.*')})

seems perfectly appropriate and in line with how it should be used.