From c6aa24c4ec6f152b72c92048f28ba059519d92aa Mon Sep 17 00:00:00 2001 From: Alex Tselegidis Date: Sun, 7 Nov 2021 11:47:31 +0100 Subject: [PATCH] Added new gulp task that automatically packages the frontend vendor files --- .gitignore | 2 + assets/vendor/index.html | 10 ++++ gulpfile.js | 35 ++++++++++--- package-lock.json | 107 +++++++++++---------------------------- package.json | 7 ++- 5 files changed, 76 insertions(+), 85 deletions(-) create mode 100644 assets/vendor/index.html diff --git a/.gitignore b/.gitignore index 243794dd..226687e2 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,8 @@ /npm-debug.log /assets/js/**/*.min.js /assets/css/**/*.css +/assets/vendor/**/* +!/assets/vendor/index.html /config.php /storage/backups/* !/storage/backups/.htaccess diff --git a/assets/vendor/index.html b/assets/vendor/index.html new file mode 100644 index 00000000..c942a79c --- /dev/null +++ b/assets/vendor/index.html @@ -0,0 +1,10 @@ + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + \ No newline at end of file diff --git a/gulpfile.js b/gulpfile.js index ac9ee088..2ed4f6ba 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -14,12 +14,12 @@ const changed = require('gulp-changed'); const childProcess = require('child_process'); const css = require('gulp-clean-css'); const del = require('del'); +const dist = require('gulp-npm-dist'); const fs = require('fs-extra'); const gulp = require('gulp'); const plumber = require('gulp-plumber'); const rename = require('gulp-rename'); const sass = require('gulp-sass')(require('sass')); -const uglify = require('gulp-uglify'); const zip = require('zip-dir'); function archive(done) { @@ -65,7 +65,6 @@ function archive(done) { del.sync('**/.DS_Store'); fs.removeSync('build/composer.lock'); del.sync('**/.DS_Store'); - del.sync('build/vendor/codeigniter/framework/user_guide'); zip('build', {saveTo: filename}, function (error) { if (error) { @@ -113,9 +112,33 @@ function watch(done) { done(); } +function vendor() { + del.sync(['assets/vendor/**', '!assets/vendor/index.html']); + + const excludes = [ + 'less', + 'metadata', + 'scss', + 'attribution.js', + 'examples', + 'src', + 'test', + 'esm', + 'cjs', + 'external', + 'build' + ]; + + return gulp + .src(dist({excludes}), {base: './node_modules'}) + .pipe(rename((path) => (path.dirname = path.dirname.replace(/\/dist/, '').replace(/\\dist/, '')))) + .pipe(gulp.dest('./assets/vendor')); +} + exports.clean = gulp.series(clean); -exports.scripts = gulp.series(clean, scripts); -exports.styles = gulp.series(clean, styles); -exports.dev = gulp.series(clean, scripts, styles, watch); -exports.build = gulp.series(clean, scripts, styles, archive); +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); exports.default = exports.dev; diff --git a/package-lock.json b/package-lock.json index 2324c7c1..49f239e2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3082,6 +3082,12 @@ "tildify": "^1.1.2" } }, + "gulp-npm-dist": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/gulp-npm-dist/-/gulp-npm-dist-1.0.3.tgz", + "integrity": "sha512-7nank8dgqYXOR6K7VM5VdzvAmCGCaudUEbVKOkCVyu+/EK3QuD8PUJ+UlV/f2QWswN0jDXnHlM7FuT2BUt8P3w==", + "dev": true + }, "gulp-plumber": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/gulp-plumber/-/gulp-plumber-1.2.1.tgz", @@ -3266,54 +3272,6 @@ } } }, - "gulp-uglify": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/gulp-uglify/-/gulp-uglify-3.0.2.tgz", - "integrity": "sha512-gk1dhB74AkV2kzqPMQBLA3jPoIAPd/nlNzP2XMDSG8XZrqnlCiDGAqC+rZOumzFvB5zOphlFh6yr3lgcAb/OOg==", - "dev": true, - "requires": { - "array-each": "^1.0.1", - "extend-shallow": "^3.0.2", - "gulplog": "^1.0.0", - "has-gulplog": "^0.1.0", - "isobject": "^3.0.1", - "make-error-cause": "^1.1.1", - "safe-buffer": "^5.1.2", - "through2": "^2.0.0", - "uglify-js": "^3.0.5", - "vinyl-sourcemaps-apply": "^0.2.0" - }, - "dependencies": { - "extend-shallow": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-3.0.2.tgz", - "integrity": "sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg=", - "dev": true, - "requires": { - "assign-symbols": "^1.0.0", - "is-extendable": "^1.0.1" - } - }, - "is-extendable": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", - "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", - "dev": true, - "requires": { - "is-plain-object": "^2.0.4" - } - }, - "is-plain-object": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", - "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", - "dev": true, - "requires": { - "isobject": "^3.0.1" - } - } - } - }, "gulplog": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/gulplog/-/gulplog-1.0.0.tgz", @@ -3347,15 +3305,6 @@ "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", "dev": true }, - "has-gulplog": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/has-gulplog/-/has-gulplog-0.1.0.tgz", - "integrity": "sha1-ZBTIKRNpfaUVkDl9r7EvIpZ4Ec4=", - "dev": true, - "requires": { - "sparkles": "^1.0.0" - } - }, "has-symbols": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.2.tgz", @@ -3695,6 +3644,14 @@ "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.6.0.tgz", "integrity": "sha512-JVzAR/AjBvVt2BmYhxRCSYysDsPcssdmTFnzyLEts9qNwmjmu4JTAMYubEfwVOSwpQ1I1sKKFcxhZCI2buerfw==" }, + "jquery-jeditable": { + "version": "2.0.19", + "resolved": "https://registry.npmjs.org/jquery-jeditable/-/jquery-jeditable-2.0.19.tgz", + "integrity": "sha512-eg3kgRO+2e/mzJ53aNn26TeOYOAjFEr2v6mR7jqeGKl2FqCat+N03GOBDqRlz9g5jdHvONsOVRM9/vab0Yb+Bw==", + "requires": { + "jquery": "^3.5.1" + } + }, "jquery-ui": { "version": "1.13.0", "resolved": "https://registry.npmjs.org/jquery-ui/-/jquery-ui-1.13.0.tgz", @@ -3703,6 +3660,16 @@ "jquery": ">=1.8.0 <4.0.0" } }, + "jquery-ui-timepicker-addon": { + "version": "1.6.3", + "resolved": "https://registry.npmjs.org/jquery-ui-timepicker-addon/-/jquery-ui-timepicker-addon-1.6.3.tgz", + "integrity": "sha1-gDfDmwtjAoLdCzfditf8XhFjN38=" + }, + "jquery-ui-touch-punch": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/jquery-ui-touch-punch/-/jquery-ui-touch-punch-0.2.3.tgz", + "integrity": "sha1-7tgiQnM7okP0az6HwYQbMIGR2mg=" + }, "js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -3876,21 +3843,6 @@ "pify": "^3.0.0" } }, - "make-error": { - "version": "1.3.6", - "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", - "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", - "dev": true - }, - "make-error-cause": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/make-error-cause/-/make-error-cause-1.2.2.tgz", - "integrity": "sha1-3wOI/NCzeBbf8KX7gQiTl3fcvJ0=", - "dev": true, - "requires": { - "make-error": "^1.2.0" - } - }, "make-iterator": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/make-iterator/-/make-iterator-1.0.1.tgz", @@ -5233,6 +5185,11 @@ } } }, + "select2": { + "version": "4.1.0-rc.0", + "resolved": "https://registry.npmjs.org/select2/-/select2-4.1.0-rc.0.tgz", + "integrity": "sha512-Hr9TdhyHCZUtwznEH2CBf7967mEM0idtJ5nMtjvk3Up5tPukOLXbHUNmh10oRfeNIhj+3GD3niu+g6sVK+gK0A==" + }, "semver": { "version": "6.3.0", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", @@ -5798,12 +5755,6 @@ "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=", "dev": true }, - "uglify-js": { - "version": "3.13.10", - "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.13.10.tgz", - "integrity": "sha512-57H3ACYFXeo1IaZ1w02sfA71wI60MGco/IQFjOqK+WtKoprh7Go2/yvd2HPtoJILO2Or84ncLccI4xoHMTSbGg==", - "dev": true - }, "unc-path-regex": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/unc-path-regex/-/unc-path-regex-0.1.2.tgz", diff --git a/package.json b/package.json index ebcd375d..dbe4b213 100644 --- a/package.json +++ b/package.json @@ -25,14 +25,19 @@ }, "dependencies": { "@fortawesome/fontawesome-free": "^5.15.4", + "@popperjs/core": "^2.10.2", "bootstrap": "^4.5.3", "cookieconsent": "^3.1.1", "datejs": "0.0.2", "fullcalendar": "^3.10.4", "jquery": "^3.5.1", + "jquery-jeditable": "^2.0.19", "jquery-ui": "^1.13.0", + "jquery-ui-timepicker-addon": "^1.6.3", + "jquery-ui-touch-punch": "^0.2.3", "moment": "^2.29.1", "moment-timezone": "^0.5.31", + "select2": "^4.1.0-rc.0", "tippy.js": "^6.3.2", "trumbowyg": "^2.21.0" }, @@ -46,10 +51,10 @@ "gulp-changed": "^3.2.0", "gulp-clean-css": "^3.10.0", "gulp-debug": "^4.0.0", + "gulp-npm-dist": "^1.0.3", "gulp-plumber": "^1.2.1", "gulp-rename": "^1.4.0", "gulp-sass": "^5.0.0", - "gulp-uglify": "^3.0.2", "prettier": "^2.4.1", "sass": "^1.43.4", "zip-dir": "^1.0.2"