Updated the way frontend vendor files are being added to the project.

This commit is contained in:
Alex Tselegidis 2021-11-07 14:02:05 +01:00
parent a96fe86073
commit b844a71b16
3 changed files with 82 additions and 119 deletions

View file

@ -14,7 +14,6 @@ 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');
@ -82,16 +81,13 @@ function clean(done) {
} }
function scripts() { function scripts() {
return ( return gulp
gulp .src(['assets/js/**/*.js', '!assets/js/**/*.min.js'])
.src(['assets/js/**/*.js', '!assets/js/**/*.min.js']) .pipe(plumber())
.pipe(plumber()) .pipe(changed('assets/js/**/*'))
.pipe(changed('assets/js/**/*')) .pipe(babel())
.pipe(babel()) .pipe(rename({suffix: '.min'}))
// .pipe(uglify().on('error', console.log)) .pipe(gulp.dest('assets/js'));
.pipe(rename({suffix: '.min'}))
.pipe(gulp.dest('assets/js'))
);
} }
function styles() { function styles() {
@ -112,27 +108,79 @@ function watch(done) {
done(); done();
} }
function vendor() { function vendor(done) {
del.sync(['assets/vendor/**', '!assets/vendor/index.html']); del.sync(['assets/vendor/**', '!assets/vendor/index.html']);
const excludes = [ // Bootstrap
'less', gulp.src([
'metadata', 'node_modules/bootstrap/dist/js/bootstrap.min.js',
'scss', 'node_modules/bootstrap/dist/css/bootstrap.min.css'
'attribution.js', ]).pipe(gulp.dest('assets/vendor/bootstrap'));
'examples',
'src',
'test',
'esm',
'cjs',
'external',
'build'
];
return gulp // FontAwesome
.src(dist({excludes}), {base: './node_modules'}) gulp.src([
.pipe(rename((path) => (path.dirname = path.dirname.replace(/\/dist/, '').replace(/\\dist/, '')))) 'node_modules/@fortawesome/fontawesome-free/js/fontawesome.min.js',
.pipe(gulp.dest('./assets/vendor')); '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'));
// 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();
} }
exports.clean = gulp.series(clean); exports.clean = gulp.series(clean);

90
package-lock.json generated
View file

@ -2701,12 +2701,6 @@
"has-symbols": "^1.0.1" "has-symbols": "^1.0.1"
} }
}, },
"get-own-enumerable-property-symbols": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/get-own-enumerable-property-symbols/-/get-own-enumerable-property-symbols-3.0.2.tgz",
"integrity": "sha512-I0UBV/XOz1XkIJHEUDMZAbzCThU/H8DxmSfmdGcKPnVhu2VfFqr34jr9777IyaTYvxjedWhqVIilEDsCdP5G6g==",
"dev": true
},
"get-value": { "get-value": {
"version": "2.0.6", "version": "2.0.6",
"resolved": "https://registry.npmjs.org/get-value/-/get-value-2.0.6.tgz", "resolved": "https://registry.npmjs.org/get-value/-/get-value-2.0.6.tgz",
@ -3068,26 +3062,6 @@
"yargs": "^7.1.0" "yargs": "^7.1.0"
} }
}, },
"gulp-debug": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/gulp-debug/-/gulp-debug-4.0.0.tgz",
"integrity": "sha512-cn/GhMD2nVZCVxAl5vWao4/dcoZ8wUJ8w3oqTvQaGDmC1vT7swNOEbhQTWJp+/otKePT64aENcqAQXDcdj5H1g==",
"dev": true,
"requires": {
"chalk": "^2.3.0",
"fancy-log": "^1.3.2",
"plur": "^3.0.0",
"stringify-object": "^3.0.0",
"through2": "^2.0.0",
"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",
@ -3402,12 +3376,6 @@
"integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY=", "integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY=",
"dev": true "dev": true
}, },
"irregular-plurals": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/irregular-plurals/-/irregular-plurals-2.0.0.tgz",
"integrity": "sha512-Y75zBYLkh0lJ9qxeHlMjQ7bSbyiSqNW/UOPWDmzC7cXskL1hekSITh1Oc6JV0XCWWZ9DE8VYSB71xocLk3gmGw==",
"dev": true
},
"is-absolute": { "is-absolute": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/is-absolute/-/is-absolute-1.0.0.tgz", "resolved": "https://registry.npmjs.org/is-absolute/-/is-absolute-1.0.0.tgz",
@ -3555,12 +3523,6 @@
} }
} }
}, },
"is-obj": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/is-obj/-/is-obj-1.0.1.tgz",
"integrity": "sha1-PkcprB9f3gJc19g6iW2rn09n2w8=",
"dev": true
},
"is-path-cwd": { "is-path-cwd": {
"version": "2.2.0", "version": "2.2.0",
"resolved": "https://registry.npmjs.org/is-path-cwd/-/is-path-cwd-2.2.0.tgz", "resolved": "https://registry.npmjs.org/is-path-cwd/-/is-path-cwd-2.2.0.tgz",
@ -3579,12 +3541,6 @@
"integrity": "sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q==", "integrity": "sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q==",
"dev": true "dev": true
}, },
"is-regexp": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/is-regexp/-/is-regexp-1.0.0.tgz",
"integrity": "sha1-/S2INUXEa6xaYz57mgnof6LLUGk=",
"dev": true
},
"is-relative": { "is-relative": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/is-relative/-/is-relative-1.0.0.tgz", "resolved": "https://registry.npmjs.org/is-relative/-/is-relative-1.0.0.tgz",
@ -3652,13 +3608,10 @@
"jquery": "^3.5.1" "jquery": "^3.5.1"
} }
}, },
"jquery-ui": { "jquery-ui-dist": {
"version": "1.13.0", "version": "1.12.1",
"resolved": "https://registry.npmjs.org/jquery-ui/-/jquery-ui-1.13.0.tgz", "resolved": "https://registry.npmjs.org/jquery-ui-dist/-/jquery-ui-dist-1.12.1.tgz",
"integrity": "sha512-Osf7ECXNTYHtKBkn9xzbIf9kifNrBhfywFEKxOeB/OVctVmLlouV9mfc2qXCp6uyO4Pn72PXKOnj09qXetopCw==", "integrity": "sha1-XAgV08xvkP9fqvWyaKbiO0ypBPo="
"requires": {
"jquery": ">=1.8.0 <4.0.0"
}
}, },
"jquery-ui-timepicker-addon": { "jquery-ui-timepicker-addon": {
"version": "1.6.3", "version": "1.6.3",
@ -4406,12 +4359,6 @@
"readable-stream": "^2.0.1" "readable-stream": "^2.0.1"
} }
}, },
"os-homedir": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz",
"integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=",
"dev": true
},
"os-locale": { "os-locale": {
"version": "1.4.0", "version": "1.4.0",
"resolved": "https://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz", "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz",
@ -4584,15 +4531,6 @@
} }
} }
}, },
"plur": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/plur/-/plur-3.1.1.tgz",
"integrity": "sha512-t1Ax8KUvV3FFII8ltczPn2tJdjqbd1sIzu6t4JL7nQ3EyeL/lTrj5PWKb06ic5/6XYDr65rQ4uzQEGN70/6X5w==",
"dev": true,
"requires": {
"irregular-plurals": "^2.0.0"
}
},
"posix-character-classes": { "posix-character-classes": {
"version": "0.1.1", "version": "0.1.1",
"resolved": "https://registry.npmjs.org/posix-character-classes/-/posix-character-classes-0.1.1.tgz", "resolved": "https://registry.npmjs.org/posix-character-classes/-/posix-character-classes-0.1.1.tgz",
@ -5499,17 +5437,6 @@
} }
} }
}, },
"stringify-object": {
"version": "3.3.0",
"resolved": "https://registry.npmjs.org/stringify-object/-/stringify-object-3.3.0.tgz",
"integrity": "sha512-rHqiFh1elqCQ9WPLIC8I0Q/g/wj5J1eMkyoiD6eoQApWHP0FtlK7rqnhmabL5VUY9JQCcqwwvlOaSuutekgyrw==",
"dev": true,
"requires": {
"get-own-enumerable-property-symbols": "^3.0.0",
"is-obj": "^1.0.1",
"is-regexp": "^1.0.0"
}
},
"strip-ansi": { "strip-ansi": {
"version": "3.0.1", "version": "3.0.1",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz",
@ -5558,15 +5485,6 @@
"xtend": "~4.0.0" "xtend": "~4.0.0"
} }
}, },
"tildify": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/tildify/-/tildify-1.2.0.tgz",
"integrity": "sha1-3OwD9V3Km3qj5bBPIYF+tW5jWIo=",
"dev": true,
"requires": {
"os-homedir": "^1.0.0"
}
},
"time-stamp": { "time-stamp": {
"version": "1.1.0", "version": "1.1.0",
"resolved": "https://registry.npmjs.org/time-stamp/-/time-stamp-1.1.0.tgz", "resolved": "https://registry.npmjs.org/time-stamp/-/time-stamp-1.1.0.tgz",

View file

@ -25,14 +25,13 @@
}, },
"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-jeditable": "^2.0.19",
"jquery-ui": "^1.13.0", "jquery-ui-dist": "^1.12.1",
"jquery-ui-timepicker-addon": "^1.6.3", "jquery-ui-timepicker-addon": "^1.6.3",
"jquery-ui-touch-punch": "^0.2.3", "jquery-ui-touch-punch": "^0.2.3",
"moment": "^2.29.1", "moment": "^2.29.1",
@ -50,8 +49,6 @@
"gulp-babel": "^8.0.0", "gulp-babel": "^8.0.0",
"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-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",