2018-11-03 18:15:52 +03:00
|
|
|
/* ----------------------------------------------------------------------------
|
|
|
|
* Easy!Appointments - Open Source Web Scheduler
|
2015-12-30 15:18:18 +02:00
|
|
|
*
|
2018-11-03 18:15:52 +03:00
|
|
|
* @package EasyAppointments
|
|
|
|
* @author A.Tselegidis <alextselegidis@gmail.com>
|
|
|
|
* @copyright Copyright (c) 2013 - 2018, Alex Tselegidis
|
|
|
|
* @license http://opensource.org/licenses/GPL-3.0 - GPLv3
|
|
|
|
* @link http://easyappointments.org
|
|
|
|
* @since v1.4.0
|
|
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
|
2021-11-07 12:38:18 +03:00
|
|
|
const babel = require('gulp-babel');
|
2021-11-07 12:02:49 +03:00
|
|
|
const changed = require('gulp-changed');
|
|
|
|
const childProcess = require('child_process');
|
2021-11-07 12:12:11 +03:00
|
|
|
const css = require('gulp-clean-css');
|
2021-11-07 12:02:49 +03:00
|
|
|
const del = require('del');
|
2020-03-11 15:24:23 +03:00
|
|
|
const fs = require('fs-extra');
|
2021-11-07 12:02:49 +03:00
|
|
|
const gulp = require('gulp');
|
|
|
|
const plumber = require('gulp-plumber');
|
|
|
|
const rename = require('gulp-rename');
|
2021-11-07 12:38:18 +03:00
|
|
|
const sass = require('gulp-sass')(require('sass'));
|
2020-03-11 15:24:23 +03:00
|
|
|
const zip = require('zip-dir');
|
2018-11-03 18:15:52 +03:00
|
|
|
|
2021-11-07 12:02:49 +03:00
|
|
|
function archive(done) {
|
|
|
|
const filename = 'easyappointments-0.0.0.zip';
|
2020-03-11 15:24:23 +03:00
|
|
|
|
|
|
|
fs.removeSync('build');
|
2021-11-07 12:02:49 +03:00
|
|
|
fs.removeSync(filename);
|
2020-03-11 15:24:23 +03:00
|
|
|
|
|
|
|
fs.mkdirsSync('build');
|
|
|
|
fs.copySync('application', 'build/application');
|
|
|
|
fs.copySync('assets', 'build/assets');
|
2021-10-04 10:24:44 +03:00
|
|
|
fs.copySync('system', 'build/system');
|
2020-12-08 16:17:08 +03:00
|
|
|
|
|
|
|
fs.ensureDirSync('build/storage/backups');
|
|
|
|
fs.copySync('storage/backups/.htaccess', 'build/storage/backups/.htaccess');
|
|
|
|
fs.copySync('storage/backups/index.html', 'build/storage/backups/index.html');
|
|
|
|
|
|
|
|
fs.ensureDirSync('build/storage/cache');
|
|
|
|
fs.copySync('storage/cache/index.html', 'build/storage/cache/index.html');
|
|
|
|
fs.copySync('storage/cache/.htaccess', 'build/storage/cache/.htaccess');
|
|
|
|
|
|
|
|
fs.ensureDirSync('build/storage/logs');
|
|
|
|
fs.copySync('storage/logs/.htaccess', 'build/storage/logs/.htaccess');
|
|
|
|
fs.copySync('storage/logs/index.html', 'build/storage/logs/index.html');
|
|
|
|
|
|
|
|
fs.ensureDirSync('build/storage/sessions');
|
|
|
|
fs.copySync('storage/sessions/.htaccess', 'build/storage/sessions/.htaccess');
|
|
|
|
fs.copySync('storage/sessions/index.html', 'build/storage/sessions/index.html');
|
|
|
|
|
|
|
|
fs.ensureDirSync('build/storage/uploads');
|
|
|
|
fs.copySync('storage/uploads/index.html', 'build/storage/uploads/index.html');
|
|
|
|
|
2020-03-11 15:24:23 +03:00
|
|
|
fs.copySync('index.php', 'build/index.php');
|
|
|
|
fs.copySync('composer.json', 'build/composer.json');
|
|
|
|
fs.copySync('composer.lock', 'build/composer.lock');
|
|
|
|
fs.copySync('config-sample.php', 'build/config-sample.php');
|
|
|
|
fs.copySync('CHANGELOG.md', 'build/CHANGELOG.md');
|
|
|
|
fs.copySync('README.md', 'build/README.md');
|
|
|
|
fs.copySync('LICENSE', 'build/LICENSE');
|
|
|
|
|
2021-11-07 12:02:49 +03:00
|
|
|
childProcess.execSync('cd build && composer install --no-interaction --no-dev --no-scripts --optimize-autoloader');
|
2020-03-11 15:24:23 +03:00
|
|
|
|
2020-12-14 11:38:43 +03:00
|
|
|
del.sync('**/.DS_Store');
|
2020-03-11 15:24:23 +03:00
|
|
|
fs.removeSync('build/composer.lock');
|
2020-12-17 17:33:50 +03:00
|
|
|
del.sync('**/.DS_Store');
|
2020-12-14 11:38:43 +03:00
|
|
|
|
2021-11-07 12:02:49 +03:00
|
|
|
zip('build', {saveTo: filename}, function (error) {
|
|
|
|
if (error) {
|
|
|
|
console.log('Zip Error', error);
|
2020-12-17 17:33:50 +03:00
|
|
|
}
|
2020-03-11 15:24:23 +03:00
|
|
|
|
|
|
|
done();
|
|
|
|
});
|
2021-11-07 12:02:49 +03:00
|
|
|
}
|
2020-03-11 15:24:23 +03:00
|
|
|
|
2021-11-07 12:02:49 +03:00
|
|
|
function clean(done) {
|
2020-03-11 15:24:23 +03:00
|
|
|
fs.removeSync('assets/js/**/*.min.js');
|
|
|
|
fs.removeSync('assets/css/**/*.min.css');
|
|
|
|
done();
|
2021-11-07 12:02:49 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
function scripts() {
|
2021-11-07 16:02:05 +03:00
|
|
|
return gulp
|
|
|
|
.src(['assets/js/**/*.js', '!assets/js/**/*.min.js'])
|
|
|
|
.pipe(plumber())
|
|
|
|
.pipe(changed('assets/js/**/*'))
|
|
|
|
.pipe(babel())
|
|
|
|
.pipe(rename({suffix: '.min'}))
|
|
|
|
.pipe(gulp.dest('assets/js'));
|
2021-11-07 12:02:49 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
function styles() {
|
|
|
|
return gulp
|
2021-11-07 12:12:11 +03:00
|
|
|
.src(['assets/css/**/*.scss', '!assets/css/**/*.min.css'])
|
2021-11-07 12:02:49 +03:00
|
|
|
.pipe(plumber())
|
|
|
|
.pipe(changed('assets/css/**/*'))
|
2021-11-07 12:12:11 +03:00
|
|
|
.pipe(sass().on('error', sass.logError))
|
|
|
|
.pipe(gulp.dest('assets/css'))
|
|
|
|
.pipe(css())
|
2021-11-07 12:02:49 +03:00
|
|
|
.pipe(rename({suffix: '.min'}))
|
2020-03-11 15:24:23 +03:00
|
|
|
.pipe(gulp.dest('assets/css'));
|
2021-11-07 12:02:49 +03:00
|
|
|
}
|
2020-03-11 15:24:23 +03:00
|
|
|
|
2021-11-07 12:02:49 +03:00
|
|
|
function watch(done) {
|
|
|
|
gulp.watch(['assets/js/**/*.js', '!assets/js/**/*.min.js'], gulp.parallel(scripts));
|
|
|
|
gulp.watch(['assets/css/**/*.css', '!assets/css/**/*.min.css'], gulp.parallel(styles));
|
2020-03-11 15:24:23 +03:00
|
|
|
done();
|
2021-11-07 12:02:49 +03:00
|
|
|
}
|
2020-12-08 01:20:29 +03:00
|
|
|
|
2021-11-07 16:02:05 +03:00
|
|
|
function vendor(done) {
|
2021-11-07 13:47:31 +03:00
|
|
|
del.sync(['assets/vendor/**', '!assets/vendor/index.html']);
|
|
|
|
|
2021-11-07 16:02:05 +03:00
|
|
|
// Bootstrap
|
|
|
|
gulp.src([
|
|
|
|
'node_modules/bootstrap/dist/js/bootstrap.min.js',
|
|
|
|
'node_modules/bootstrap/dist/css/bootstrap.min.css'
|
|
|
|
]).pipe(gulp.dest('assets/vendor/bootstrap'));
|
|
|
|
|
|
|
|
// FontAwesome
|
|
|
|
gulp.src([
|
|
|
|
'node_modules/@fortawesome/fontawesome-free/js/fontawesome.min.js',
|
|
|
|
'node_modules/@fortawesome/fontawesome-free/js/solid.min.js'
|
|
|
|
]).pipe(gulp.dest('assets/vendor/fontawesome'));
|
|
|
|
|
|
|
|
// Cookie Consent
|
|
|
|
gulp.src([
|
|
|
|
'node_modules/cookieconsent/build/cookieconsent.min.js',
|
|
|
|
'node_modules/cookieconsent/build/cookieconsent.min.css'
|
|
|
|
]).pipe(gulp.dest('assets/vendor/cookieconsent'));
|
|
|
|
|
|
|
|
// DateJS
|
|
|
|
gulp.src(['node_modules/datejs/lib/date.js'])
|
|
|
|
.pipe(rename({suffix: '.min'}))
|
|
|
|
.pipe(gulp.dest('assets/vendor/datejs'));
|
2021-11-07 13:47:31 +03:00
|
|
|
|
2021-11-07 16:02:05 +03:00
|
|
|
// FullCalendar
|
|
|
|
gulp.src([
|
|
|
|
'node_modules/fullcalendar/dist/fullcalendar.min.js',
|
|
|
|
'node_modules/fullcalendar/dist/fullcalendar.min.css'
|
|
|
|
]).pipe(gulp.dest('assets/vendor/fullcalendar'));
|
|
|
|
|
|
|
|
// jQuery JEditable
|
|
|
|
gulp.src(['node_modules/jquery-jeditable/dist/jquery.jeditable.min.js']).pipe(
|
|
|
|
gulp.dest('assets/vendor/jquery-jeditable')
|
|
|
|
);
|
|
|
|
|
|
|
|
// jQuery UI
|
|
|
|
gulp.src(['node_modules/jquery-ui-dist/jquery-ui.min.js', 'node_modules/jquery-ui-dist/jquery-ui.min.css']).pipe(
|
|
|
|
gulp.dest('assets/vendor/jquery-ui')
|
|
|
|
);
|
|
|
|
|
|
|
|
// jQuery UI Timepicker Addon
|
|
|
|
gulp.src([
|
|
|
|
'node_modules/jquery-ui-timepicker-addon/dist/jquery-ui-timepicker-addon.min.js',
|
|
|
|
'node_modules/jquery-ui-timepicker-addon/dist/jquery-ui-timepicker-addon.min.css'
|
|
|
|
]).pipe(gulp.dest('assets/vendor/jquery-ui-timepicker-addon'));
|
|
|
|
|
|
|
|
// jQuery UI Touch Punch
|
|
|
|
gulp.src(['node_modules/jquery-ui-touch-punch/jquery.ui.touch-punch.min.js']).pipe(
|
|
|
|
gulp.dest('assets/vendor/jquery-ui-touch-punch')
|
|
|
|
);
|
|
|
|
|
|
|
|
// Moment
|
|
|
|
gulp.src(['node_modules/moment/min/moment.min.js']).pipe(gulp.dest('assets/vendor/moment'));
|
|
|
|
|
|
|
|
// Moment Timezone
|
|
|
|
gulp.src(['node_modules/moment-timezone/builds/moment-timezone.min.js']).pipe(
|
|
|
|
gulp.dest('assets/vendor/moment-timezone')
|
|
|
|
);
|
|
|
|
|
|
|
|
// Select2
|
|
|
|
gulp.src(['node_modules/select2/dist/js/select2.min.js']).pipe(gulp.dest('assets/vendor/select2'));
|
|
|
|
|
|
|
|
// Tippy.js
|
|
|
|
gulp.src(['node_modules/tippy.js/dist/tippy-bundle.umd.min.js']).pipe(gulp.dest('assets/vendor/tippy.js'));
|
|
|
|
|
|
|
|
// Trumbowyg
|
|
|
|
gulp.src(['node_modules/trumbowyg/dist/trumbowyg.min.js', 'node_modules/trumbowyg/dist/ui/trumbowyg.min.css']).pipe(
|
|
|
|
gulp.dest('assets/vendor/trumbowyg')
|
|
|
|
);
|
|
|
|
|
|
|
|
done();
|
2021-11-07 13:47:31 +03:00
|
|
|
}
|
|
|
|
|
2021-11-07 12:12:11 +03:00
|
|
|
exports.clean = gulp.series(clean);
|
2021-11-07 13:47:31 +03:00
|
|
|
exports.vendor = gulp.series(vendor);
|
|
|
|
exports.scripts = gulp.series(scripts);
|
|
|
|
exports.styles = gulp.series(styles);
|
|
|
|
exports.dev = gulp.series(clean, vendor, scripts, styles, watch);
|
|
|
|
exports.build = gulp.series(clean, vendor, scripts, styles, archive);
|
2021-11-07 12:02:49 +03:00
|
|
|
exports.default = exports.dev;
|