module.exports = function(grunt) { // Please see the Grunt documentation for more information regarding task // creation: http://gruntjs.com/creating-tasks grunt.registerTask('pinedev', 'The best Grunt plugin ever.', function() { var main = grunt.file.readJSON('./package.json'); grunt.log.writeln('main',main.dependencies) grunt.file.expand('node_modules/*/package.json') .map(function(filepath) { return grunt.file.readJSON(filepath); }) .filter(function(pkg) { return (pkg.keywords && pkg.keywords.indexOf('pine') >= 0) }) .forEach(function(pkg) { main.dependencies[pkg.name] = '~' + pkg.version }, {}); grunt.log.writeln('main',main.dependencies) }); }