Added new gulp task that automatically packages the frontend vendor files

This commit is contained in:
Alex Tselegidis 2021-11-07 11:47:31 +01:00
parent 70625e37a5
commit c6aa24c4ec
5 changed files with 76 additions and 85 deletions

2
.gitignore vendored
View file

@ -11,6 +11,8 @@
/npm-debug.log /npm-debug.log
/assets/js/**/*.min.js /assets/js/**/*.min.js
/assets/css/**/*.css /assets/css/**/*.css
/assets/vendor/**/*
!/assets/vendor/index.html
/config.php /config.php
/storage/backups/* /storage/backups/*
!/storage/backups/.htaccess !/storage/backups/.htaccess

10
assets/vendor/index.html vendored Normal file
View file

@ -0,0 +1,10 @@
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>

View file

@ -14,12 +14,12 @@ const changed = require('gulp-changed');
const childProcess = require('child_process'); const childProcess = require('child_process');
const css = require('gulp-clean-css'); const css = require('gulp-clean-css');
const del = require('del'); const del = require('del');
const dist = require('gulp-npm-dist');
const fs = require('fs-extra'); const fs = require('fs-extra');
const gulp = require('gulp'); const gulp = require('gulp');
const plumber = require('gulp-plumber'); const plumber = require('gulp-plumber');
const rename = require('gulp-rename'); const rename = require('gulp-rename');
const sass = require('gulp-sass')(require('sass')); const sass = require('gulp-sass')(require('sass'));
const uglify = require('gulp-uglify');
const zip = require('zip-dir'); const zip = require('zip-dir');
function archive(done) { function archive(done) {
@ -65,7 +65,6 @@ function archive(done) {
del.sync('**/.DS_Store'); del.sync('**/.DS_Store');
fs.removeSync('build/composer.lock'); fs.removeSync('build/composer.lock');
del.sync('**/.DS_Store'); del.sync('**/.DS_Store');
del.sync('build/vendor/codeigniter/framework/user_guide');
zip('build', {saveTo: filename}, function (error) { zip('build', {saveTo: filename}, function (error) {
if (error) { if (error) {
@ -113,9 +112,33 @@ function watch(done) {
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.clean = gulp.series(clean);
exports.scripts = gulp.series(clean, scripts); exports.vendor = gulp.series(vendor);
exports.styles = gulp.series(clean, styles); exports.scripts = gulp.series(scripts);
exports.dev = gulp.series(clean, scripts, styles, watch); exports.styles = gulp.series(styles);
exports.build = gulp.series(clean, scripts, styles, archive); exports.dev = gulp.series(clean, vendor, scripts, styles, watch);
exports.build = gulp.series(clean, vendor, scripts, styles, archive);
exports.default = exports.dev; exports.default = exports.dev;

107
package-lock.json generated
View file

@ -3082,6 +3082,12 @@
"tildify": "^1.1.2" "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": { "gulp-plumber": {
"version": "1.2.1", "version": "1.2.1",
"resolved": "https://registry.npmjs.org/gulp-plumber/-/gulp-plumber-1.2.1.tgz", "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": { "gulplog": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/gulplog/-/gulplog-1.0.0.tgz", "resolved": "https://registry.npmjs.org/gulplog/-/gulplog-1.0.0.tgz",
@ -3347,15 +3305,6 @@
"integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=",
"dev": true "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": { "has-symbols": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.2.tgz", "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", "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.6.0.tgz",
"integrity": "sha512-JVzAR/AjBvVt2BmYhxRCSYysDsPcssdmTFnzyLEts9qNwmjmu4JTAMYubEfwVOSwpQ1I1sKKFcxhZCI2buerfw==" "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": { "jquery-ui": {
"version": "1.13.0", "version": "1.13.0",
"resolved": "https://registry.npmjs.org/jquery-ui/-/jquery-ui-1.13.0.tgz", "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": ">=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": { "js-tokens": {
"version": "4.0.0", "version": "4.0.0",
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
@ -3876,21 +3843,6 @@
"pify": "^3.0.0" "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": { "make-iterator": {
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/make-iterator/-/make-iterator-1.0.1.tgz", "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": { "semver": {
"version": "6.3.0", "version": "6.3.0",
"resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
@ -5798,12 +5755,6 @@
"integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=", "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=",
"dev": true "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": { "unc-path-regex": {
"version": "0.1.2", "version": "0.1.2",
"resolved": "https://registry.npmjs.org/unc-path-regex/-/unc-path-regex-0.1.2.tgz", "resolved": "https://registry.npmjs.org/unc-path-regex/-/unc-path-regex-0.1.2.tgz",

View file

@ -25,14 +25,19 @@
}, },
"dependencies": { "dependencies": {
"@fortawesome/fontawesome-free": "^5.15.4", "@fortawesome/fontawesome-free": "^5.15.4",
"@popperjs/core": "^2.10.2",
"bootstrap": "^4.5.3", "bootstrap": "^4.5.3",
"cookieconsent": "^3.1.1", "cookieconsent": "^3.1.1",
"datejs": "0.0.2", "datejs": "0.0.2",
"fullcalendar": "^3.10.4", "fullcalendar": "^3.10.4",
"jquery": "^3.5.1", "jquery": "^3.5.1",
"jquery-jeditable": "^2.0.19",
"jquery-ui": "^1.13.0", "jquery-ui": "^1.13.0",
"jquery-ui-timepicker-addon": "^1.6.3",
"jquery-ui-touch-punch": "^0.2.3",
"moment": "^2.29.1", "moment": "^2.29.1",
"moment-timezone": "^0.5.31", "moment-timezone": "^0.5.31",
"select2": "^4.1.0-rc.0",
"tippy.js": "^6.3.2", "tippy.js": "^6.3.2",
"trumbowyg": "^2.21.0" "trumbowyg": "^2.21.0"
}, },
@ -46,10 +51,10 @@
"gulp-changed": "^3.2.0", "gulp-changed": "^3.2.0",
"gulp-clean-css": "^3.10.0", "gulp-clean-css": "^3.10.0",
"gulp-debug": "^4.0.0", "gulp-debug": "^4.0.0",
"gulp-npm-dist": "^1.0.3",
"gulp-plumber": "^1.2.1", "gulp-plumber": "^1.2.1",
"gulp-rename": "^1.4.0", "gulp-rename": "^1.4.0",
"gulp-sass": "^5.0.0", "gulp-sass": "^5.0.0",
"gulp-uglify": "^3.0.2",
"prettier": "^2.4.1", "prettier": "^2.4.1",
"sass": "^1.43.4", "sass": "^1.43.4",
"zip-dir": "^1.0.2" "zip-dir": "^1.0.2"