From 625247de9a3772ef7a5cc6c7817e33ed9117d269 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20D=C4=9Bdi=C4=8D?= Date: Thu, 26 Oct 2023 14:55:30 +0200 Subject: [PATCH] Using arrow functions --- gulpfile.js | 190 +++++++++--------- .../admin/skautis-admin-users-management.ts | 8 +- .../admin/skautis-modules-register-admin.ts | 2 +- ...s-modules-shortcodes-tinymceRulesButton.ts | 4 +- .../admin/skautis-modules-visibility-admin.ts | 4 +- src/ts/rules/admin/skautis-rules-admin.ts | 6 +- 6 files changed, 105 insertions(+), 109 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 69cac70a..7aad3a7a 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -10,55 +10,57 @@ const shell = require('gulp-shell'); const terser = require('gulp-terser'); const ts = require('gulp-typescript'); -gulp.task('build:css:admin', function () { - return gulp +const tsProject = ts.createProject('tsconfig.json'); + +gulp.task('build:css:admin', () => + gulp .src(['src/css/admin/*.css']) .pipe(cleanCSS()) .pipe(rename({ suffix: '.min' })) - .pipe(gulp.dest('dist/admin/css/')); -}); + .pipe(gulp.dest('dist/admin/css/')) +); -gulp.task('build:css:frontend', function () { - return gulp +gulp.task('build:css:frontend', () => + gulp .src(['src/css/frontend/*.css']) .pipe(cleanCSS()) .pipe(rename({ suffix: '.min' })) - .pipe(gulp.dest('dist/frontend/css/')); -}); + .pipe(gulp.dest('dist/frontend/css/')) +); -gulp.task('build:css:modules:Register:admin', function () { - return gulp +gulp.task('build:css:modules:Register:admin', () => + gulp .src(['src/css/modules/Register/admin/*.css']) .pipe(cleanCSS()) .pipe(rename({ suffix: '.min' })) - .pipe(gulp.dest('dist/modules/Register/admin/css/')); -}); + .pipe(gulp.dest('dist/modules/Register/admin/css/')) +); gulp.task( 'build:css:modules:Register', gulp.parallel('build:css:modules:Register:admin') ); -gulp.task('build:css:modules:Shortcodes:admin', function () { - return gulp +gulp.task('build:css:modules:Shortcodes:admin', () => + gulp .src(['src/css/modules/Shortcodes/admin/*.css']) .pipe(cleanCSS()) .pipe(rename({ suffix: '.min' })) - .pipe(gulp.dest('dist/modules/Shortcodes/admin/css/')); -}); + .pipe(gulp.dest('dist/modules/Shortcodes/admin/css/')) +); gulp.task( 'build:css:modules:Shortcodes', gulp.parallel('build:css:modules:Shortcodes:admin') ); -gulp.task('build:css:modules:Visibility:admin', function () { - return gulp +gulp.task('build:css:modules:Visibility:admin', () => + gulp .src(['src/css/modules/Visibility/admin/*.css']) .pipe(cleanCSS()) .pipe(rename({ suffix: '.min' })) - .pipe(gulp.dest('dist/modules/Visibility/admin/css/')); -}); + .pipe(gulp.dest('dist/modules/Visibility/admin/css/')) +); gulp.task( 'build:css:modules:Visibility', @@ -74,13 +76,13 @@ gulp.task( ) ); -gulp.task('build:css:rules:admin', function () { - return gulp +gulp.task('build:css:rules:admin', () => + gulp .src(['src/css/rules/admin/*.css']) .pipe(cleanCSS()) .pipe(rename({ suffix: '.min' })) - .pipe(gulp.dest('dist/rules/admin/css/')); -}); + .pipe(gulp.dest('dist/rules/admin/css/')) +); gulp.task('build:css:rules', gulp.parallel('build:css:rules:admin')); @@ -106,8 +108,8 @@ gulp.task( 'composer dump-autoload --no-dev' + (process.env.NODE_ENV === 'production' ? ' -o' : '') ), - function () { - return merge( + () => + merge( gulp.src([ 'vendor/composer/autoload_classmap.php', //'vendor/composer/autoload_files.php', @@ -134,8 +136,7 @@ gulp.task( "'Skautis_Integration\\\\Vendor\\\\$1\\\\' => \n" ) ) - ).pipe(gulp.dest('dist/vendor/composer/')); - }, + ).pipe(gulp.dest('dist/vendor/composer/')), shell.task('composer dump-autoload') ) ); @@ -145,36 +146,36 @@ gulp.task( gulp.series('build:deps:composer:scoper', 'build:deps:composer:autoloader') ); -gulp.task('build:deps:npm:datatables.net:files', function () { - return gulp +gulp.task('build:deps:npm:datatables.net:files', () => + gulp .src([ 'node_modules/datatables.net-dt/images/sort_asc.png', 'node_modules/datatables.net-dt/images/sort_desc.png', 'node_modules/datatables.net-plugins/i18n/cs.json', ]) - .pipe(gulp.dest('dist/bundled/datatables-files')); -}); + .pipe(gulp.dest('dist/bundled/datatables-files')) +); gulp.task( 'build:deps:npm:datatables.net', - gulp.parallel('build:deps:npm:datatables.net:files', function () { - return gulp + gulp.parallel('build:deps:npm:datatables.net:files', () => + gulp .src([ 'node_modules/datatables.net-dt/css/jquery.dataTables.min.css', 'node_modules/datatables.net/js/jquery.dataTables.min.js', ]) - .pipe(gulp.dest('dist/bundled/')); - }) + .pipe(gulp.dest('dist/bundled/')) + ) ); -gulp.task('build:deps:npm:font-awesome:css', function () { - return gulp +gulp.task('build:deps:npm:font-awesome:css', () => + gulp .src('node_modules/font-awesome/css/font-awesome.min.css') - .pipe(gulp.dest('dist/bundled/font-awesome/css')); -}); + .pipe(gulp.dest('dist/bundled/font-awesome/css')) +); -gulp.task('build:deps:npm:font-awesome:fonts', function () { - return gulp +gulp.task('build:deps:npm:font-awesome:fonts', () => + gulp .src([ 'node_modules/font-awesome/fonts/fontawesome-webfont.eot', 'node_modules/font-awesome/fonts/fontawesome-webfont.woff2', @@ -182,8 +183,8 @@ gulp.task('build:deps:npm:font-awesome:fonts', function () { 'node_modules/font-awesome/fonts/fontawesome-webfont.ttf', 'node_modules/font-awesome/fonts/fontawesome-webfont.svg', ]) - .pipe(gulp.dest('dist/bundled/font-awesome/fonts')); -}); + .pipe(gulp.dest('dist/bundled/font-awesome/fonts')) +); gulp.task( 'build:deps:npm:font-awesome', @@ -193,35 +194,35 @@ gulp.task( ) ); -gulp.task('build:deps:npm:interactjs', function () { - return gulp +gulp.task('build:deps:npm:interactjs', () => + gulp .src('node_modules/interactjs/dist/interact.min.js') - .pipe(gulp.dest('dist/bundled/')); -}); + .pipe(gulp.dest('dist/bundled/')) +); -gulp.task('build:deps:npm:jquery.repeater', function () { - return gulp +gulp.task('build:deps:npm:jquery.repeater', () => + gulp .src('node_modules/jquery.repeater/jquery.repeater.min.js') - .pipe(gulp.dest('dist/bundled/')); -}); + .pipe(gulp.dest('dist/bundled/')) +); -gulp.task('build:deps:npm:jQuery-QueryBuilder', function () { - return gulp +gulp.task('build:deps:npm:jQuery-QueryBuilder', () => + gulp .src([ 'node_modules/jQuery-QueryBuilder/dist/css/query-builder.default.css', 'node_modules/jQuery-QueryBuilder/dist/js/query-builder.standalone.js', ]) - .pipe(gulp.dest('dist/bundled/')); -}); + .pipe(gulp.dest('dist/bundled/')) +); -gulp.task('build:deps:npm:select2', function () { - return gulp +gulp.task('build:deps:npm:select2', () => + gulp .src([ 'node_modules/select2/dist/css/select2.min.css', 'node_modules/select2/dist/js/select2.min.js', ]) - .pipe(gulp.dest('dist/bundled/')); -}); + .pipe(gulp.dest('dist/bundled/')) +); gulp.task( 'build:deps:npm', @@ -237,55 +238,51 @@ gulp.task( gulp.task('build:deps', gulp.parallel('build:deps:composer', 'build:deps:npm')); -gulp.task('build:js:admin', function () { - const tsProject = ts.createProject('tsconfig.json'); - return gulp +gulp.task('build:js:admin', () => + gulp .src(['src/ts/admin/*.ts', 'src/d.ts/*.d.ts']) .pipe(tsProject()) .js.pipe(terser()) .pipe(rename({ suffix: '.min' })) - .pipe(gulp.dest('dist/admin/js/')); -}); + .pipe(gulp.dest('dist/admin/js/')) +); -gulp.task('build:js:modules:Register:admin', function () { - const tsProject = ts.createProject('tsconfig.json'); - return gulp +gulp.task('build:js:modules:Register:admin', () => + gulp .src(['src/ts/modules/Register/admin/*.ts', 'src/d.ts/*.d.ts']) .pipe(tsProject()) .js.pipe(terser()) .pipe(rename({ suffix: '.min' })) - .pipe(gulp.dest('dist/modules/Register/admin/js/')); -}); + .pipe(gulp.dest('dist/modules/Register/admin/js/')) +); gulp.task( 'build:js:modules:Register', gulp.parallel('build:js:modules:Register:admin') ); -gulp.task('build:js:modules:Shortcodes:admin', function () { - const tsProject = ts.createProject('tsconfig.json'); - return gulp +gulp.task('build:js:modules:Shortcodes:admin', () => + gulp .src(['src/ts/modules/Shortcodes/admin/*.ts', 'src/d.ts/*.d.ts']) .pipe(tsProject()) .js.pipe(terser()) .pipe(rename({ suffix: '.min' })) - .pipe(gulp.dest('dist/modules/Shortcodes/admin/js/')); -}); + .pipe(gulp.dest('dist/modules/Shortcodes/admin/js/')) +); gulp.task( 'build:js:modules:Shortcodes', gulp.parallel('build:js:modules:Shortcodes:admin') ); -gulp.task('build:js:modules:Visibility:admin', function () { - const tsProject = ts.createProject('tsconfig.json'); - return gulp +gulp.task('build:js:modules:Visibility:admin', () => + gulp .src(['src/ts/modules/Visibility/admin/*.ts', 'src/d.ts/*.d.ts']) .pipe(tsProject()) .js.pipe(terser()) .pipe(rename({ suffix: '.min' })) - .pipe(gulp.dest('dist/modules/Visibility/admin/js/')); -}); + .pipe(gulp.dest('dist/modules/Visibility/admin/js/')) +); gulp.task( 'build:js:modules:Visibility', @@ -301,15 +298,14 @@ gulp.task( ) ); -gulp.task('build:js:rules:admin', function () { - const tsProject = ts.createProject('tsconfig.json'); - return gulp +gulp.task('build:js:rules:admin', () => + gulp .src(['src/ts/rules/admin/*.ts', 'src/d.ts/*.d.ts']) .pipe(tsProject()) .js.pipe(terser()) .pipe(rename({ suffix: '.min' })) - .pipe(gulp.dest('dist/rules/admin/js/')); -}); + .pipe(gulp.dest('dist/rules/admin/js/')) +); gulp.task('build:js:rules', gulp.parallel('build:js:rules:admin')); @@ -318,23 +314,23 @@ gulp.task( gulp.parallel('build:js:admin', 'build:js:modules', 'build:js:rules') ); -gulp.task('build:php:base', function () { - return gulp.src(['src/php/*.php']).pipe(gulp.dest('dist/')); -}); +gulp.task('build:php:base', () => + gulp.src(['src/php/*.php']).pipe(gulp.dest('dist/')) +); -gulp.task('build:php:other', function () { - return gulp.src(['src/php/**/*.php']).pipe(gulp.dest('dist/')); -}); +gulp.task('build:php:other', () => + gulp.src(['src/php/**/*.php']).pipe(gulp.dest('dist/')) +); gulp.task('build:php', gulp.parallel('build:php:base', 'build:php:other')); -gulp.task('build:png', function () { - return gulp.src(['src/png/**/*.png']).pipe(gulp.dest('dist/src/')); -}); +gulp.task('build:png', () => + gulp.src(['src/png/**/*.png']).pipe(gulp.dest('dist/src/')) +); -gulp.task('build:txt', function () { - return gulp.src(['src/txt/**/*.txt']).pipe(gulp.dest('dist/')); -}); +gulp.task('build:txt', () => + gulp.src(['src/txt/**/*.txt']).pipe(gulp.dest('dist/')) +); gulp.task( 'build', diff --git a/src/ts/admin/skautis-admin-users-management.ts b/src/ts/admin/skautis-admin-users-management.ts index d2372e72..40c77424 100644 --- a/src/ts/admin/skautis-admin-users-management.ts +++ b/src/ts/admin/skautis-admin-users-management.ts @@ -21,7 +21,7 @@ '/cs.json', search: 'Hledat', }, - initComplete() { + initComplete: () => { const searchString = getQueryStringFromUrl( 'skautisSearchUsers', window.location.href @@ -32,7 +32,7 @@ $searchButton = $('