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"));
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue