summary refs log tree commit diff
path: root/scripts/patches/resetWS.js
diff options
context:
space:
mode:
authorTheArcaneBrony <myrainbowdash949@gmail.com>2022-08-26 04:14:54 +0200
committerTheArcaneBrony <myrainbowdash949@gmail.com>2022-08-30 17:07:02 +0200
commitab1a09591adfb9534485dbe3943f09d33076791e (patch)
treeb2e17f6ff7f9668d8b2c8351b0ff4f862382a5d9 /scripts/patches/resetWS.js
parentMerge pull request #866 from FSG-Cat/Bug-Report-Template (diff)
downloadserver-ab1a09591adfb9534485dbe3943f09d33076791e.tar.xz
Basic client patching system
Diffstat (limited to 'scripts/patches/resetWS.js')
-rw-r--r--scripts/patches/resetWS.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/scripts/patches/resetWS.js b/scripts/patches/resetWS.js
new file mode 100644

index 00000000..d34b74fd --- /dev/null +++ b/scripts/patches/resetWS.js
@@ -0,0 +1,24 @@ +const { execSync } = require("child_process"); +const path = require("path"); +const fs = require("fs"); +const { argv, stdout, exit } = require("process"); +const { execIn, parts, getDirs, walk, sanitizeVarName } = require("../utils"); + +//copy all js and css files from assets/cache_src to assets/cache +const srcDir = path.join(__dirname, "..", "..", "assets", "cache_src"); +const destDir = path.join(__dirname, "..", "..", "assets", "cache"); +if(!fs.existsSync(destDir)) fs.mkdirSync(destDir); +const files = fs.readdirSync(srcDir); +files.forEach((file) => { + const filePath = path.join(srcDir, file); + const stats = fs.statSync(filePath); + if (stats.isFile()) { + const ext = path.extname(file); + if (ext === ".js" || ext === ".css") { + const newFilePath = path.join(destDir, file); + fs.rmSync(newFilePath); + fs.copyFileSync(filePath, newFilePath); + console.log(`Copied ${file} to ${newFilePath}`); + } + } +}); \ No newline at end of file