mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-02 14:07:04 +03:00
This version uses Rollup instead of WebPack.
Due to that the code is smaller and has changes to prevent Circular Dependencies
This commit is contained in:
parent
5e63ade9dd
commit
ad8fd8879b
49 changed files with 595 additions and 577 deletions
24
tasks/js.js
24
tasks/js.js
|
|
@ -16,7 +16,7 @@ const concat = require('gulp-concat-util'),
|
|||
const { config } = require('./config');
|
||||
const { del, getHead } = require('./common');
|
||||
|
||||
const { webpack } = require('./webpack');
|
||||
//const { rollupJS } = require('./rollup');
|
||||
|
||||
const jsClean = () => del(config.paths.staticJS + '/**/*.{js,map}');
|
||||
|
||||
|
|
@ -24,14 +24,28 @@ const jsClean = () => del(config.paths.staticJS + '/**/*.{js,map}');
|
|||
const jsBoot = () => {
|
||||
return gulp
|
||||
.src('dev/boot.js')
|
||||
.pipe(gulp.dest('snappymail/v/' + config.devVersion + '/static/js'));
|
||||
.pipe(gulp.dest(config.paths.staticJS));
|
||||
};
|
||||
|
||||
// ServiceWorker
|
||||
const jsServiceWorker = () => {
|
||||
return gulp
|
||||
.src('dev/serviceworker.js')
|
||||
.pipe(gulp.dest('snappymail/v/' + config.devVersion + '/static/js'));
|
||||
.pipe(gulp.dest(config.paths.staticJS));
|
||||
};
|
||||
|
||||
// OpenPGP
|
||||
const jsOpenPGP = () => {
|
||||
return gulp
|
||||
.src('node_modules/openpgp/dist/openpgp.min.js')
|
||||
.pipe(gulp.dest(config.paths.staticMinJS));
|
||||
};
|
||||
|
||||
// OpenPGP Worker
|
||||
const jsOpenPGPWorker = () => {
|
||||
return gulp
|
||||
.src('node_modules/openpgp/dist/openpgp.worker.min.js')
|
||||
.pipe(gulp.dest(config.paths.staticMinJS));
|
||||
};
|
||||
|
||||
// libs
|
||||
|
|
@ -114,8 +128,8 @@ const jsLint = () =>
|
|||
.pipe(eslint.failAfterError());
|
||||
|
||||
const jsState1 = gulp.series(jsLint);
|
||||
const jsState3 = gulp.parallel(jsBoot, jsServiceWorker, jsLibs, jsApp, jsAdmin);
|
||||
const jsState2 = gulp.series(jsClean, webpack, jsState3, jsMin);
|
||||
const jsState3 = gulp.parallel(jsBoot, jsServiceWorker, jsOpenPGP, jsOpenPGPWorker, jsLibs/*, jsApp, jsAdmin*/);
|
||||
const jsState2 = gulp.series(jsClean/*, rollupJS('app.js'), rollupJS('admin.js')*/, jsState3, jsMin);
|
||||
|
||||
exports.jsLint = jsLint;
|
||||
exports.js = gulp.parallel(jsState1, jsState2);
|
||||
|
|
|
|||
|
|
@ -1,30 +0,0 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under AGPL 3 */
|
||||
const webpack = require('webpack');
|
||||
const gutil = require('gulp-util');
|
||||
|
||||
const { config } = require('./config');
|
||||
|
||||
const webpackCfgBuilder = require('../webpack.config.builder.js');
|
||||
|
||||
const webpackError = (err) => {
|
||||
if (err) {
|
||||
gutil.log('[webpack]', '---');
|
||||
gutil.log('[webpack]', err.error ? err.error.toString() : '');
|
||||
gutil.log('[webpack]', err.message || '');
|
||||
gutil.log('[webpack]', '---');
|
||||
}
|
||||
};
|
||||
|
||||
const webpackCallback = (done) => (err, stats) => {
|
||||
if (err) {
|
||||
throw new gutil.PluginError('webpack', err);
|
||||
} else if (stats && stats.compilation && stats.compilation.errors && stats.compilation.errors[0]) {
|
||||
throw new gutil.PluginError('webpack', stats.compilation.errors[0]);
|
||||
}
|
||||
|
||||
done();
|
||||
};
|
||||
|
||||
exports.webpack = (done) => {
|
||||
webpack(webpackCfgBuilder(config.paths.staticJS, 'production'), webpackCallback(done));
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue