grunt-subgrunt
Advanced tools
Comparing version 0.2.1 to 0.2.2
@@ -0,4 +1,8 @@ | ||
### v0.2.2 [view commit logs](https://github.com/tusbar/grunt-subgrunt/compare/v0.2.1...v0.2.2) | ||
* Add `npmClean` option to remove development dependencies after running the grunt tasks (requires npm >= 1.3.10) | ||
### v0.2.1 [view commit logs](https://github.com/tusbar/grunt-subgrunt/compare/v0.2.0...v0.2.1) | ||
* Propagate grunt option flags to the sub-pojects | ||
* Propagate grunt option flags to the sub-projects | ||
@@ -5,0 +9,0 @@ ### v0.2.0 [view commit logs](https://github.com/tusbar/grunt-subgrunt/compare/v0.1.1...v0.2.0) |
{ | ||
"name": "grunt-subgrunt", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"description": "Run sub-projects' grunt tasks.", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -56,2 +56,9 @@ # grunt-subgrunt [![Build Status](https://secure.travis-ci.org/tusbar/grunt-subgrunt.png?branch=master)](https://travis-ci.org/tusbar/grunt-subgrunt) | ||
#### options.npmClean | ||
Type: `bool` | ||
Default value: `false` | ||
*Requires npm >= 1.3.10* | ||
When enabled, runs `npm prune --production` to clean development dependencies. | ||
#### options.npmPath | ||
@@ -97,2 +104,11 @@ Type: `string` | ||
} | ||
}, | ||
target5: { | ||
// The npm devDependencies will be cleaned out after running the grunt tasks. | ||
options: { | ||
npmClean: true | ||
}, | ||
projects: { | ||
'node_modules/module1': [ 'preprocess', 'build' ] | ||
} | ||
} | ||
@@ -99,0 +115,0 @@ } |
@@ -28,2 +28,25 @@ 'use strict'; | ||
var runNpmClean = function (path, options, next) { | ||
// Requires npm >= 1.3.10! | ||
grunt.util.spawn({ | ||
cmd: options.npmPath, | ||
args: [ 'prune', '--production' ], | ||
opts: { cwd: path } | ||
}, function (err, result, code) { | ||
if (err || code > 0) { | ||
grunt.log.error('Failed cleaning development dependencies in "' + path + '".'); | ||
grunt.warn('\n' + lpad(result.stderr || result.stdout, ' ! '.yellow) + '\n>>'.yellow); | ||
} | ||
else { | ||
grunt.log.ok('Cleaned development dependencies in "' + path + '".'); | ||
if (result.stdout) { | ||
grunt.log.writeln(lpad(result.stdout, ' | ')); | ||
} | ||
} | ||
next(); | ||
}); | ||
}; | ||
var runGruntTasks = function (path, tasks, options, next) { | ||
@@ -56,2 +79,3 @@ var args = grunt.option.flags().concat(tasks); | ||
npmInstall: true, | ||
npmClean: false, | ||
npmPath: 'npm' | ||
@@ -83,3 +107,5 @@ }); | ||
runNpmInstall(path, options, function () { | ||
runGruntTasks(path, tasks, options, next); | ||
runGruntTasks(path, tasks, options, options.npmClean ? function () { | ||
runNpmClean(path, options, next); | ||
} : next); | ||
}); | ||
@@ -86,0 +112,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9636
118
122