Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Make gulp tasks parallel #2233

Merged
merged 1 commit into from
Mar 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
"github": "^9.2.0",
"gulp": "^4.0.2",
"gulp-babel": "^6.1.2",
"gulp-clean": "^0.4.0",
"gulp-concat": "^2.6.1",
"gulp-htmlmin": "^5.0.1",
"gulp-iife": "^0.3.0",
Expand Down
137 changes: 50 additions & 87 deletions src/backend/gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,84 +15,55 @@ var exports = module.exports = {};
exports.minifyJs = function(path, cb) {
const dir = path + '/js/';

gulp.task('scheduleJs', function() {
return gulp.src([dir + 'FileSaver.js', dir + 'social.js', dir + 'scroll.js', dir + 'navbar.js', dir + 'calendar.js', dir + 'popover.js', dir + 'html2canvas.js', dir + 'jquery.lazyload.js', dir + 'icsGen.js'], {allowEmpty: true})
function minifyPipeline(dist, src) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codacy Issue found: Missing JSDoc comment.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return gulp.src(src.map(file => dir + file))
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.pipe(iife({useStrict: false}))
.pipe(concat('schedule.min.js'))
.pipe(concat(dist + '.min.js'))
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.pipe(babel({presets: ['es2015']}))
.pipe(uglify().on('error', function(e) {
console.log('Error while compiling schedule.js' + e);
console.log(`Error while compiling ${dist}.js` + e);
}))
.pipe(gulp.dest(path + '/js/'));
});
}

gulp.task('tracksJs', function() {
return gulp.src([dir + 'social.js', dir + 'scroll.js', dir + 'navbar.js', dir + 'jquery.lazyload.js'])
.pipe(iife({useStrict: false}))
.pipe(concat('tracks.min.js'))
.pipe(babel({presets: ['es2015']}))
.pipe(uglify().on('error', function(e) {
console.log('Error while compiling tracks.js' + e);
}))
.pipe(gulp.dest(path + '/js/'));
});
function scheduleJs() {
return minifyPipeline('schedule', [
'FileSaver.js',
'social.js',
'scroll.js',
'navbar.js',
'popover.js',
'html2canvas.js',
'jquery.lazyload.js',
'icsGen.js'
])
}

gulp.task('eventJs', function() {
return gulp.src([dir + 'map.js', dir + 'scroll.js', dir + 'navbar.js', dir + 'popover.js', dir + 'loklak-fetcher.js', dir + 'tweets.js', dir + 'jquery.lazyload.js'])
.pipe(iife({useStrict: false}))
.pipe(concat('event.min.js'))
.pipe(babel({presets: ['es2015']}))
.pipe(uglify().on('error', function(e) {
console.log('Error while compiling event.js' + e);
}))
.pipe(gulp.dest(path + '/js/'));
});
function tracksJs() {
return minifyPipeline('tracks', ['social.js', 'scroll.js', 'navbar.js', 'jquery.lazyload.js']);
}

function eventJs() {
return minifyPipeline('event', ['map.js', 'scroll.js', 'navbar.js', 'popover.js', 'loklak-fetcher.js', 'tweets.js', 'jquery.lazyload.js']);
}

gulp.task('roomsJs', function() {
return gulp.src([dir + 'social.js', dir + 'scroll.js', dir + 'navbar.js', dir + 'jquery.lazyload.js'])
.pipe(iife({useStrict: false}))
.pipe(concat('rooms.min.js'))
.pipe(babel({presets: ['es2015']}))
.pipe(uglify().on('error', function(e) {
console.log('Error while compiling rooms.js' + e);
}))
.pipe(gulp.dest(path + '/js/'));
});
function roomsJs() {
return minifyPipeline('rooms', ['social.js', 'scroll.js', 'navbar.js', 'jquery.lazyload.js']);
}

gulp.task('speakersJs', function() {
console.log('>>> Generating speakers.js')
return gulp.src([dir + 'social.js', dir + 'scroll.js', dir + 'navbar.js', dir + 'popover.js', dir + 'jquery.lazyload.js'])
.pipe(iife({useStrict: false}))
.pipe(concat('speakers.min.js'))
.pipe(babel({presets: ['es2015']}))
.pipe(uglify().on('error', function(e) {
console.log('Error while compiling speakers.js' + e);
}))
.pipe(gulp.dest(path + '/js/'));
});
function speakersJs() {
return minifyPipeline('speakers', ['social.js', 'scroll.js', 'navbar.js', 'popover.js', 'jquery.lazyload.js']);
}

