From e7039316d31e91da820025da3f2cd07bfbd2a3b6 Mon Sep 17 00:00:00 2001 From: John Dillick Date: Thu, 27 Apr 2023 09:38:34 -1000 Subject: [PATCH] Add generateParallel and generateSeries helpers for hooks. --- .core/gulp.tasks.js | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/.core/gulp.tasks.js b/.core/gulp.tasks.js index a3c71fa..1ee39d5 100644 --- a/.core/gulp.tasks.js +++ b/.core/gulp.tasks.js @@ -241,14 +241,28 @@ const reactium = (gulp, config, webpackConfig) => { .pipe(rename(assetPath)) .pipe(gulp.dest(config.dest.assets)); + const generateParallel = (arr = []) => { + return gulp.parallel( + ...arr.map(t => { + if (typeof t === 'string') { + return task(t); + } else if (Array.isArray(t)) { + return generateSeries(t); + } + }), + ); + }; + const generateSeries = (arr = []) => { - return arr.map(t => { - if (typeof t === 'string') { - return task(t); - } else if (Array.isArray(t)) { - return gulp.parallel(...t.map(task)); - } - }); + return gulp.series( + ...arr.map(t => { + if (typeof t === 'string') { + return task(t); + } else if (Array.isArray(t)) { + return generateParallel(t); + } + }), + ); }; const build = cfg => { @@ -268,7 +282,7 @@ const reactium = (gulp, config, webpackConfig) => { ReactiumGulp.Hook.runSync('build-series', series); - return gulp.series(...generateSeries(series)); + return generateSeries(series); }; const apidocs = done => { @@ -843,7 +857,7 @@ $color: map.set($color, "{{key}}", \${{{ key }}}); return series; }; - const styles = gulp.series(...generateSeries(getStyleSeries())); + const styles = generateSeries(getStyleSeries()); const compress = done => isDev