From 96ca819770f5a8b730e54e9d3b86055a730358e2 Mon Sep 17 00:00:00 2001 From: Hakim El Hattab Date: Fri, 25 Oct 2024 09:57:14 +0200 Subject: [PATCH] fix gulp package #3693 --- gulpfile.js | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 13afe73235b..99baefcf1fa 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -1,3 +1,4 @@ +const fs = require('fs'); const pkg = require('./package.json') const glob = require('glob') const yargs = require('yargs') @@ -274,22 +275,23 @@ gulp.task('default', gulp.series(gulp.parallel('js', 'css', 'plugins'), 'test')) gulp.task('build', gulp.parallel('js', 'css', 'plugins')) -gulp.task('package', gulp.series(() => - - gulp.src( - [ - './index.html', - './dist/**', - './lib/**', - './images/**', - './plugin/**', - './**/*.md' - ], - { base: './' } - ) +gulp.task('package', gulp.series(async () => { + + let dirs = [ + './index.html', + './dist/**', + './plugin/**', + './*/*.md' + ]; + + if (fs.existsSync('./lib')) dirs.push('./lib/**'); + if (fs.existsSync('./images')) dirs.push('./images/**'); + if (fs.existsSync('./slides')) dirs.push('./slides/**'); + + return gulp.src( dirs, { base: './' } ) .pipe(zip('reveal-js-presentation.zip')).pipe(gulp.dest('./')) -)) +})) gulp.task('reload', () => gulp.src(['index.html']) .pipe(connect.reload()));