gulp.task('sessionJs', function() {
return gulp.src([dir + 'session.js', dir + 'social.js'])
.pipe(iife({useStrict: false}))
.pipe(concat('session.min.js'))
.pipe(babel({presets: ['es2015']}))
.pipe(uglify().on('error', function(e) {
console.log('Error while compiling session.js' + e);
}))
.pipe(gulp.dest(path + '/js/'));
});
gulp.task('mainJs', function() {
return gulp.src([dir + 'main.js'])
.pipe(iife({useStrict: false}))
.pipe(concat('main.min.js'))
.pipe(babel({presets: ['es2015']}))
.pipe(uglify().on('error', function(e) {
console.log('Error while compiling main.js' + e);
}))
.pipe(gulp.dest(path + '/js/'));
});
function sessionJs() {
return minifyPipeline('session', ['session.js', 'social.js']);
}

function mainJs() {
return minifyPipeline('main', ['main.js']);
}

gulp.task('minifyJs', gulp.series('speakersJs', 'roomsJs', 'scheduleJs', 'eventJs', 'tracksJs', 'sessionJs', 'mainJs', async function() {
gulp.task('minifyJs', gulp.series(gulp.parallel(speakersJs, roomsJs, scheduleJs, eventJs, tracksJs, sessionJs, mainJs), async function() {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Parsing error: Unexpected token function

await del([dir + '*.js', '!' + dir + '*.min.js']);
cb();
}));
Expand All @@ -101,27 +72,19 @@ exports.minifyJs = function(path, cb) {
};

exports.minifyCss = function(path, cb) {
gulp.task('minifyCss', function() {
// Minify all the css files of the web-app
return gulp.src(path + '/css/*.css')
.pipe(minify())
.pipe(gulp.dest(path + '/css')).on('end', function() {
cb();
});
});

gulp.series('minifyCss')();
// Minify all the css files of the web-app
return gulp.src(path + '/css/*.css')
.pipe(minify())
.pipe(gulp.dest(path + '/css')).on('end', function() {
cb();
});
};

exports.minifyHtml = function(path, cb) {
gulp.task('minifyHtml', function() {
// Minify all the html files of the web-app
return gulp.src(path + '/*.html')
.pipe(htmlmin({collapseWhitespace: true}))
.pipe(gulp.dest(path)).on('end', function() {
cb();
});
});

gulp.series('minifyHtml')();
// Minify all the html files of the web-app
return gulp.src(path + '/*.html')
.pipe(htmlmin({collapseWhitespace: true}))
.pipe(gulp.dest(path)).on('end', function() {
cb();
});
};
68 changes: 1 addition & 67 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -192,13 +192,6 @@ ansi-colors@^1.0.1:
dependencies:
ansi-wrap "^0.1.0"

ansi-cyan@^0.1.1:
version "0.1.1"
resolved "https://registry.yarnpkg.com/ansi-cyan/-/ansi-cyan-0.1.1.tgz#538ae528af8982f28ae30d86f2f17456d2609873"
integrity sha1-U4rlKK+JgvKK4w2G8vF0VtJgmHM=
dependencies:
ansi-wrap "0.1.0"

ansi-escapes@^4.2.1:
version "4.3.1"
resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-4.3.1.tgz#a5c47cc43181f1f38ffd7076837700d395522a61"
Expand All @@ -213,13 +206,6 @@ ansi-gray@^0.1.1:
dependencies:
ansi-wrap "0.1.0"

ansi-red@^0.1.1:
version "0.1.1"
resolved "https://registry.yarnpkg.com/ansi-red/-/ansi-red-0.1.1.tgz#8c638f9d1080800a353c9c28c8a81ca4705d946c"
integrity sha1-jGOPnRCAgAo1PJwoyKgcpHBdlGw=
dependencies:
ansi-wrap "0.1.0"

ansi-regex@^2.0.0:
version "2.1.1"
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df"
Expand Down Expand Up @@ -349,14 +335,6 @@ argparse@^1.0.7:
dependencies:
sprintf-js "~1.0.2"

arr-diff@^1.0.1:
version "1.1.0"
resolved "https://registry.yarnpkg.com/arr-diff/-/arr-diff-1.1.0.tgz#687c32758163588fef7de7b36fabe495eb1a399a"
integrity sha1-aHwydYFjWI/vfeezb6vklesaOZo=
dependencies:
arr-flatten "^1.0.1"
array-slice "^0.2.3"

arr-diff@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/arr-diff/-/arr-diff-4.0.0.tgz#d6461074febfec71e7e15235761a329a5dc7c520"
Expand All @@ -381,11 +359,6 @@ arr-map@^2.0.0, arr-map@^2.0.2:
dependencies:
make-iterator "^1.0.0"

arr-union@^2.0.1:
version "2.1.0"
resolved "https://registry.yarnpkg.com/arr-union/-/arr-union-2.1.0.tgz#20f9eab5ec70f5c7d215b1077b1c39161d292c7d"
integrity sha1-IPnqtexw9cfSFbEHexw5Fh0pLH0=

arr-union@^3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/arr-union/-/arr-union-3.1.0.tgz#e39b09aea9def866a8f206e288af63919bae39c4"
Expand Down Expand Up @@ -426,11 +399,6 @@ array-last@^1.1.1:
dependencies:
is-number "^4.0.0"

array-slice@^0.2.3:
version "0.2.3"
resolved "https://registry.yarnpkg.com/array-slice/-/array-slice-0.2.3.tgz#dd3cfb80ed7973a75117cdac69b0b99ec86186f5"
integrity sha1-3Tz7gO15c6dRF82sabC5nshhhvU=

array-slice@^1.0.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/array-slice/-/array-slice-1.1.0.tgz#e368ea15f89bc7069f7ffb89aec3a6c7d4ac22d4"
Expand Down Expand Up @@ -2772,13 +2740,6 @@ ext@^1.1.2:
dependencies:
type "^2.0.0"

extend-shallow@^1.1.2:
version "1.1.4"
resolved "https://registry.yarnpkg.com/extend-shallow/-/extend-shallow-1.1.4.tgz#19d6bf94dfc09d76ba711f39b872d21ff4dd9071"
integrity sha1-Gda/lN/AnXa6cR85uHLSH/TdkHE=
dependencies:
kind-of "^1.1.0"

extend-shallow@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/extend-shallow/-/extend-shallow-2.0.1.tgz#51af7d614ad9a9f610ea1bafbb989d6b1c56890f"
Expand Down Expand Up @@ -3455,17 +3416,6 @@ gulp-babel@^6.1.2:
through2 "^2.0.0"
vinyl-sourcemaps-apply "^0.2.0"

gulp-clean@^0.4.0:
version "0.4.0"
resolved "https://registry.yarnpkg.com/gulp-clean/-/gulp-clean-0.4.0.tgz#3bc25e7084e641bbd7bde057cf90c01c50d95950"
integrity sha512-DARK8rNMo4lHOFLGTiHEJdf19GuoBDHqGUaypz+fOhrvOs3iFO7ntdYtdpNxv+AzSJBx/JfypF0yEj9ks1IStQ==
dependencies:
fancy-log "^1.3.2"
plugin-error "^0.1.2"
rimraf "^2.6.2"
through2 "^2.0.3"
vinyl "^2.1.0"

gulp-cli@^2.2.0:
version "2.2.0"
resolved "https://registry.yarnpkg.com/gulp-cli/-/gulp-cli-2.2.0.tgz#5533126eeb7fe415a7e3e84a297d334d5cf70ebc"
Expand Down Expand Up @@ -4472,11 +4422,6 @@ just-debounce@^1.0.0:
resolved "https://registry.yarnpkg.com/just-debounce/-/just-debounce-1.0.0.tgz#87fccfaeffc0b68cd19d55f6722943f929ea35ea"
integrity sha1-h/zPrv/AtozRnVX2cilD+SnqNeo=

kind-of@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-1.1.0.tgz#140a3d2d41a36d2efcfa9377b62c24f8495a5c44"
integrity sha1-FAo9LUGjbS78+pN3tiwk+ElaXEQ=

kind-of@^3.0.2, kind-of@^3.0.3, kind-of@^3.2.0:
version "3.2.2"
resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-3.2.2.tgz#31ea21a734bab9bbb0f32466d893aea51e4a3c64"
Expand Down Expand Up @@ -6374,17 +6319,6 @@ pinkie@^2.0.0:
resolved "https://registry.yarnpkg.com/pinkie/-/pinkie-2.0.4.tgz#72556b80cfa0d48a974e80e77248e80ed4f7f870"
integrity sha1-clVrgM+g1IqXToDnckjoDtT3+HA=

plugin-error@^0.1.2:
version "0.1.2"
resolved "https://registry.yarnpkg.com/plugin-error/-/plugin-error-0.1.2.tgz#3b9bb3335ccf00f425e07437e19276967da47ace"
integrity sha1-O5uzM1zPAPQl4HQ34ZJ2ln2kes4=
dependencies:
ansi-cyan "^0.1.1"
ansi-red "^0.1.1"
arr-diff "^1.0.1"
arr-union "^2.0.1"
extend-shallow "^1.1.2"

plugin-error@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/plugin-error/-/plugin-error-1.0.1.tgz#77016bd8919d0ac377fdcdd0322328953ca5781c"
Expand Down Expand Up @@ -8512,7 +8446,7 @@ vinyl@^0.5.0:
clone-stats "^0.0.1"
replace-ext "0.0.1"

vinyl@^2.0.0, vinyl@^2.1.0:
vinyl@^2.0.0:
version "2.2.0"
resolved "https://registry.yarnpkg.com/vinyl/-/vinyl-2.2.0.tgz#d85b07da96e458d25b2ffe19fece9f2caa13ed86"
integrity sha512-MBH+yP0kC/GQ5GwBqrTPTzEfiiLjta7hTtvQtbxBgTeSXsmKQRQecjibMbxIXzVT3Y9KJK+drOz1/k+vsu8Nkg==
Expand Down