From f7e5a6a6f0032fdb3d664eae2c2fbaad10017da1 Mon Sep 17 00:00:00 2001 From: Mega Yu Date: Thu, 12 Mar 2026 11:27:14 +0800 Subject: [PATCH] chore(build): replace del with fs.rmSync in gulp clean --- gulpfile.js | 20 +++++++++++++++++--- package.json | 1 - 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 2816b3498c..f03156a4a4 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -4,7 +4,6 @@ const cp = require('child_process') const exec = utils.promisify(cp.exec) const path = require('path') const gulp = require('gulp') -const del = require('del') const replace = require('gulp-replace') const outputPath = path.join(__dirname, 'static') @@ -16,6 +15,13 @@ const mobileJsPath = path.join(mobilePath, 'js') const sourcePath = path.join(__dirname, 'src/main/frontend') const resourceFilePath = path.join(resourcesPath, '**') const outputFilePath = path.join(outputPath, '**') +const staticCleanKeep = new Set([ + 'entitlements.plist', + 'forge.config.js', + 'node_modules', + 'package.json', + 'yarn.lock', +]) const css = { watchCSS () { @@ -53,8 +59,16 @@ const css = { const common = { clean () { - return del( - ['./static/**/*', '!./static/node_modules']) + for (const entry of fs.readdirSync(outputPath)) { + if (staticCleanKeep.has(entry)) continue + fs.rmSync(path.join(outputPath, entry), { + recursive: true, + force: true, + maxRetries: 10, + retryDelay: 100, + }) + } + return Promise.resolve() }, syncResourceFile () { diff --git a/package.json b/package.json index a420980450..a7a424badf 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,6 @@ "better-sqlite3": "^12.6.2", "cross-env": "^7.0.3", "cssnano": "^5.1.13", - "del": "^6.0.0", "glob": "9.0.0", "gulp": "^4.0.2", "gulp-postcss": "^10.0.0",