How to increase gulp task stack trace?

$ gulp patch [17:13:27] Requiring external module coffee-script/register [17:13:28] Using gulpfile ~/source/sem-campaign.js/gulpfile.coffee [17:13:28] Starting 'bump'... [17:13:28] Starting 'add'... [17:13:28] Bumped version to: 1.0.2 [17:13:28] Bumped version to: 1.0.2 [17:13:28] Finished 'bump' after 31 ms [17:13:28] [17:13:28] Finished 'add' after 30 ms [17:13:28] Starting 'commit'... [?] enter a commit msg, eg initial commit: initial commit [17:13:32] Finished 'commit' after 3.26 s [17:13:32] Starting 'patch'... no buddy [17:13:32] Finished 'patch' after 25 Ξs events.js:72 throw er; // Unhandled 'error' event ^ Error: Command failed: at ChildProcess.exithandler (child_process.js:648:15) at ChildProcess.emit (events.js:98:17) at maybeClose (child_process.js:756:16) at Socket.<anonymous> (child_process.js:969:11) at Socket.emit (events.js:95:17) 

It's hard for me to say where my gulp task fails and why. How to increase stack trace by default?

+6
source share
1 answer

Add comments and plumber:

  • Add this helper method:

    log = (msg) → console.log msg # you will receive vinyl files as pieces of transform = (file, cb) → # reading and changing the contents of the file # file.contents = new Buffer (String (file.contents) + 'some modified content ');

     # if there was some error, just pass as the first parameter here cb(null, file); 

    # returning the map will cause the conversion function # to be called for each of the pieces (files) that you receive. And when this thread # receives the "end" signal, it will also end. # # Also, you want to request event-stream elsewhere. return eventStream.map (conversion);

  • pipe thw log method between task steps:

    gulp.task 'myTask', → gulp.src myCss, base: myBase.pipe log "Got css files!" .pipe concat 'app.css'.pipe log "concated css !!"

it is written in coffeescript, you can include it in javascript here: http://js2coffee.org/

  1. create catch helper error method:

    catchError = (err) → plugins.util.beep () # ref ;

  2. add plugins to plugins:

    gulp.task 'myTask', → gulp.src myCss, base: myBase.pipe plugins.plumber errorHandler: catchError.pipe log "Got css files!" .pipe concat 'app.css'.pipe log "concated css !!"

Done! :)

Additional resources for verification: gulp-print gulp-debug

0
source

Source: https://habr.com/ru/post/976258/


All Articles