From c788c03f3d79bbc442ad4d640a62e6edc4f40cd9 Mon Sep 17 00:00:00 2001 From: Scott Gould Date: Fri, 20 Sep 2024 00:11:04 -0400 Subject: [PATCH] change clean taska bit --- gulpfile.cjs | 18 ++++++++++++++---- package.json | 7 ++++--- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/gulpfile.cjs b/gulpfile.cjs index 047c9b9..760ed98 100644 --- a/gulpfile.cjs +++ b/gulpfile.cjs @@ -4,6 +4,7 @@ const swc = require("gulp-swc"); const tsProject = ts.createProject("tsconfig.json"); const argv = require("yargs").argv; const rimraf = require("rimraf"); +const plumber = require("gulp-plumber"); const swcOptions = { jsc: { @@ -35,8 +36,8 @@ const swcOptions = { }; // Clean task to delete the dist directory -gulp.task("clean", () => { - return rimraf.rimraf("dist"); +gulp.task("clean", (cb) => { + return rimraf.rimraf("dist").then(cb()); }); // Task to compile TypeScript files using SWC @@ -44,17 +45,25 @@ gulp.task("scripts", () => { if (argv.swc) { return gulp .src("src/**/*.ts") + .pipe(plumber()) // Prevent pipe breaking caused by errors .pipe(swc(swcOptions)) .pipe(gulp.dest("dist")); } else { console.warn("[WARN] Using TSC compiler, will be slower than SWC"); - return gulp.src("src/**/*.ts").pipe(tsProject()).pipe(gulp.dest("dist")); + return gulp + .src("src/**/*.ts") + .pipe(plumber()) // Prevent pipe breaking caused by errors + .pipe(tsProject()) + .pipe(gulp.dest("dist")); } }); // Task to copy HTML files gulp.task("copy-html", () => { - return gulp.src("src/**/*.html").pipe(gulp.dest("dist")); + return gulp + .src("src/**/*.html") + .pipe(plumber()) // Prevent pipe breaking caused by errors + .pipe(gulp.dest("dist")); }); // Task to copy other static assets (e.g., CSS, images) @@ -72,6 +81,7 @@ gulp.task("copy-assets", () => { "src/**/*.gif", "src/**/*.svg", ]) + .pipe(plumber()) // Prevent pipe breaking caused by errors .pipe(gulp.dest("dist")); }); diff --git a/package.json b/package.json index f19c609..cead41f 100644 --- a/package.json +++ b/package.json @@ -28,16 +28,17 @@ "devDependencies": { "@eslint/js": "^9.10.0", "@html-eslint/eslint-plugin": "^0.25.0", + "@stylistic/eslint-plugin": "^2.3.0", "@types/compression": "^1.7.5", "@types/eslint__js": "^8.42.3", - "eslint-plugin-sonarjs": "^1.0.4", - "eslint-plugin-unicorn": "^55.0.0", - "@stylistic/eslint-plugin": "^2.3.0", "@types/express": "^4.17.21", "@types/node-fetch": "^2.6.11", "eslint": "^8.57.1", + "eslint-plugin-sonarjs": "^1.0.4", + "eslint-plugin-unicorn": "^55.0.0", "gulp": "^5.0.0", "gulp-copy": "^5.0.0", + "gulp-plumber": "^1.2.1", "gulp-typescript": "^6.0.0-alpha.1", "typescript": "^5.6.2", "typescript-eslint": "^8.6.0"