Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running tasks configured across multiple grunt.js files

I have a node app that includes multiple unpublished modules. My app's package.json includes a few git dependencies:

"module-a": "git+ssh://[email protected]:me/module-a.git",
"module-b": "git+ssh://[email protected]:me/module-b.git"    

and each of those have their own grunt config. Eg in node_modules/module-a/grunt.js:

module.exports = function(grunt) {

grunt.initConfig({
    lint: {
        files: ['server/**/*.js', 'test/**/*.js']
    },
    jshint: {
        options: require('./lint-ci')
    }
});

grunt.registerTask('default', 'lint');

};

(they also run tests, etc, but I'm keeping it simple here)

Is there a built-in way to do this with grunt? Note that I want to keep the dependent grunt.js files for convenience when I've only changed something within that dependency.

The only solutions I have found are

  • build up my main grunt.js programmatically (eg, iterating over my dependencies in package.json to build the lint and test config)
  • call grunt multiple times using --config node_modules/module-a/grunt.js

Neither seems ideal. Is there a better way?

like image 910
wachunga Avatar asked Feb 06 '13 04:02

wachunga


People also ask

Can we configure Grunt to run one or more tasks by default by defining a default task?

You can configure Grunt to run one or more tasks by default by defining a default task. In the following example, running grunt at the command line without specifying a task will run the uglify task.

Is Grunt deprecated?

grunt. util. _ is deprecated and we highly encourage you to npm install lodash and var _ = require('lodash') to use lodash .

When a task is run Grunt looks for its configuration under a?

When a task is run, Grunt looks for its configuration under a property of the same name. Multi-tasks can have multiple configurations, defined using arbitrarily named "targets." In the example below, the concat task has foo and bar targets, while the uglify task only has a bar target.

Which Grunt plugin is used to run predefined tasks when the watched file changes?

grunt-este-watchby Daniel SteigerwaldRun predefined tasks whenever watched file changes.


1 Answers

Just a thought but have you looked at grunt-hub?

https://github.com/shama/grunt-hub

like image 158
indieisaconcept Avatar answered Oct 20 '22 00:10

indieisaconcept