mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
update gulp and gulpfile
This commit is contained in:
parent
a1562e7145
commit
b244462fa5
19 changed files with 1570 additions and 1044 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
FROM node:10.16.0-alpine
|
FROM node:10.16.0-alpine
|
||||||
|
|
||||||
RUN apk add --no-cache git
|
RUN apk add --no-cache git
|
||||||
RUN yarn global add gulp@3.9.1
|
RUN yarn global add gulp
|
||||||
|
|
||||||
CMD ["node", "--version"]
|
CMD ["node", "--version"]
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,3 @@
|
||||||
|
|
||||||
/* global RL_COMMUNITY */
|
|
||||||
|
|
||||||
import window from 'window';
|
import window from 'window';
|
||||||
import _ from '_';
|
import _ from '_';
|
||||||
import $ from '$';
|
import $ from '$';
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,3 @@
|
||||||
|
|
||||||
/* global RL_COMMUNITY */
|
|
||||||
|
|
||||||
import {addSettingsViewModel} from 'Knoin/Knoin';
|
import {addSettingsViewModel} from 'Knoin/Knoin';
|
||||||
import {runSettingsViewModelHooks} from 'Common/Plugins';
|
import {runSettingsViewModelHooks} from 'Common/Plugins';
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,3 @@
|
||||||
|
|
||||||
/* global RL_COMMUNITY */
|
|
||||||
|
|
||||||
import ko from 'ko';
|
import ko from 'ko';
|
||||||
|
|
||||||
import {i18n, trigger as translatorTrigger} from 'Common/Translator';
|
import {i18n, trigger as translatorTrigger} from 'Common/Translator';
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,4 @@
|
||||||
|
|
||||||
/* global RL_COMMUNITY */
|
|
||||||
|
|
||||||
import _ from '_';
|
import _ from '_';
|
||||||
import ko from 'ko';
|
import ko from 'ko';
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,3 @@
|
||||||
|
|
||||||
/* global RL_COMMUNITY */
|
|
||||||
|
|
||||||
import _ from '_';
|
import _ from '_';
|
||||||
import ko from 'ko';
|
import ko from 'ko';
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,4 @@
|
||||||
|
|
||||||
/* global RL_COMMUNITY */
|
|
||||||
|
|
||||||
import ko from 'ko';
|
import ko from 'ko';
|
||||||
|
|
||||||
import * as Settings from 'Storage/Settings';
|
import * as Settings from 'Storage/Settings';
|
||||||
|
|
|
||||||
636
gulpfile.js
636
gulpfile.js
|
|
@ -1,626 +1,26 @@
|
||||||
/* RainLoop Webmail (c) RainLoop Team | Licensed under AGPL 3 */
|
/* RainLoop Webmail (c) RainLoop Team | Licensed under AGPL 3 */
|
||||||
/* eslint-disable */
|
const gulp = require('gulp');
|
||||||
'use strict';
|
|
||||||
|
|
||||||
var
|
const {cleanStatic} = require('./tasks/common');
|
||||||
pkg = require('./package.json'),
|
const {assets} = require('./tasks/assets');
|
||||||
head = {
|
const {js, jsLint} = require('./tasks/js');
|
||||||
rainloop: '/* RainLoop Webmail (c) RainLoop Team | Licensed under RainLoop Software License */',
|
const {css, cssLint} = require('./tasks/css');
|
||||||
agpl: '/* RainLoop Webmail (c) RainLoop Team | Licensed under AGPL v3 */'
|
const {vendors} = require('./tasks/vendors');
|
||||||
},
|
const {rainloop} = require('./tasks/rainloop');
|
||||||
cfg = {
|
const {owncloud} = require('./tasks/owncloud');
|
||||||
devVersion: '0.0.0',
|
|
||||||
releasesPath: 'build/dist/releases',
|
|
||||||
community: true,
|
|
||||||
watch: false,
|
|
||||||
watchInterval: 1000,
|
|
||||||
googleCompile: false,
|
|
||||||
|
|
||||||
rainloopBuilded: false,
|
const clean = gulp.series(cleanStatic);
|
||||||
destPath: '',
|
|
||||||
cleanPath: '',
|
|
||||||
zipSrcPath: '',
|
|
||||||
zipFile: '',
|
|
||||||
zipFileShort: '',
|
|
||||||
|
|
||||||
paths: {}
|
const lint = gulp.parallel(jsLint, cssLint);
|
||||||
},
|
|
||||||
|
|
||||||
_ = require('lodash'),
|
const buildState1 = gulp.parallel(js, css, vendors);
|
||||||
fs = require('node-fs'),
|
const buildState2 = gulp.series(clean, assets, buildState1);
|
||||||
path = require('path'),
|
|
||||||
notifier = require('node-notifier'),
|
|
||||||
runSequence = require('run-sequence'),
|
|
||||||
|
|
||||||
webpack = require('webpack'),
|
const build = gulp.parallel(lint, buildState2);
|
||||||
webpackCfgBuilder = require('./webpack.config.builder.js'),
|
|
||||||
|
|
||||||
argv = require('yargs').argv,
|
exports.lint = lint;
|
||||||
|
exports.build = build;
|
||||||
|
|
||||||
gulp = require('gulp'),
|
exports.rainloop = gulp.series(build, rainloop);
|
||||||
concat = require('gulp-concat-util'),
|
exports.owncloud = gulp.series(build, owncloud);
|
||||||
header = require('gulp-header'),
|
exports.all = gulp.series(exports.rainloop, exports.owncloud);
|
||||||
stripbom = require('gulp-stripbom'),
|
|
||||||
rename = require('gulp-rename'),
|
|
||||||
replace = require('gulp-replace'),
|
|
||||||
uglify = require('gulp-uglify'),
|
|
||||||
plumber = require('gulp-plumber'),
|
|
||||||
gulpif = require('gulp-if'),
|
|
||||||
eol = require('gulp-eol'),
|
|
||||||
livereload = require('gulp-livereload'),
|
|
||||||
eslint = require('gulp-eslint'),
|
|
||||||
cache = require('gulp-cached'),
|
|
||||||
filter = require('gulp-filter'),
|
|
||||||
expect = require('gulp-expect-file'),
|
|
||||||
chmod = require('gulp-chmod'),
|
|
||||||
size = require('gulp-size'),
|
|
||||||
gutil = require('gulp-util');
|
|
||||||
|
|
||||||
cfg.community = !argv.pro;
|
|
||||||
|
|
||||||
// webpack
|
|
||||||
function webpackCallback(callback)
|
|
||||||
{
|
|
||||||
return function(err, stats) {
|
|
||||||
|
|
||||||
if (err)
|
|
||||||
{
|
|
||||||
if (cfg.watch)
|
|
||||||
{
|
|
||||||
webpackError(err);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
throw new gutil.PluginError('webpack', err);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (stats && stats.compilation && stats.compilation.errors && stats.compilation.errors[0])
|
|
||||||
{
|
|
||||||
if (cfg.watch)
|
|
||||||
{
|
|
||||||
_.each(stats.compilation.errors, webpackError);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
throw new gutil.PluginError('webpack', stats.compilation.errors[0]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
callback();
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function webpackError(err) {
|
|
||||||
if (err)
|
|
||||||
{
|
|
||||||
gutil.log('[webpack]', '---');
|
|
||||||
gutil.log('[webpack]', err.error ? err.error.toString() : '');
|
|
||||||
gutil.log('[webpack]', err.message || '');
|
|
||||||
gutil.log('[webpack]', '---');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function getHead()
|
|
||||||
{
|
|
||||||
return !cfg.community ? head.rainloop : head.agpl;
|
|
||||||
}
|
|
||||||
|
|
||||||
function zipDir(sSrcDir, sDestDir, sFileName)
|
|
||||||
{
|
|
||||||
return gulp.src(sSrcDir + '**/*')
|
|
||||||
.pipe(require('gulp-zip')(sFileName))
|
|
||||||
.pipe(gulp.dest(sDestDir));
|
|
||||||
}
|
|
||||||
|
|
||||||
function cleanDir(sDir)
|
|
||||||
{
|
|
||||||
return gulp.src(sDir, {read: false})
|
|
||||||
.pipe(require('gulp-rimraf')());
|
|
||||||
}
|
|
||||||
|
|
||||||
function copyFile(sFile, sNewFile, callback)
|
|
||||||
{
|
|
||||||
fs.writeFileSync(sNewFile, fs.readFileSync(sFile));
|
|
||||||
callback();
|
|
||||||
}
|
|
||||||
|
|
||||||
cfg.paths.globjs = 'dev/**/*.js';
|
|
||||||
cfg.paths.static = 'rainloop/v/' + cfg.devVersion + '/static/';
|
|
||||||
cfg.paths.staticJS = 'rainloop/v/' + cfg.devVersion + '/static/js/';
|
|
||||||
cfg.paths.staticMinJS = 'rainloop/v/' + cfg.devVersion + '/static/js/min/';
|
|
||||||
cfg.paths.staticCSS = 'rainloop/v/' + cfg.devVersion + '/static/css/';
|
|
||||||
cfg.paths.momentLocales = 'rainloop/v/' + cfg.devVersion + '/app/localization/moment/';
|
|
||||||
|
|
||||||
cfg.paths.assets = {
|
|
||||||
src: 'assets/**/*.*'
|
|
||||||
};
|
|
||||||
|
|
||||||
cfg.paths.less = {
|
|
||||||
main: {
|
|
||||||
src: 'dev/Styles/@Main.less',
|
|
||||||
watch: ['dev/Styles/*.less'],
|
|
||||||
options: {
|
|
||||||
paths: [
|
|
||||||
path.join(__dirname, 'dev', 'Styles'),
|
|
||||||
path.join(__dirname, 'vendors', 'bootstrap', 'less')
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
cfg.paths.css = {
|
|
||||||
main: {
|
|
||||||
name: 'app.css',
|
|
||||||
src: [
|
|
||||||
'node_modules/normalize.css/normalize.css',
|
|
||||||
'vendors/jquery-ui/css/smoothness/jquery-ui-1.10.3.custom.css',
|
|
||||||
'vendors/fontastic/styles.css',
|
|
||||||
'vendors/jquery-nanoscroller/nanoscroller.css',
|
|
||||||
'vendors/jquery-letterfx/jquery-letterfx.min.css',
|
|
||||||
'vendors/inputosaurus/inputosaurus.css',
|
|
||||||
'vendors/flags/flags-fixed.css',
|
|
||||||
'node_modules/opentip/css/opentip.css',
|
|
||||||
'node_modules/pikaday/css/pikaday.css',
|
|
||||||
'vendors/lightgallery/dist/css/lightgallery.min.css',
|
|
||||||
'vendors/lightgallery/dist/css/lg-transitions.min.css',
|
|
||||||
'vendors/Progress.js/minified/progressjs.min.css',
|
|
||||||
'dev/Styles/_progressjs.css'
|
|
||||||
]
|
|
||||||
},
|
|
||||||
social: {
|
|
||||||
name: 'social.css',
|
|
||||||
src: [
|
|
||||||
'vendors/fontastic/styles.css',
|
|
||||||
'dev/Styles/_social.css'
|
|
||||||
]
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
cfg.paths.js = {
|
|
||||||
moment: {
|
|
||||||
locales: [
|
|
||||||
'node_modules/moment/locale/*.js'
|
|
||||||
]
|
|
||||||
},
|
|
||||||
libs: {
|
|
||||||
name: 'libs.js',
|
|
||||||
src: [
|
|
||||||
'node_modules/jquery/dist/jquery.min.js',
|
|
||||||
'node_modules/jquery-migrate/dist/jquery-migrate.min.js',
|
|
||||||
'node_modules/jquery-mousewheel/jquery.mousewheel.js',
|
|
||||||
'node_modules/jquery-scrollstop/jquery.scrollstop.js',
|
|
||||||
'node_modules/jquery-backstretch/jquery.backstretch.min.js',
|
|
||||||
'vendors/jquery-ui/js/jquery-ui-1.10.3.custom.min.js', // custom
|
|
||||||
'vendors/jquery-nanoscroller/jquery.nanoscroller.js', // custom (modified)
|
|
||||||
'vendors/jquery-wakeup/jquery.wakeup.js', // no-npm
|
|
||||||
'vendors/jquery-letterfx/jquery-letterfx.min.js', // no-npm
|
|
||||||
'vendors/inputosaurus/inputosaurus.js', // custom (modified)
|
|
||||||
'vendors/routes/signals.min.js', // fixed
|
|
||||||
'vendors/routes/hasher.min.js', // fixed
|
|
||||||
'vendors/routes/crossroads.min.js', // fixed
|
|
||||||
'vendors/jua/jua.min.js', // custom
|
|
||||||
'vendors/keymaster/keymaster.js', // custom (modified)
|
|
||||||
'vendors/qr.js/qr.min.js', // fixed (license)
|
|
||||||
'vendors/bootstrap/js/bootstrap.min.js', // fixed
|
|
||||||
'node_modules/underscore/underscore-min.js',
|
|
||||||
'node_modules/moment/min/moment.min.js',
|
|
||||||
'node_modules/knockout/build/output/knockout-latest.js',
|
|
||||||
'node_modules/knockout-transformations/dist/knockout-transformations.min.js',
|
|
||||||
'node_modules/knockout-sortable/build/knockout-sortable.min.js ',
|
|
||||||
'node_modules/matchmedia-polyfill/matchMedia.js',
|
|
||||||
'node_modules/matchmedia-polyfill/matchMedia.addListener.js',
|
|
||||||
'node_modules/simplestatemanager/dist/ssm.min.js',
|
|
||||||
'node_modules/autolinker/dist/Autolinker.min.js',
|
|
||||||
'node_modules/opentip/lib/opentip.js',
|
|
||||||
'node_modules/opentip/lib/adapter-jquery.js',
|
|
||||||
'vendors/lightgallery/dist/js/lightgallery.min.js', // license
|
|
||||||
'vendors/lightgallery/dist/js/lg-fullscreen.min.js',
|
|
||||||
'vendors/lightgallery/dist/js/lg-thumbnail.min.js',
|
|
||||||
'vendors/lightgallery/dist/js/lg-zoom.min.js',
|
|
||||||
'vendors/lightgallery/dist/js/lg-autoplay.min.js',
|
|
||||||
'node_modules/ifvisible.js/src/ifvisible.min.js'
|
|
||||||
]
|
|
||||||
},
|
|
||||||
app: {
|
|
||||||
name: 'app.js'
|
|
||||||
},
|
|
||||||
admin: {
|
|
||||||
name: 'admin.js'
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// assets
|
|
||||||
|
|
||||||
gulp.task('assets:clean', function() {
|
|
||||||
return cleanDir(cfg.paths.static);
|
|
||||||
});
|
|
||||||
|
|
||||||
gulp.task('assets', function() {
|
|
||||||
return gulp.src(cfg.paths.assets.src)
|
|
||||||
.pipe(gulp.dest(cfg.paths.static));
|
|
||||||
});
|
|
||||||
|
|
||||||
// CSS
|
|
||||||
|
|
||||||
gulp.task('css:clean', function() {
|
|
||||||
return cleanDir(cfg.paths.staticCSS + '/*.css');
|
|
||||||
});
|
|
||||||
|
|
||||||
gulp.task('css:main', ['assets'], function() {
|
|
||||||
var autoprefixer = require('gulp-autoprefixer'),
|
|
||||||
less = require('gulp-less'),
|
|
||||||
lessFilter = filter('**/*.less', {restore: true}),
|
|
||||||
src = cfg.paths.css.main.src.concat([cfg.paths.less.main.src]);
|
|
||||||
|
|
||||||
return gulp.src(src)
|
|
||||||
.pipe(expect.real({errorOnFailure: true}, src))
|
|
||||||
.pipe(lessFilter)
|
|
||||||
.pipe(gulpif(cfg.watch, plumber()))
|
|
||||||
.pipe(less({
|
|
||||||
'paths': cfg.paths.less.main.options.paths
|
|
||||||
}))
|
|
||||||
.pipe(lessFilter.restore)
|
|
||||||
.pipe(concat(cfg.paths.css.main.name))
|
|
||||||
.pipe(autoprefixer())
|
|
||||||
.pipe(replace(/\.\.\/(img|images|fonts|svg)\//g, '$1/'))
|
|
||||||
.pipe(eol('\n', true))
|
|
||||||
.pipe(gulp.dest(cfg.paths.staticCSS))
|
|
||||||
.pipe(livereload());
|
|
||||||
});
|
|
||||||
|
|
||||||
gulp.task('css:social', function() {
|
|
||||||
var autoprefixer = require('gulp-autoprefixer'),
|
|
||||||
src = cfg.paths.css.social.src;
|
|
||||||
return gulp.src(src)
|
|
||||||
.pipe(expect.real({errorOnFailure: true}, src))
|
|
||||||
.pipe(concat(cfg.paths.css.social.name))
|
|
||||||
.pipe(autoprefixer())
|
|
||||||
.pipe(replace(/\.\.\/(img|images|fonts|svg)\//g, '$1/'))
|
|
||||||
.pipe(eol('\n', true))
|
|
||||||
.pipe(gulp.dest(cfg.paths.staticCSS));
|
|
||||||
});
|
|
||||||
|
|
||||||
gulp.task('css:main:min', ['css:main'], function() {
|
|
||||||
var cleanCss = require('gulp-clean-css');
|
|
||||||
return gulp.src(cfg.paths.staticCSS + cfg.paths.css.main.name)
|
|
||||||
.pipe(cleanCss())
|
|
||||||
.pipe(rename({suffix: '.min'}))
|
|
||||||
.pipe(eol('\n', true))
|
|
||||||
.pipe(gulp.dest(cfg.paths.staticCSS));
|
|
||||||
});
|
|
||||||
|
|
||||||
gulp.task('css:social:min', ['css:social'], function() {
|
|
||||||
var cleanCss = require('gulp-clean-css');
|
|
||||||
return gulp.src(cfg.paths.staticCSS + cfg.paths.css.social.name)
|
|
||||||
.pipe(cleanCss())
|
|
||||||
.pipe(rename({suffix: '.min'}))
|
|
||||||
.pipe(eol('\n', true))
|
|
||||||
.pipe(gulp.dest(cfg.paths.staticCSS));
|
|
||||||
});
|
|
||||||
|
|
||||||
gulp.task('css:min', ['css:main:min', 'css:social:min']);
|
|
||||||
|
|
||||||
// JS
|
|
||||||
gulp.task('moment:locales-clear', function() {
|
|
||||||
return cleanDir('rainloop/v/' + cfg.devVersion + '/app/localization/moment/*.js');
|
|
||||||
});
|
|
||||||
|
|
||||||
gulp.task('moment:locales', ['moment:locales-clear'], function() {
|
|
||||||
return gulp.src(cfg.paths.js.moment.locales)
|
|
||||||
.pipe(gulp.dest(cfg.paths.momentLocales));
|
|
||||||
});
|
|
||||||
|
|
||||||
gulp.task('js:libs', function() {
|
|
||||||
var src = cfg.paths.js.libs.src;
|
|
||||||
return gulp.src(src)
|
|
||||||
.pipe(expect.real({errorOnFailure: true}, src))
|
|
||||||
.pipe(concat(cfg.paths.js.libs.name, {separator: '\n\n'}))
|
|
||||||
.pipe(eol('\n', true))
|
|
||||||
.pipe(replace(/sourceMappingURL=[a-z0-9\.\-_]{1,20}\.map/ig, ''))
|
|
||||||
.pipe(gulp.dest(cfg.paths.staticJS));
|
|
||||||
});
|
|
||||||
|
|
||||||
gulp.task('js:clean', function() {
|
|
||||||
return cleanDir(cfg.paths.staticJS + '/**/*.js');
|
|
||||||
});
|
|
||||||
|
|
||||||
gulp.task('js:webpack', function(callback) {
|
|
||||||
webpack(webpackCfgBuilder(cfg.paths.staticJS, !cfg.community, 'production'), webpackCallback(callback));
|
|
||||||
});
|
|
||||||
|
|
||||||
gulp.task('js:app', ['js:webpack'], function() {
|
|
||||||
return gulp.src(cfg.paths.staticJS + cfg.paths.js.app.name)
|
|
||||||
.pipe(header(getHead() + '\n'))
|
|
||||||
.pipe(eol('\n', true))
|
|
||||||
.pipe(gulp.dest(cfg.paths.staticJS))
|
|
||||||
.on('error', gutil.log);
|
|
||||||
});
|
|
||||||
|
|
||||||
gulp.task('js:admin', ['js:webpack'], function() {
|
|
||||||
return gulp.src(cfg.paths.staticJS + cfg.paths.js.admin.name)
|
|
||||||
.pipe(header(getHead() + '\n'))
|
|
||||||
.pipe(eol('\n', true))
|
|
||||||
.pipe(gulp.dest(cfg.paths.staticJS))
|
|
||||||
.on('error', gutil.log);
|
|
||||||
});
|
|
||||||
|
|
||||||
// - min
|
|
||||||
gulp.task('js:min', ['js:app', 'js:admin'], function() {
|
|
||||||
return gulp.src(cfg.paths.staticJS + '*.js')
|
|
||||||
.pipe(replace(/"rainloop\/v\/([^\/]+)\/static\/js\/"/g, '"rainloop/v/$1/static/js/min/"'))
|
|
||||||
.pipe(size({
|
|
||||||
showFiles: true,
|
|
||||||
showTotal: false
|
|
||||||
}))
|
|
||||||
.pipe(rename({suffix: '.min'}))
|
|
||||||
.pipe(uglify({
|
|
||||||
mangle: true,
|
|
||||||
compress: true,
|
|
||||||
ie8: false
|
|
||||||
}))
|
|
||||||
.pipe(eol('\n', true))
|
|
||||||
.pipe(size({
|
|
||||||
showFiles: true,
|
|
||||||
showTotal: false
|
|
||||||
}))
|
|
||||||
.pipe(gulp.dest(cfg.paths.staticMinJS))
|
|
||||||
.on('error', gutil.log);
|
|
||||||
});
|
|
||||||
|
|
||||||
// lint
|
|
||||||
gulp.task('js:eslint', function() {
|
|
||||||
return gulp.src(cfg.paths.globjs)
|
|
||||||
.pipe(cache('eslint'))
|
|
||||||
.pipe(eslint())
|
|
||||||
.pipe(gulpif(cfg.watch, plumber()))
|
|
||||||
.pipe(eslint.format())
|
|
||||||
.pipe(eslint.failAfterError());
|
|
||||||
});
|
|
||||||
|
|
||||||
gulp.task('js:validate', ['js:eslint']);
|
|
||||||
|
|
||||||
// other
|
|
||||||
gulp.task('lightgallery-fonts:clear', function() {
|
|
||||||
return cleanDir('rainloop/v/' + cfg.devVersion + '/static/css/fonts/lg.*');
|
|
||||||
});
|
|
||||||
|
|
||||||
gulp.task('fontastic-fonts:clear', function() {
|
|
||||||
return cleanDir('rainloop/v/' + cfg.devVersion + '/static/css/fonts/rainloop.*');
|
|
||||||
});
|
|
||||||
|
|
||||||
gulp.task('lightgallery-fonts:copy', ['lightgallery-fonts:clear'], function() {
|
|
||||||
return gulp.src('vendors/lightgallery/dist/fonts/lg.*')
|
|
||||||
.pipe(gulp.dest('rainloop/v/' + cfg.devVersion + '/static/css/fonts'));
|
|
||||||
});
|
|
||||||
|
|
||||||
gulp.task('fontastic-fonts:copy', ['fontastic-fonts:clear'], function() {
|
|
||||||
return gulp.src('vendors/fontastic/fonts/rainloop.*')
|
|
||||||
.pipe(gulp.dest('rainloop/v/' + cfg.devVersion + '/static/css/fonts'));
|
|
||||||
});
|
|
||||||
|
|
||||||
gulp.task('lightgallery', ['lightgallery-fonts:copy']);
|
|
||||||
gulp.task('fontastic', ['fontastic-fonts:copy']);
|
|
||||||
|
|
||||||
gulp.task('ckeditor:clear', function() {
|
|
||||||
return cleanDir('rainloop/v/' + cfg.devVersion + '/static/ckeditor');
|
|
||||||
});
|
|
||||||
|
|
||||||
gulp.task('ckeditor:copy', ['ckeditor:clear'], function() {
|
|
||||||
return gulp.src(['vendors/ckeditor/**/*', '!vendors/ckeditor/samples{,/**}', '!vendors/ckeditor/adapters{,/**}', '!vendors/ckeditor/*.md'])
|
|
||||||
.pipe(gulp.dest('rainloop/v/' + cfg.devVersion + '/static/ckeditor'));
|
|
||||||
});
|
|
||||||
|
|
||||||
gulp.task('ckeditor:copy-plugins', ['ckeditor:copy'], function() {
|
|
||||||
return gulp.src('vendors/ckeditor-plugins/**/*')
|
|
||||||
.pipe(gulp.dest('rainloop/v/' + cfg.devVersion + '/static/ckeditor/plugins'));
|
|
||||||
});
|
|
||||||
|
|
||||||
gulp.task('ckeditor', ['ckeditor:copy-plugins', 'ckeditor:copy', 'ckeditor:clear'], function () {
|
|
||||||
return gulp.src('rainloop/v/' + cfg.devVersion + '/static/ckeditor/*.js')
|
|
||||||
.pipe(stripbom())
|
|
||||||
.pipe(header("\uFEFF")) // BOM
|
|
||||||
.pipe(gulp.dest('rainloop/v/' + cfg.devVersion + '/static/ckeditor'));
|
|
||||||
});
|
|
||||||
|
|
||||||
// build (RainLoop)
|
|
||||||
gulp.task('rainloop:copy', ['default'], function() {
|
|
||||||
|
|
||||||
var
|
|
||||||
versionFull = pkg.version,
|
|
||||||
dist = cfg.releasesPath + '/webmail/' + versionFull + '/src/'
|
|
||||||
;
|
|
||||||
|
|
||||||
fs.mkdirSync(dist, '0777', true);
|
|
||||||
fs.mkdirSync(dist + 'data');
|
|
||||||
fs.mkdirSync(dist + 'rainloop/v/' + versionFull, '0777', true);
|
|
||||||
|
|
||||||
return gulp.src('rainloop/v/' + cfg.devVersion + '/**/*', {base: 'rainloop/v/' + cfg.devVersion})
|
|
||||||
.pipe(chmod(0o644, 0o755))
|
|
||||||
.pipe(gulp.dest(dist + 'rainloop/v/' + versionFull));
|
|
||||||
});
|
|
||||||
|
|
||||||
gulp.task('rainloop:setup', ['rainloop:copy'], function() {
|
|
||||||
|
|
||||||
var
|
|
||||||
versionFull = pkg.version,
|
|
||||||
dist = cfg.releasesPath + '/webmail/' + versionFull + '/src/'
|
|
||||||
;
|
|
||||||
|
|
||||||
fs.writeFileSync(dist + 'data/VERSION', versionFull);
|
|
||||||
fs.writeFileSync(dist + 'data/EMPTY', versionFull);
|
|
||||||
|
|
||||||
fs.writeFileSync(dist + 'index.php', fs.readFileSync('index.php', 'utf8')
|
|
||||||
.replace('\'APP_VERSION\', \'0.0.0\'', '\'APP_VERSION\', \'' + versionFull + '\'')
|
|
||||||
.replace('\'APP_VERSION_TYPE\', \'source\'', '\'APP_VERSION_TYPE\', \'' + (cfg.community ? 'community' : 'standard') + '\'')
|
|
||||||
);
|
|
||||||
|
|
||||||
fs.writeFileSync(dist + 'rainloop/v/' + versionFull + '/index.php.root', fs.readFileSync(dist + 'index.php'));
|
|
||||||
|
|
||||||
if (cfg.community)
|
|
||||||
{
|
|
||||||
require('rimraf').sync(dist + 'rainloop/v/' + versionFull + '/app/libraries/RainLoop/Providers/Prem.php');
|
|
||||||
}
|
|
||||||
|
|
||||||
cfg.destPath = cfg.releasesPath + '/webmail/' + versionFull + '/';
|
|
||||||
cfg.cleanPath = dist;
|
|
||||||
cfg.zipSrcPath = dist;
|
|
||||||
cfg.zipFile = 'rainloop-' + (cfg.community ? 'community-' : '') + versionFull + '.zip';
|
|
||||||
cfg.zipFileShort = 'rainloop-' + (cfg.community ? 'community-' : '') + 'latest.zip';
|
|
||||||
|
|
||||||
cfg.rainloopBuilded = true;
|
|
||||||
});
|
|
||||||
|
|
||||||
gulp.task('rainloop:zip', ['rainloop:copy', 'rainloop:setup'], function() {
|
|
||||||
return (cfg.destPath && cfg.zipSrcPath && cfg.zipFile) ?
|
|
||||||
zipDir(cfg.zipSrcPath, cfg.destPath, cfg.zipFile) : false;
|
|
||||||
});
|
|
||||||
|
|
||||||
gulp.task('rainloop:clean', ['rainloop:copy', 'rainloop:setup', 'rainloop:zip'], function() {
|
|
||||||
return (cfg.cleanPath) ? cleanDir(cfg.cleanPath) : false;
|
|
||||||
});
|
|
||||||
|
|
||||||
gulp.task('rainloop:shortname', ['rainloop:zip'], function(callback) {
|
|
||||||
copyFile(cfg.destPath + cfg.zipFile, cfg.destPath + cfg.zipFileShort, callback);
|
|
||||||
});
|
|
||||||
|
|
||||||
// build (OwnCloud)
|
|
||||||
gulp.task('rainloop:owncloud:copy', function() {
|
|
||||||
|
|
||||||
var
|
|
||||||
versionFull = pkg.ownCloudVersion,
|
|
||||||
dist = cfg.releasesPath + '/owncloud/' + versionFull + '/src/'
|
|
||||||
;
|
|
||||||
|
|
||||||
fs.mkdirSync(dist, '0777', true);
|
|
||||||
fs.mkdirSync(dist + 'rainloop', '0777', true);
|
|
||||||
|
|
||||||
return gulp.src('build/owncloud/rainloop-app/**/*', {base: 'build/owncloud/rainloop-app/'})
|
|
||||||
.pipe(gulp.dest(dist + 'rainloop'));
|
|
||||||
});
|
|
||||||
|
|
||||||
gulp.task('rainloop:owncloud:copy-rainloop', ['rainloop:start', 'rainloop:owncloud:copy'], function() {
|
|
||||||
|
|
||||||
var
|
|
||||||
versionFull = pkg.ownCloudVersion,
|
|
||||||
dist = cfg.releasesPath + '/owncloud/' + versionFull + '/src/rainloop/'
|
|
||||||
;
|
|
||||||
|
|
||||||
if (cfg.rainloopBuilded && cfg.destPath)
|
|
||||||
{
|
|
||||||
return gulp.src(cfg.destPath + '/src/**/*', {base: cfg.destPath + '/src/'})
|
|
||||||
.pipe(gulp.dest(dist + 'app/'));
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
});
|
|
||||||
|
|
||||||
gulp.task('rainloop:owncloud:copy-rainloop:clean', ['rainloop:owncloud:copy-rainloop'], function() {
|
|
||||||
return (cfg.cleanPath) ? cleanDir(cfg.cleanPath) : false;
|
|
||||||
});
|
|
||||||
|
|
||||||
gulp.task('rainloop:owncloud:setup', ['rainloop:owncloud:copy', 'rainloop:owncloud:copy-rainloop'], function() {
|
|
||||||
|
|
||||||
var
|
|
||||||
versionFull = pkg.ownCloudVersion,
|
|
||||||
dist = cfg.releasesPath + '/owncloud/' + versionFull + '/src/'
|
|
||||||
;
|
|
||||||
|
|
||||||
fs.writeFileSync(dist + 'rainloop/appinfo/info.xml',
|
|
||||||
fs.readFileSync(dist + 'rainloop/appinfo/info.xml', 'utf8')
|
|
||||||
.replace('<version>0.0</version>', '<version>' + versionFull + '</version>')
|
|
||||||
.replace('<licence></licence>', '<licence>' + (cfg.community ? 'AGPLv3' : 'RainLoop Software License') + '</licence>')
|
|
||||||
);
|
|
||||||
|
|
||||||
fs.writeFileSync(dist + 'rainloop/appinfo/version', versionFull);
|
|
||||||
fs.writeFileSync(dist + 'rainloop/VERSION', versionFull);
|
|
||||||
|
|
||||||
cfg.destPath = cfg.releasesPath + '/owncloud/' + versionFull + '/';
|
|
||||||
cfg.cleanPath = dist;
|
|
||||||
cfg.zipSrcPath = dist;
|
|
||||||
cfg.zipFile = 'rainloop-owncloud-app-' + (cfg.community ? '' : 'standard-') + versionFull + '.zip';
|
|
||||||
cfg.zipFileShort = 'rainloop' + (cfg.community ? '' : '-standard') + '.zip';
|
|
||||||
});
|
|
||||||
|
|
||||||
gulp.task('rainloop:owncloud:zip', ['rainloop:owncloud:copy', 'rainloop:owncloud:setup'], function() {
|
|
||||||
return (cfg.destPath && cfg.zipSrcPath && cfg.zipFile) ?
|
|
||||||
zipDir(cfg.zipSrcPath, cfg.destPath, cfg.zipFile) : false;
|
|
||||||
});
|
|
||||||
|
|
||||||
gulp.task('rainloop:owncloud:clean', ['rainloop:owncloud:copy', 'rainloop:owncloud:setup', 'rainloop:owncloud:zip'], function() {
|
|
||||||
return (cfg.cleanPath) ? cleanDir(cfg.cleanPath) : false;
|
|
||||||
});
|
|
||||||
|
|
||||||
gulp.task('rainloop:owncloud:shortname', ['rainloop:owncloud:zip'], function(callback) {
|
|
||||||
copyFile(cfg.destPath + cfg.zipFile, cfg.destPath + cfg.zipFileShort, callback);
|
|
||||||
});
|
|
||||||
|
|
||||||
gulp.task('plugins:build', [], function() {
|
|
||||||
|
|
||||||
var name = argv.name || '';
|
|
||||||
if (true === name || !name) {
|
|
||||||
throw new Error('Empty name parameter');
|
|
||||||
}
|
|
||||||
|
|
||||||
var
|
|
||||||
source = 'plugins/' + name,
|
|
||||||
vesrion = fs.readFileSync(source + '/VERSION', 'utf8')
|
|
||||||
;
|
|
||||||
|
|
||||||
cfg.destPath = 'build/dist/plugins/';
|
|
||||||
cfg.zipFile = name + '-' + vesrion + '.zip';
|
|
||||||
|
|
||||||
fs.mkdirSync(cfg.destPath, '0777', true);
|
|
||||||
|
|
||||||
return gulp.src(source + '/**/*', {base: source})
|
|
||||||
.pipe(require('gulp-zip')(cfg.zipFile))
|
|
||||||
.pipe(gulp.dest(cfg.destPath));
|
|
||||||
});
|
|
||||||
|
|
||||||
// main
|
|
||||||
gulp.task('moment', ['moment:locales']);
|
|
||||||
gulp.task('js', ['js:libs', 'js:min', 'js:validate']);
|
|
||||||
gulp.task('css', ['css:min']);
|
|
||||||
|
|
||||||
gulp.task('vendors', ['moment', 'ckeditor', 'fontastic', 'lightgallery']);
|
|
||||||
|
|
||||||
gulp.task('clean', ['js:clean', 'css:clean', 'assets:clean']);
|
|
||||||
|
|
||||||
gulp.task('rainloop:start', ['rainloop:copy', 'rainloop:setup']);
|
|
||||||
|
|
||||||
gulp.task('rainloop', ['rainloop:start', 'rainloop:zip', 'rainloop:clean', 'rainloop:shortname']);
|
|
||||||
|
|
||||||
gulp.task('owncloud', ['rainloop:owncloud:copy',
|
|
||||||
'rainloop:owncloud:copy-rainloop', 'rainloop:owncloud:copy-rainloop:clean',
|
|
||||||
'rainloop:owncloud:setup', 'rainloop:owncloud:zip', 'rainloop:owncloud:clean', 'rainloop:owncloud:shortname']);
|
|
||||||
|
|
||||||
// default
|
|
||||||
gulp.task('default', function(callback) {
|
|
||||||
runSequence('clean', ['js', 'css', 'vendors'], callback);
|
|
||||||
});
|
|
||||||
|
|
||||||
// watch
|
|
||||||
gulp.task('watch', ['css:main', 'js:validate'], function() {
|
|
||||||
cfg.watch = true;
|
|
||||||
livereload.listen();
|
|
||||||
gulp.watch(cfg.paths.less.main.watch, {interval: cfg.watchInterval}, ['css:main']);
|
|
||||||
gulp.watch(cfg.paths.globjs, {interval: cfg.watchInterval}, ['js:validate']);
|
|
||||||
});
|
|
||||||
|
|
||||||
// aliases
|
|
||||||
gulp.task('lint', ['js:eslint']);
|
|
||||||
gulp.task('build', ['rainloop']);
|
|
||||||
|
|
||||||
gulp.task('all', function(callback) {
|
|
||||||
runSequence('rainloop', 'owncloud', callback);
|
|
||||||
});
|
|
||||||
|
|
||||||
gulp.task('d', ['default']);
|
|
||||||
gulp.task('w', ['watch']);
|
|
||||||
gulp.task('l', ['js:libs']);
|
|
||||||
gulp.task('v', ['js:validate']);
|
|
||||||
|
|
||||||
gulp.task('b', ['build']);
|
|
||||||
gulp.task('o', ['owncloud']);
|
|
||||||
|
|
||||||
gulp.task('p', ['plugins:build']);
|
|
||||||
|
|
|
||||||
14
package.json
14
package.json
|
|
@ -64,16 +64,16 @@
|
||||||
"element-dataset": "2.2.6",
|
"element-dataset": "2.2.6",
|
||||||
"emailjs-addressparser": "2.0.2",
|
"emailjs-addressparser": "2.0.2",
|
||||||
"eslint": "6.0.1",
|
"eslint": "6.0.1",
|
||||||
"gulp": "3.9.1",
|
"gulp": "4.0.2",
|
||||||
"gulp-autoprefixer": "6.1.0",
|
"gulp-autoprefixer": "6.1.0",
|
||||||
"gulp-cached": "1.1.1",
|
"gulp-cached": "1.1.1",
|
||||||
"gulp-chmod": "2.0.0",
|
"gulp-chmod": "3.0.0",
|
||||||
"gulp-clean-css": "3.10.0",
|
"gulp-clean-css": "4.2.0",
|
||||||
"gulp-concat-util": "0.5.5",
|
"gulp-concat-util": "0.5.5",
|
||||||
"gulp-eol": "0.2.0",
|
"gulp-eol": "0.2.0",
|
||||||
"gulp-eslint": "5.0.0",
|
"gulp-eslint": "6.0.0",
|
||||||
"gulp-expect-file": "1.0.1",
|
"gulp-expect-file": "1.0.1",
|
||||||
"gulp-filter": "5.1.0",
|
"gulp-filter": "6.0.0",
|
||||||
"gulp-header": "2.0.7",
|
"gulp-header": "2.0.7",
|
||||||
"gulp-if": "2.0.2",
|
"gulp-if": "2.0.2",
|
||||||
"gulp-less": "4.0.1",
|
"gulp-less": "4.0.1",
|
||||||
|
|
@ -87,7 +87,7 @@
|
||||||
"gulp-through": "0.4.0",
|
"gulp-through": "0.4.0",
|
||||||
"gulp-uglify": "3.0.2",
|
"gulp-uglify": "3.0.2",
|
||||||
"gulp-util": "3.0.8",
|
"gulp-util": "3.0.8",
|
||||||
"gulp-zip": "4.2.0",
|
"gulp-zip": "5.0.0",
|
||||||
"ifvisible.js": "1.0.6",
|
"ifvisible.js": "1.0.6",
|
||||||
"intersection-observer": "0.7.0",
|
"intersection-observer": "0.7.0",
|
||||||
"jquery": "3.4.1",
|
"jquery": "3.4.1",
|
||||||
|
|
@ -105,7 +105,6 @@
|
||||||
"matchmedia-polyfill": "0.3.2",
|
"matchmedia-polyfill": "0.3.2",
|
||||||
"moment": "2.24.0",
|
"moment": "2.24.0",
|
||||||
"node-fs": "0.1.7",
|
"node-fs": "0.1.7",
|
||||||
"node-notifier": "5.4.0",
|
|
||||||
"normalize.css": "8.0.1",
|
"normalize.css": "8.0.1",
|
||||||
"openpgp": "2.6.2",
|
"openpgp": "2.6.2",
|
||||||
"opentip": "2.4.3",
|
"opentip": "2.4.3",
|
||||||
|
|
@ -113,7 +112,6 @@
|
||||||
"raf": "3.4.1",
|
"raf": "3.4.1",
|
||||||
"raw-loader": "3.0.0",
|
"raw-loader": "3.0.0",
|
||||||
"rimraf": "2.6.3",
|
"rimraf": "2.6.3",
|
||||||
"run-sequence": "2.2.1",
|
|
||||||
"simplestatemanager": "4.1.1",
|
"simplestatemanager": "4.1.1",
|
||||||
"style-loader": "0.23.1",
|
"style-loader": "0.23.1",
|
||||||
"underscore": "1.9.1",
|
"underscore": "1.9.1",
|
||||||
|
|
|
||||||
9
tasks/assets.js
Normal file
9
tasks/assets.js
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
/* RainLoop Webmail (c) RainLoop Team | Licensed under AGPL 3 */
|
||||||
|
const gulp = require('gulp');
|
||||||
|
const {config} = require('./config');
|
||||||
|
|
||||||
|
const assetsCopy = () =>
|
||||||
|
gulp.src(config.paths.assets.src)
|
||||||
|
.pipe(gulp.dest(config.paths.static));
|
||||||
|
|
||||||
|
exports.assets = gulp.series(assetsCopy);
|
||||||
25
tasks/common.js
Normal file
25
tasks/common.js
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
/* RainLoop Webmail (c) RainLoop Team | Licensed under AGPL 3 */
|
||||||
|
const gulp = require('gulp');
|
||||||
|
const rimraf = require('gulp-rimraf');
|
||||||
|
const fs = require('node-fs');
|
||||||
|
|
||||||
|
const {config} = require('./config');
|
||||||
|
|
||||||
|
exports.del = (dir) =>
|
||||||
|
gulp.src(dir, {read: false, allowEmpty: true})
|
||||||
|
.pipe(rimraf());
|
||||||
|
|
||||||
|
exports.copy = (sFile, sNewFile, done) => {
|
||||||
|
fs.writeFileSync(sNewFile, fs.readFileSync(sFile));
|
||||||
|
done();
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.zip = (srcDir, destDir, fileName) =>
|
||||||
|
gulp.src(srcDir + '**/*')
|
||||||
|
.pipe(require('gulp-zip')(fileName))
|
||||||
|
.pipe(gulp.dest(destDir));
|
||||||
|
|
||||||
|
exports.getHead = () => (!config.community ? config.head.rainloop : config.head.agpl);
|
||||||
|
|
||||||
|
exports.cleanStatic = () => exports.del(config.paths.static);
|
||||||
|
|
||||||
134
tasks/config.js
Normal file
134
tasks/config.js
Normal file
|
|
@ -0,0 +1,134 @@
|
||||||
|
/* RainLoop Webmail (c) RainLoop Team | Licensed under AGPL 3 */
|
||||||
|
const path = require('path');
|
||||||
|
const {argv} = require('yargs');
|
||||||
|
|
||||||
|
const config = {
|
||||||
|
head: {
|
||||||
|
rainloop: '/* RainLoop Webmail (c) RainLoop Team | Licensed under RainLoop Software License */',
|
||||||
|
agpl: '/* RainLoop Webmail (c) RainLoop Team | Licensed under AGPL v3 */'
|
||||||
|
},
|
||||||
|
devVersion: '0.0.0',
|
||||||
|
releasesPath: 'build/dist/releases',
|
||||||
|
community: true,
|
||||||
|
watch: false,
|
||||||
|
watchInterval: 1000,
|
||||||
|
googleCompile: false,
|
||||||
|
|
||||||
|
rainloopBuilded: false,
|
||||||
|
destPath: '',
|
||||||
|
cleanPath: '',
|
||||||
|
zipSrcPath: '',
|
||||||
|
zipFile: '',
|
||||||
|
zipFileShort: '',
|
||||||
|
|
||||||
|
paths: {}
|
||||||
|
};
|
||||||
|
|
||||||
|
config.community = !argv.pro;
|
||||||
|
|
||||||
|
config.paths.globjs = 'dev/**/*.js';
|
||||||
|
config.paths.static = 'rainloop/v/' + config.devVersion + '/static/';
|
||||||
|
config.paths.staticJS = 'rainloop/v/' + config.devVersion + '/static/js/';
|
||||||
|
config.paths.staticMinJS = 'rainloop/v/' + config.devVersion + '/static/js/min/';
|
||||||
|
config.paths.staticCSS = 'rainloop/v/' + config.devVersion + '/static/css/';
|
||||||
|
config.paths.momentLocales = 'rainloop/v/' + config.devVersion + '/app/localization/moment/';
|
||||||
|
|
||||||
|
config.paths.assets = {
|
||||||
|
src: 'assets/**/*.*'
|
||||||
|
};
|
||||||
|
|
||||||
|
config.paths.less = {
|
||||||
|
main: {
|
||||||
|
src: 'dev/Styles/@Main.less',
|
||||||
|
watch: ['dev/Styles/*.less'],
|
||||||
|
options: {
|
||||||
|
paths: [
|
||||||
|
path.join(__dirname, 'dev', 'Styles'),
|
||||||
|
path.join(__dirname, 'vendors', 'bootstrap', 'less')
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
config.paths.css = {
|
||||||
|
main: {
|
||||||
|
name: 'app.css',
|
||||||
|
src: [
|
||||||
|
'node_modules/normalize.css/normalize.css',
|
||||||
|
'vendors/jquery-ui/css/smoothness/jquery-ui-1.10.3.custom.css',
|
||||||
|
'vendors/fontastic/styles.css',
|
||||||
|
'vendors/jquery-nanoscroller/nanoscroller.css',
|
||||||
|
'vendors/jquery-letterfx/jquery-letterfx.min.css',
|
||||||
|
'vendors/inputosaurus/inputosaurus.css',
|
||||||
|
'vendors/flags/flags-fixed.css',
|
||||||
|
'node_modules/opentip/css/opentip.css',
|
||||||
|
'node_modules/pikaday/css/pikaday.css',
|
||||||
|
'vendors/lightgallery/dist/css/lightgallery.min.css',
|
||||||
|
'vendors/lightgallery/dist/css/lg-transitions.min.css',
|
||||||
|
'vendors/Progress.js/minified/progressjs.min.css',
|
||||||
|
'dev/Styles/_progressjs.css'
|
||||||
|
]
|
||||||
|
},
|
||||||
|
social: {
|
||||||
|
name: 'social.css',
|
||||||
|
src: [
|
||||||
|
'vendors/fontastic/styles.css',
|
||||||
|
'dev/Styles/_social.css'
|
||||||
|
]
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
config.paths.js = {
|
||||||
|
moment: {
|
||||||
|
locales: [
|
||||||
|
'node_modules/moment/locale/*.js'
|
||||||
|
]
|
||||||
|
},
|
||||||
|
libs: {
|
||||||
|
name: 'libs.js',
|
||||||
|
src: [
|
||||||
|
'node_modules/jquery/dist/jquery.min.js',
|
||||||
|
'node_modules/jquery-migrate/dist/jquery-migrate.min.js',
|
||||||
|
'node_modules/jquery-mousewheel/jquery.mousewheel.js',
|
||||||
|
'node_modules/jquery-scrollstop/jquery.scrollstop.js',
|
||||||
|
'node_modules/jquery-backstretch/jquery.backstretch.min.js',
|
||||||
|
'vendors/jquery-ui/js/jquery-ui-1.10.3.custom.min.js', // custom
|
||||||
|
'vendors/jquery-nanoscroller/jquery.nanoscroller.js', // custom (modified)
|
||||||
|
'vendors/jquery-wakeup/jquery.wakeup.js', // no-npm
|
||||||
|
'vendors/jquery-letterfx/jquery-letterfx.min.js', // no-npm
|
||||||
|
'vendors/inputosaurus/inputosaurus.js', // custom (modified)
|
||||||
|
'vendors/routes/signals.min.js', // fixed
|
||||||
|
'vendors/routes/hasher.min.js', // fixed
|
||||||
|
'vendors/routes/crossroads.min.js', // fixed
|
||||||
|
'vendors/jua/jua.min.js', // custom
|
||||||
|
'vendors/keymaster/keymaster.js', // custom (modified)
|
||||||
|
'vendors/qr.js/qr.min.js', // fixed (license)
|
||||||
|
'vendors/bootstrap/js/bootstrap.min.js', // fixed
|
||||||
|
'node_modules/underscore/underscore-min.js',
|
||||||
|
'node_modules/moment/min/moment.min.js',
|
||||||
|
'node_modules/knockout/build/output/knockout-latest.js',
|
||||||
|
'node_modules/knockout-transformations/dist/knockout-transformations.min.js',
|
||||||
|
'node_modules/knockout-sortable/build/knockout-sortable.min.js ',
|
||||||
|
'node_modules/matchmedia-polyfill/matchMedia.js',
|
||||||
|
'node_modules/matchmedia-polyfill/matchMedia.addListener.js',
|
||||||
|
'node_modules/simplestatemanager/dist/ssm.min.js',
|
||||||
|
'node_modules/autolinker/dist/Autolinker.min.js',
|
||||||
|
'node_modules/opentip/lib/opentip.js',
|
||||||
|
'node_modules/opentip/lib/adapter-jquery.js',
|
||||||
|
'vendors/lightgallery/dist/js/lightgallery.min.js', // license
|
||||||
|
'vendors/lightgallery/dist/js/lg-fullscreen.min.js',
|
||||||
|
'vendors/lightgallery/dist/js/lg-thumbnail.min.js',
|
||||||
|
'vendors/lightgallery/dist/js/lg-zoom.min.js',
|
||||||
|
'vendors/lightgallery/dist/js/lg-autoplay.min.js',
|
||||||
|
'node_modules/ifvisible.js/src/ifvisible.min.js'
|
||||||
|
]
|
||||||
|
},
|
||||||
|
app: {
|
||||||
|
name: 'app.js'
|
||||||
|
},
|
||||||
|
admin: {
|
||||||
|
name: 'admin.js'
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.config = config;
|
||||||
83
tasks/css.js
Normal file
83
tasks/css.js
Normal file
|
|
@ -0,0 +1,83 @@
|
||||||
|
/* RainLoop Webmail (c) RainLoop Team | Licensed under AGPL 3 */
|
||||||
|
const gulp = require('gulp');
|
||||||
|
|
||||||
|
const
|
||||||
|
concat = require('gulp-concat-util'),
|
||||||
|
rename = require('gulp-rename'),
|
||||||
|
replace = require('gulp-replace'),
|
||||||
|
plumber = require('gulp-plumber'),
|
||||||
|
gulpif = require('gulp-if'),
|
||||||
|
eol = require('gulp-eol'),
|
||||||
|
livereload = require('gulp-livereload'),
|
||||||
|
filter = require('gulp-filter'),
|
||||||
|
expect = require('gulp-expect-file');
|
||||||
|
|
||||||
|
const {config} = require('./config');
|
||||||
|
const {del} = require('./common');
|
||||||
|
|
||||||
|
const cssClean = () => del(config.paths.staticCSS + '/*.css');
|
||||||
|
|
||||||
|
const cssMainBuild = () => {
|
||||||
|
const autoprefixer = require('gulp-autoprefixer'),
|
||||||
|
less = require('gulp-less'),
|
||||||
|
lessFilter = filter('**/*.less', {restore: true}),
|
||||||
|
src = config.paths.css.main.src.concat([config.paths.less.main.src]);
|
||||||
|
|
||||||
|
return gulp.src(src)
|
||||||
|
.pipe(expect.real({errorOnFailure: true}, src))
|
||||||
|
.pipe(lessFilter)
|
||||||
|
.pipe(gulpif(config.watch, plumber()))
|
||||||
|
.pipe(less({
|
||||||
|
'paths': config.paths.less.main.options.paths
|
||||||
|
}))
|
||||||
|
.pipe(lessFilter.restore)
|
||||||
|
.pipe(concat(config.paths.css.main.name))
|
||||||
|
.pipe(autoprefixer())
|
||||||
|
.pipe(replace(/\.\.\/(img|images|fonts|svg)\//g, '$1/'))
|
||||||
|
.pipe(eol('\n', true))
|
||||||
|
.pipe(gulp.dest(config.paths.staticCSS))
|
||||||
|
.pipe(livereload());
|
||||||
|
};
|
||||||
|
|
||||||
|
const cssSocialBuild = () => {
|
||||||
|
const autoprefixer = require('gulp-autoprefixer'),
|
||||||
|
src = config.paths.css.social.src;
|
||||||
|
return gulp.src(src)
|
||||||
|
.pipe(expect.real({errorOnFailure: true}, src))
|
||||||
|
.pipe(concat(config.paths.css.social.name))
|
||||||
|
.pipe(autoprefixer())
|
||||||
|
.pipe(replace(/\.\.\/(img|images|fonts|svg)\//g, '$1/'))
|
||||||
|
.pipe(eol('\n', true))
|
||||||
|
.pipe(gulp.dest(config.paths.staticCSS));
|
||||||
|
};
|
||||||
|
|
||||||
|
const cssMainMin = () => {
|
||||||
|
const cleanCss = require('gulp-clean-css');
|
||||||
|
return gulp.src(config.paths.staticCSS + config.paths.css.main.name)
|
||||||
|
.pipe(cleanCss())
|
||||||
|
.pipe(rename({suffix: '.min'}))
|
||||||
|
.pipe(eol('\n', true))
|
||||||
|
.pipe(gulp.dest(config.paths.staticCSS));
|
||||||
|
};
|
||||||
|
|
||||||
|
const cssSocialMin = () => {
|
||||||
|
const cleanCss = require('gulp-clean-css');
|
||||||
|
return gulp.src(config.paths.staticCSS + config.paths.css.social.name)
|
||||||
|
.pipe(cleanCss())
|
||||||
|
.pipe(rename({suffix: '.min'}))
|
||||||
|
.pipe(eol('\n', true))
|
||||||
|
.pipe(gulp.dest(config.paths.staticCSS));
|
||||||
|
};
|
||||||
|
|
||||||
|
const cssBuild = gulp.parallel(cssMainBuild, cssSocialBuild);
|
||||||
|
const cssMin = gulp.parallel(cssMainMin, cssSocialMin);
|
||||||
|
|
||||||
|
const cssLint = (done) => done();
|
||||||
|
|
||||||
|
const cssState1 = gulp.series(cssLint);
|
||||||
|
const cssState2 = gulp.series(cssClean, cssBuild, cssMin);
|
||||||
|
|
||||||
|
exports.cssLint = cssLint;
|
||||||
|
exports.cssBuild = cssBuild;
|
||||||
|
|
||||||
|
exports.css = gulp.parallel(cssState1, cssState2);
|
||||||
86
tasks/js.js
Normal file
86
tasks/js.js
Normal file
|
|
@ -0,0 +1,86 @@
|
||||||
|
/* RainLoop Webmail (c) RainLoop Team | Licensed under AGPL 3 */
|
||||||
|
const gulp = require('gulp');
|
||||||
|
|
||||||
|
const
|
||||||
|
concat = require('gulp-concat-util'),
|
||||||
|
header = require('gulp-header'),
|
||||||
|
rename = require('gulp-rename'),
|
||||||
|
replace = require('gulp-replace'),
|
||||||
|
uglify = require('gulp-uglify'),
|
||||||
|
plumber = require('gulp-plumber'),
|
||||||
|
gulpif = require('gulp-if'),
|
||||||
|
eol = require('gulp-eol'),
|
||||||
|
eslint = require('gulp-eslint'),
|
||||||
|
cache = require('gulp-cached'),
|
||||||
|
expect = require('gulp-expect-file'),
|
||||||
|
size = require('gulp-size'),
|
||||||
|
gutil = require('gulp-util');
|
||||||
|
|
||||||
|
const {config} = require('./config');
|
||||||
|
const {del, getHead} = require('./common');
|
||||||
|
|
||||||
|
const {webpack} = require('./webpack');
|
||||||
|
|
||||||
|
const jsClean = () => del(config.paths.staticJS + '/**/*.js');
|
||||||
|
|
||||||
|
// libs
|
||||||
|
const jsLibs = () => {
|
||||||
|
const src = config.paths.js.libs.src;
|
||||||
|
return gulp.src(src)
|
||||||
|
.pipe(expect.real({errorOnFailure: true}, src))
|
||||||
|
.pipe(concat(config.paths.js.libs.name, {separator: '\n\n'}))
|
||||||
|
.pipe(eol('\n', true))
|
||||||
|
.pipe(replace(/sourceMappingURL=[a-z0-9\.\-_]{1,20}\.map/ig, ''))
|
||||||
|
.pipe(gulp.dest(config.paths.staticJS));
|
||||||
|
};
|
||||||
|
|
||||||
|
// app
|
||||||
|
const jsApp = () =>
|
||||||
|
gulp.src(config.paths.staticJS + config.paths.js.app.name)
|
||||||
|
.pipe(header(getHead() + '\n'))
|
||||||
|
.pipe(eol('\n', true))
|
||||||
|
.pipe(gulp.dest(config.paths.staticJS))
|
||||||
|
.on('error', gutil.log);
|
||||||
|
|
||||||
|
const jsAdmin = () =>
|
||||||
|
gulp.src(config.paths.staticJS + config.paths.js.admin.name)
|
||||||
|
.pipe(header(getHead() + '\n'))
|
||||||
|
.pipe(eol('\n', true))
|
||||||
|
.pipe(gulp.dest(config.paths.staticJS))
|
||||||
|
.on('error', gutil.log);
|
||||||
|
|
||||||
|
const jsMin = () =>
|
||||||
|
gulp.src(config.paths.staticJS + '*.js')
|
||||||
|
.pipe(replace(/"rainloop\/v\/([^\/]+)\/static\/js\/"/g, '"rainloop/v/$1/static/js/min/"'))
|
||||||
|
.pipe(size({
|
||||||
|
showFiles: true,
|
||||||
|
showTotal: false
|
||||||
|
}))
|
||||||
|
.pipe(rename({suffix: '.min'}))
|
||||||
|
.pipe(uglify({
|
||||||
|
mangle: true,
|
||||||
|
compress: true,
|
||||||
|
ie8: false
|
||||||
|
}))
|
||||||
|
.pipe(eol('\n', true))
|
||||||
|
.pipe(size({
|
||||||
|
showFiles: true,
|
||||||
|
showTotal: false
|
||||||
|
}))
|
||||||
|
.pipe(gulp.dest(config.paths.staticMinJS))
|
||||||
|
.on('error', gutil.log);
|
||||||
|
|
||||||
|
const jsLint = () =>
|
||||||
|
gulp.src(config.paths.globjs)
|
||||||
|
.pipe(cache('eslint'))
|
||||||
|
.pipe(eslint())
|
||||||
|
.pipe(gulpif(config.watch, plumber()))
|
||||||
|
.pipe(eslint.format())
|
||||||
|
.pipe(eslint.failAfterError());
|
||||||
|
|
||||||
|
const jsState1 = gulp.series(jsLint);
|
||||||
|
const jsState3 = gulp.parallel(jsLibs, jsApp, jsAdmin);
|
||||||
|
const jsState2 = gulp.series(jsClean, webpack, jsState3, jsMin);
|
||||||
|
|
||||||
|
exports.jsLint = jsLint;
|
||||||
|
exports.js = gulp.parallel(jsState1, jsState2);
|
||||||
100
tasks/owncloud.js
Normal file
100
tasks/owncloud.js
Normal file
|
|
@ -0,0 +1,100 @@
|
||||||
|
/* RainLoop Webmail (c) RainLoop Team | Licensed under AGPL 3 */
|
||||||
|
/* eslint-disable consistent-return */
|
||||||
|
|
||||||
|
const gulp = require('gulp');
|
||||||
|
const fs = require('node-fs');
|
||||||
|
|
||||||
|
const pkg = require('../package.json');
|
||||||
|
const {config} = require('./config');
|
||||||
|
const {copy, zip, del} = require('./common');
|
||||||
|
const {rainloopBuild} = require('./rainloop');
|
||||||
|
|
||||||
|
const owncloudCopy = () => {
|
||||||
|
const
|
||||||
|
versionFull = pkg.ownCloudVersion,
|
||||||
|
dist = config.releasesPath + '/owncloud/' + versionFull + '/src/'
|
||||||
|
;
|
||||||
|
|
||||||
|
fs.mkdirSync(dist, '0777', true);
|
||||||
|
fs.mkdirSync(dist + 'rainloop', '0777', true);
|
||||||
|
|
||||||
|
return gulp.src('build/owncloud/rainloop-app/**/*', {base: 'build/owncloud/rainloop-app/'})
|
||||||
|
.pipe(gulp.dest(dist + 'rainloop'));
|
||||||
|
};
|
||||||
|
|
||||||
|
const owncloudCopyRainLoop = () => {
|
||||||
|
const
|
||||||
|
versionFull = pkg.ownCloudVersion,
|
||||||
|
dist = config.releasesPath + '/owncloud/' + versionFull + '/src/rainloop/'
|
||||||
|
;
|
||||||
|
|
||||||
|
if (config.rainloopBuilded && config.destPath)
|
||||||
|
{
|
||||||
|
return gulp.src(config.destPath + '/src/**/*', {base: config.destPath + '/src/'})
|
||||||
|
.pipe(gulp.dest(dist + 'app/'));
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
|
const owncloudCopyRainLoopClean = (done) => {
|
||||||
|
if (config.cleanPath) {
|
||||||
|
return del(config.cleanPath);
|
||||||
|
}
|
||||||
|
done();
|
||||||
|
};
|
||||||
|
|
||||||
|
const owncloudSetup = (done) => {
|
||||||
|
const
|
||||||
|
versionFull = pkg.ownCloudVersion,
|
||||||
|
dist = config.releasesPath + '/owncloud/' + versionFull + '/src/'
|
||||||
|
;
|
||||||
|
|
||||||
|
fs.writeFileSync(dist + 'rainloop/appinfo/info.xml',
|
||||||
|
fs.readFileSync(dist + 'rainloop/appinfo/info.xml', 'utf8')
|
||||||
|
.replace('<version>0.0</version>', '<version>' + versionFull + '</version>')
|
||||||
|
.replace('<licence></licence>', '<licence>' + (config.community ? 'AGPLv3' : 'RainLoop Software License') + '</licence>')
|
||||||
|
);
|
||||||
|
|
||||||
|
fs.writeFileSync(dist + 'rainloop/appinfo/version', versionFull);
|
||||||
|
fs.writeFileSync(dist + 'rainloop/VERSION', versionFull);
|
||||||
|
|
||||||
|
config.destPath = config.releasesPath + '/owncloud/' + versionFull + '/';
|
||||||
|
config.cleanPath = dist;
|
||||||
|
config.zipSrcPath = dist;
|
||||||
|
config.zipFile = 'rainloop-owncloud-app-' + (config.community ? '' : 'standard-') + versionFull + '.zip';
|
||||||
|
config.zipFileShort = 'rainloop' + (config.community ? '' : '-standard') + '.zip';
|
||||||
|
|
||||||
|
done();
|
||||||
|
};
|
||||||
|
|
||||||
|
const owncloudZip = (done) => {
|
||||||
|
if (config.destPath && config.zipSrcPath && config.zipFile) {
|
||||||
|
return zip(config.zipSrcPath, config.destPath, config.zipFile);
|
||||||
|
}
|
||||||
|
|
||||||
|
done();
|
||||||
|
};
|
||||||
|
|
||||||
|
const owncloudClean = (done) => {
|
||||||
|
if (config.cleanPath) {
|
||||||
|
return del(config.cleanPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
done();
|
||||||
|
};
|
||||||
|
|
||||||
|
const owncloudShortname = (done) => {
|
||||||
|
copy(config.destPath + config.zipFile, config.destPath + config.zipFileShort, done);
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.owncloud = gulp.series(
|
||||||
|
owncloudCopy,
|
||||||
|
rainloopBuild,
|
||||||
|
owncloudCopyRainLoop,
|
||||||
|
owncloudCopyRainLoopClean,
|
||||||
|
owncloudSetup,
|
||||||
|
owncloudZip,
|
||||||
|
owncloudClean,
|
||||||
|
owncloudShortname
|
||||||
|
);
|
||||||
87
tasks/rainloop.js
Normal file
87
tasks/rainloop.js
Normal file
|
|
@ -0,0 +1,87 @@
|
||||||
|
/* RainLoop Webmail (c) RainLoop Team | Licensed under AGPL 3 */
|
||||||
|
/* eslint-disable consistent-return */
|
||||||
|
|
||||||
|
const gulp = require('gulp');
|
||||||
|
const fs = require('node-fs');
|
||||||
|
const chmod = require('gulp-chmod');
|
||||||
|
|
||||||
|
const pkg = require('../package.json');
|
||||||
|
const {config} = require('./config');
|
||||||
|
const {copy, zip, del} = require('./common');
|
||||||
|
|
||||||
|
const rainloopCopy = () => {
|
||||||
|
const
|
||||||
|
versionFull = pkg.version,
|
||||||
|
dist = config.releasesPath + '/webmail/' + versionFull + '/src/'
|
||||||
|
;
|
||||||
|
|
||||||
|
fs.mkdirSync(dist, '0777', true);
|
||||||
|
fs.mkdirSync(dist + 'data');
|
||||||
|
fs.mkdirSync(dist + 'rainloop/v/' + versionFull, '0777', true);
|
||||||
|
|
||||||
|
return gulp.src('rainloop/v/' + config.devVersion + '/**/*', {base: 'rainloop/v/' + config.devVersion})
|
||||||
|
.pipe(chmod(0o644, 0o755))
|
||||||
|
.pipe(gulp.dest(dist + 'rainloop/v/' + versionFull));
|
||||||
|
};
|
||||||
|
|
||||||
|
const rainloopSetup = (done) => {
|
||||||
|
const
|
||||||
|
versionFull = pkg.version,
|
||||||
|
dist = config.releasesPath + '/webmail/' + versionFull + '/src/'
|
||||||
|
;
|
||||||
|
|
||||||
|
fs.writeFileSync(dist + 'data/VERSION', versionFull);
|
||||||
|
fs.writeFileSync(dist + 'data/EMPTY', versionFull);
|
||||||
|
|
||||||
|
fs.writeFileSync(dist + 'index.php', fs.readFileSync('index.php', 'utf8')
|
||||||
|
.replace('\'APP_VERSION\', \'0.0.0\'', '\'APP_VERSION\', \'' + versionFull + '\'')
|
||||||
|
.replace('\'APP_VERSION_TYPE\', \'source\'', '\'APP_VERSION_TYPE\', \'' + (config.community ? 'community' : 'standard') + '\'')
|
||||||
|
);
|
||||||
|
|
||||||
|
fs.writeFileSync(dist + 'rainloop/v/' + versionFull + '/index.php.root', fs.readFileSync(dist + 'index.php'));
|
||||||
|
|
||||||
|
if (config.community)
|
||||||
|
{
|
||||||
|
require('rimraf').sync(dist + 'rainloop/v/' + versionFull + '/app/libraries/RainLoop/Providers/Prem.php');
|
||||||
|
}
|
||||||
|
|
||||||
|
config.destPath = config.releasesPath + '/webmail/' + versionFull + '/';
|
||||||
|
config.cleanPath = dist;
|
||||||
|
config.zipSrcPath = dist;
|
||||||
|
config.zipFile = 'rainloop-' + (config.community ? 'community-' : '') + versionFull + '.zip';
|
||||||
|
config.zipFileShort = 'rainloop-' + (config.community ? 'community-' : '') + 'latest.zip';
|
||||||
|
|
||||||
|
config.rainloopBuilded = true;
|
||||||
|
|
||||||
|
done();
|
||||||
|
};
|
||||||
|
|
||||||
|
const rainloopZip = (done) => {
|
||||||
|
if (config.destPath && config.zipSrcPath && config.zipFile) {
|
||||||
|
return zip(config.zipSrcPath, config.destPath, config.zipFile);
|
||||||
|
}
|
||||||
|
|
||||||
|
done();
|
||||||
|
};
|
||||||
|
|
||||||
|
const rainloopClean = (done) => {
|
||||||
|
if (config.cleanPath) {
|
||||||
|
return del(config.cleanPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
done();
|
||||||
|
};
|
||||||
|
|
||||||
|
const rainloopShortName = (done) => copy(config.destPath + config.zipFile, config.destPath + config.zipFileShort, done);
|
||||||
|
|
||||||
|
exports.rainloopBuild = gulp.series(
|
||||||
|
rainloopCopy,
|
||||||
|
rainloopSetup,
|
||||||
|
);
|
||||||
|
|
||||||
|
exports.rainloop = gulp.series(
|
||||||
|
exports.rainloopBuild,
|
||||||
|
rainloopZip,
|
||||||
|
rainloopClean,
|
||||||
|
rainloopShortName
|
||||||
|
);
|
||||||
56
tasks/vendors.js
Normal file
56
tasks/vendors.js
Normal file
|
|
@ -0,0 +1,56 @@
|
||||||
|
/* RainLoop Webmail (c) RainLoop Team | Licensed under AGPL 3 */
|
||||||
|
const gulp = require('gulp'),
|
||||||
|
header = require('gulp-header'),
|
||||||
|
stripbom = require('gulp-stripbom');
|
||||||
|
|
||||||
|
const {config} = require('./config');
|
||||||
|
const {del} = require('./common');
|
||||||
|
|
||||||
|
// moment
|
||||||
|
const momentLocalesClear = () => del('rainloop/v/' + config.devVersion + '/app/localization/moment/*.js');
|
||||||
|
|
||||||
|
const momentLocales = () =>
|
||||||
|
gulp.src(config.paths.js.moment.locales)
|
||||||
|
.pipe(gulp.dest(config.paths.momentLocales));
|
||||||
|
|
||||||
|
const moment = gulp.series(momentLocalesClear, momentLocales);
|
||||||
|
|
||||||
|
// lightgallery
|
||||||
|
const lightgalleryFontsClear = () => del('rainloop/v/' + config.devVersion + '/static/css/fonts/lg.*');
|
||||||
|
|
||||||
|
const lightgalleryFontsCopy = () =>
|
||||||
|
gulp.src('vendors/lightgallery/dist/fonts/lg.*')
|
||||||
|
.pipe(gulp.dest('rainloop/v/' + config.devVersion + '/static/css/fonts'));
|
||||||
|
|
||||||
|
const lightgallery = gulp.series(lightgalleryFontsClear, lightgalleryFontsCopy);
|
||||||
|
|
||||||
|
// fontastic
|
||||||
|
const fontasticFontsClear = () => del('rainloop/v/' + config.devVersion + '/static/css/fonts/rainloop.*');
|
||||||
|
|
||||||
|
const fontasticFontsCopy = () =>
|
||||||
|
gulp.src('vendors/fontastic/fonts/rainloop.*')
|
||||||
|
.pipe(gulp.dest('rainloop/v/' + config.devVersion + '/static/css/fonts'));
|
||||||
|
|
||||||
|
const fontastic = gulp.series(fontasticFontsClear, fontasticFontsCopy);
|
||||||
|
|
||||||
|
// ckeditor
|
||||||
|
const ckeditorClear = () => del('rainloop/v/' + config.devVersion + '/static/ckeditor');
|
||||||
|
|
||||||
|
const ckeditorCopy = () =>
|
||||||
|
gulp.src(['vendors/ckeditor/**/*', '!vendors/ckeditor/samples{,/**}', '!vendors/ckeditor/adapters{,/**}', '!vendors/ckeditor/*.md'])
|
||||||
|
.pipe(gulp.dest('rainloop/v/' + config.devVersion + '/static/ckeditor'));
|
||||||
|
|
||||||
|
const ckeditorCopyPlugins = () =>
|
||||||
|
gulp.src('vendors/ckeditor-plugins/**/*')
|
||||||
|
.pipe(gulp.dest('rainloop/v/' + config.devVersion + '/static/ckeditor/plugins'));
|
||||||
|
|
||||||
|
const ckeditorSetup = () =>
|
||||||
|
gulp.src('rainloop/v/' + config.devVersion + '/static/ckeditor/*.js')
|
||||||
|
.pipe(stripbom())
|
||||||
|
// eslint-disable-next-line quotes
|
||||||
|
.pipe(header("\uFEFF")) // BOM
|
||||||
|
.pipe(gulp.dest('rainloop/v/' + config.devVersion + '/static/ckeditor'));
|
||||||
|
|
||||||
|
const ckeditor = gulp.series(ckeditorClear, ckeditorCopy, ckeditorCopyPlugins, ckeditorSetup);
|
||||||
|
|
||||||
|
exports.vendors = gulp.parallel(moment, ckeditor, fontastic, lightgallery);
|
||||||
41
tasks/webpack.js
Normal file
41
tasks/webpack.js
Normal file
|
|
@ -0,0 +1,41 @@
|
||||||
|
/* 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) {
|
||||||
|
if (config.watch) {
|
||||||
|
webpackError(err);
|
||||||
|
} else {
|
||||||
|
throw new gutil.PluginError('webpack', err);
|
||||||
|
}
|
||||||
|
} else if (stats && stats.compilation && stats.compilation.errors && stats.compilation.errors[0]) {
|
||||||
|
if (config.watch) {
|
||||||
|
stats.compilation.errors.forEach(webpackError);
|
||||||
|
} else {
|
||||||
|
throw new gutil.PluginError('webpack', stats.compilation.errors[0]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
done();
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.webpack = (done) => {
|
||||||
|
webpack(
|
||||||
|
webpackCfgBuilder(config.paths.staticJS, !config.community, 'production'),
|
||||||
|
webpackCallback(done)
|
||||||
|
);
|
||||||
|
};
|
||||||
Loading…
Add table
Add a link
Reference in a new issue