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",