Skip to content

Commit

Permalink
Using arrow functions
Browse files Browse the repository at this point in the history
  • Loading branch information
marekdedic committed Oct 26, 2023
1 parent 37a27ce commit 625247d
Show file tree
Hide file tree
Showing 6 changed files with 105 additions and 109 deletions.
190 changes: 93 additions & 97 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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'));

Expand All @@ -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',
Expand All @@ -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')
)
);
Expand All @@ -145,45 +146,45 @@ 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',
'node_modules/font-awesome/fonts/fontawesome-webfont.woff',
'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',
Expand All @@ -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',
Expand All @@ -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',
Expand All @@ -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'));

Expand All @@ -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',
Expand Down
8 changes: 4 additions & 4 deletions src/ts/admin/skautis-admin-users-management.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
'/cs.json',
search: 'Hledat',
},
initComplete() {
initComplete: () => {
const searchString = getQueryStringFromUrl(
'skautisSearchUsers',
window.location.href
Expand All @@ -32,7 +32,7 @@
$searchButton = $('<button>')
.text($dataTable.i18n('search', 'Search'))
.addClass('button button-secondary')
.on('click', function () {
.on('click', () => {
const withNonce = updateQueryStringInUrl(
skautisIntegrationAdminUsersManagementLocalize.searchNonceName,
skautisIntegrationAdminUsersManagementLocalize.searchNonceValue,
Expand All @@ -44,7 +44,7 @@
withNonce
);
});
$input.on('keyup', function (e) {
$input.on('keyup', (e) => {
e.preventDefault();
if (e.key === 'Enter') {
$searchButton.trigger('click');
Expand All @@ -57,7 +57,7 @@
const $clearButton = $('<button>')
.text(skautisIntegrationAdminUsersManagementLocalize.cancel)
.addClass('button button-secondary')
.on('click', function () {
.on('click', () => {
$('.dataTables_filter input').val('');
window.location.href = updateQueryStringInUrl(
'skautisSearchUsers',
Expand Down
Loading

0 comments on commit 625247d

Please sign in to comment.