change clean taska bit
This commit is contained in:
parent
6f51acd667
commit
c788c03f3d
2 changed files with 18 additions and 7 deletions
18
gulpfile.cjs
18
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"));
|
||||
});
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue