From f5f5eb60b3ca1ab82b985d0a46ebb7990ea7197e Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Fri, 24 Jun 2016 15:10:35 +0200 Subject: Improve monaco.d.ts generation task --- gulpfile.js | 40 ++++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 18 deletions(-) (limited to 'gulpfile.js') diff --git a/gulpfile.js b/gulpfile.js index 2c1cfd596f7..5f5835012aa 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -106,11 +106,6 @@ function watchTask(out, build) { function monacodtsTask(out, isWatch) { - var filesToWatchMap = {}; - monacodts.getFilesToWatch(out).forEach(function(filePath) { - filesToWatchMap[path.normalize(filePath)] = true; - }); - var timer = -1; var runSoon = function(howSoon) { @@ -144,23 +139,32 @@ function monacodtsTask(out, isWatch) { }; if (isWatch) { + + var filesToWatchMap = {}; + monacodts.getFilesToWatch(out).forEach(function(filePath) { + filesToWatchMap[path.normalize(filePath)] = true; + }); + watch('build/monaco/*').pipe(es.through(function() { - runSoon(500); + runSoon(5000); })); - } - var resultStream = es.through(function(data) { - var filePath = path.normalize(data.path); - if (isWatch && filesToWatchMap[filePath]) { - runSoon(5000); - } - this.emit('data', data); - }, function(end) { - runNow(); - this.emit('end'); - }); + return es.through(function(data) { + var filePath = path.normalize(data.path); + if (filesToWatchMap[filePath]) { + runSoon(5000); + } + this.emit('data', data); + }); + + } else { - return resultStream; + return es.through(null, function(end) { + runNow(); + this.emit('end'); + }); + + } } // Fast compile for development time -- cgit v1.2.3