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 = {
5353 'Print a plaintext list of tasks for the loaded gulpfile.' ) ,
5454 } ,
5555 'tasks-json' : {
56- type : 'boolean ' ,
56+ type : 'string ' ,
5757 desc : chalk . gray (
5858 'Print the task dependency tree, ' +
5959 'in JSON format, for the loaded gulpfile.' ) ,
Original file line number Diff line number Diff line change 11'use strict' ;
22
3+ var fs = require ( 'fs' ) ;
4+
35var chalk = require ( 'chalk' ) ;
46var gutil = require ( 'gulp-util' ) ;
57var tildify = require ( 'tildify' ) ;
@@ -35,9 +37,12 @@ function execute(opts, env) {
3537 } ) ;
3638 }
3739 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+ }
4146 }
4247 try {
4348 gutil . log ( 'Using gulpfile' , chalk . magenta ( tildify ( env . configPath ) ) ) ;
You can’t perform that action at this time.
0 commit comments