Skip to content

Commit

Permalink
simplify client js
Browse files Browse the repository at this point in the history
  • Loading branch information
dangowans committed Jul 3, 2024
1 parent b889f10 commit 8cac53f
Show file tree
Hide file tree
Showing 147 changed files with 10,101 additions and 14,520 deletions.
48 changes: 1 addition & 47 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
// eslint-disable-next-line @eslint-community/eslint-comments/disable-enable-pair
/* eslint-disable @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-return, n/no-unpublished-import */
import gulp from 'gulp';
import changed from 'gulp-changed';
import include from 'gulp-include';
import minify from 'gulp-minify';
import gulpSass from 'gulp-sass';
import dartSass from 'sass';
import * as dartSass from 'sass';
const sass = gulpSass(dartSass);
/*
* Compile SASS
Expand All @@ -20,60 +17,17 @@ function publicSCSSFunction() {
.pipe(gulp.dest(publicSCSSDestination));
}
gulp.task('public-scss', publicSCSSFunction);
/*
* Minify public/javascripts
*/
const publicJavascriptsDestination = 'public/javascripts';
function publicJavascriptsMinFunction() {
return gulp
.src('public-typescript/*.js', { allowEmpty: true })
.pipe(changed(publicJavascriptsDestination, {
extension: '.min.js'
}))
.pipe(minify({ noSource: true, ext: { min: '.min.js' } }))
.pipe(gulp.dest(publicJavascriptsDestination));
}
function publicJavascriptsAdminTablesFunction() {
return gulp
.src('public-typescript/adminTables/adminTables.js')
.pipe(include())
.pipe(gulp.dest('public-typescript'));
}
function publicJavascriptsLotOccupancyEditFunction() {
return gulp
.src('public-typescript/lotOccupancyEdit/lotOccupancyEdit.js')
.pipe(include())
.pipe(gulp.dest('public-typescript'));
}
function publicJavascriptsWorkOrderEditFunction() {
return gulp
.src('public-typescript/workOrderEdit/workOrderEdit.js')
.pipe(include())
.pipe(gulp.dest('public-typescript'));
}
gulp.task('public-javascript-adminTables', publicJavascriptsAdminTablesFunction);
gulp.task('public-javascript-lotOccupancyEdit', publicJavascriptsLotOccupancyEditFunction);
gulp.task('public-javascript-workOrderEdit', publicJavascriptsWorkOrderEditFunction);
gulp.task('public-javascript-min', publicJavascriptsMinFunction);
/*
* Watch
*/
function watchFunction() {
gulp.watch('public-scss/*.scss', publicSCSSFunction);
gulp.watch('public-typescript/adminTables/*.js', publicJavascriptsAdminTablesFunction);
gulp.watch('public-typescript/lotOccupancyEdit/*.js', publicJavascriptsLotOccupancyEditFunction);
gulp.watch('public-typescript/workOrderEdit/*.js', publicJavascriptsWorkOrderEditFunction);
gulp.watch('public-typescript/*.js', publicJavascriptsMinFunction);
}
gulp.task('watch', watchFunction);
/*
* Initialize default
*/
gulp.task('default', () => {
publicJavascriptsAdminTablesFunction();
publicJavascriptsLotOccupancyEditFunction();
publicJavascriptsWorkOrderEditFunction();
publicJavascriptsMinFunction();
publicSCSSFunction();
watchFunction();
});
77 changes: 1 addition & 76 deletions gulpfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,8 @@
/* eslint-disable @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-return, n/no-unpublished-import */

import gulp from 'gulp'
import changed from 'gulp-changed'
import include from 'gulp-include'
import minify from 'gulp-minify'
import gulpSass from 'gulp-sass'
import dartSass from 'sass'
import * as dartSass from 'sass'

const sass = gulpSass(dartSass)

Expand All @@ -31,79 +28,12 @@ function publicSCSSFunction(): NodeJS.ReadWriteStream {

gulp.task('public-scss', publicSCSSFunction)

/*
* Minify public/javascripts
*/

const publicJavascriptsDestination = 'public/javascripts'

function publicJavascriptsMinFunction(): NodeJS.ReadWriteStream {
return gulp
.src('public-typescript/*.js', { allowEmpty: true })
.pipe(
changed(publicJavascriptsDestination, {
extension: '.min.js'
})
)
.pipe(minify({ noSource: true, ext: { min: '.min.js' } }))
.pipe(gulp.dest(publicJavascriptsDestination))
}

function publicJavascriptsAdminTablesFunction(): NodeJS.ReadWriteStream {
return gulp
.src('public-typescript/adminTables/adminTables.js')
.pipe(include())
.pipe(gulp.dest('public-typescript'))
}

function publicJavascriptsLotOccupancyEditFunction(): NodeJS.ReadWriteStream {
return gulp
.src('public-typescript/lotOccupancyEdit/lotOccupancyEdit.js')
.pipe(include())
.pipe(gulp.dest('public-typescript'))
}

function publicJavascriptsWorkOrderEditFunction(): NodeJS.ReadWriteStream {
return gulp
.src('public-typescript/workOrderEdit/workOrderEdit.js')
.pipe(include())
.pipe(gulp.dest('public-typescript'))
}

gulp.task('public-javascript-adminTables', publicJavascriptsAdminTablesFunction)
gulp.task(
'public-javascript-lotOccupancyEdit',
publicJavascriptsLotOccupancyEditFunction
)
gulp.task(
'public-javascript-workOrderEdit',
publicJavascriptsWorkOrderEditFunction
)
gulp.task('public-javascript-min', publicJavascriptsMinFunction)

/*
* Watch
*/

function watchFunction(): void {
gulp.watch('public-scss/*.scss', publicSCSSFunction)

gulp.watch(
'public-typescript/adminTables/*.js',
publicJavascriptsAdminTablesFunction
)

gulp.watch(
'public-typescript/lotOccupancyEdit/*.js',
publicJavascriptsLotOccupancyEditFunction
)

gulp.watch(
'public-typescript/workOrderEdit/*.js',
publicJavascriptsWorkOrderEditFunction
)

gulp.watch('public-typescript/*.js', publicJavascriptsMinFunction)
}

gulp.task('watch', watchFunction)
Expand All @@ -113,11 +43,6 @@ gulp.task('watch', watchFunction)
*/

gulp.task('default', () => {
publicJavascriptsAdminTablesFunction()
publicJavascriptsLotOccupancyEditFunction()
publicJavascriptsWorkOrderEditFunction()
publicJavascriptsMinFunction()

publicSCSSFunction()

watchFunction()
Expand Down
Loading

0 comments on commit 8cac53f

Please sign in to comment.