|
9 | 9 | require('events').EventEmitter.defaultMaxListeners = 100; |
10 | 10 |
|
11 | 11 | const gulp = require('gulp'); |
| 12 | +// Record all defined tasks to determine later in this file (at the bottom) |
| 13 | +// if further gulpfiles need to be included or not |
| 14 | +var ALL_KNOWN_TASKS = [], originalGulpTask = gulp.task; |
| 15 | +gulp.task = function() { |
| 16 | + ALL_KNOWN_TASKS.push(arguments[0]); |
| 17 | + return originalGulpTask.apply(gulp, Array.prototype.slice.call(arguments, 0)); |
| 18 | +}; |
| 19 | + |
12 | 20 | const json = require('gulp-json-editor'); |
13 | 21 | const buffer = require('gulp-buffer'); |
14 | 22 | const tsb = require('gulp-tsb'); |
@@ -258,22 +266,13 @@ gulp.task('mixin', function () { |
258 | 266 | .pipe(gulp.dest('.')); |
259 | 267 | }); |
260 | 268 |
|
261 | | -var ALL_EDITOR_TASKS = [ |
262 | | - 'clean-optimized-editor', |
263 | | - 'optimize-editor', |
264 | | - 'clean-minified-editor', |
265 | | - 'minify-editor', |
266 | | - 'clean-editor-distro', |
267 | | - 'editor-distro', |
268 | | - 'analyze-editor-distro' |
269 | | -]; |
270 | | -var runningEditorTasks = process.argv.slice(2).every(function(arg) { |
271 | | - return (ALL_EDITOR_TASKS.indexOf(arg) !== -1); |
| 269 | +require(`./build/gulpfile.editor`); |
| 270 | + |
| 271 | +var runningKnownTasks = process.argv.slice(2).every(function(arg) { |
| 272 | + return (ALL_KNOWN_TASKS.indexOf(arg) !== -1); |
272 | 273 | }); |
273 | 274 |
|
274 | | -if (runningEditorTasks) { |
275 | | - require(`./build/gulpfile.editor`); |
276 | | -} else { |
| 275 | +if (!runningKnownTasks) { |
277 | 276 | // Load all the gulpfiles only if running tasks other than the editor tasks |
278 | 277 | const build = path.join(__dirname, 'build'); |
279 | 278 | glob.sync('gulpfile.*.js', { cwd: build }) |
|
0 commit comments