File tree Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -53,7 +53,7 @@ module.exports = {
53
53
'Print a plaintext list of tasks for the loaded gulpfile.' ) ,
54
54
} ,
55
55
'tasks-json' : {
56
- type : 'boolean ' ,
56
+ type : 'string ' ,
57
57
desc : chalk . gray (
58
58
'Print the task dependency tree, ' +
59
59
'in JSON format, for the loaded gulpfile.' ) ,
Original file line number Diff line number Diff line change 1
1
'use strict' ;
2
2
3
+ var fs = require ( 'fs' ) ;
4
+
3
5
var chalk = require ( 'chalk' ) ;
4
6
var gutil = require ( 'gulp-util' ) ;
5
7
var tildify = require ( 'tildify' ) ;
@@ -35,9 +37,12 @@ function execute(opts, env) {
35
37
} ) ;
36
38
}
37
39
if ( opts . tasksJson ) {
38
- return console . log (
39
- JSON . stringify ( gulpInst . tree ( { deep : true } ) , null , 2 )
40
- ) ;
40
+ var output = JSON . stringify ( gulpInst . tree ( { deep : true } ) ) ;
41
+ if ( typeof opts . tasksJson === 'boolean' && opts . tasksJson ) {
42
+ return console . log ( output ) ;
43
+ } else {
44
+ return fs . writeFileSync ( opts . tasksJson , output , 'utf-8' ) ;
45
+ }
41
46
}
42
47
try {
43
48
gutil . log ( 'Using gulpfile' , chalk . magenta ( tildify ( env . configPath ) ) ) ;
You can’t perform that action at this time.
0 commit comments