build: update SVR.JS installation script to work with zip archives without svr.compressed

This commit is contained in:
Dorian Niemiec 2025-01-12 16:40:57 +01:00
parent a5facb0bd1
commit 36e4eae423

View file

@ -57,15 +57,17 @@ function downloadSVRJS(version) {
); );
}); });
if (!fs.existsSync(__dirname + "/svrjs/mods")) fs.mkdirSync(__dirname + "/svrjs/mods"); if (!fs.existsSync(__dirname + "/svrjs/mods")) fs.mkdirSync(__dirname + "/svrjs/mods");
console.log("Deleting SVR.JS stub..."); if (fs.existsSync(__dirname + "/svrjs/svr.compressed")) {
fs.unlinkSync(__dirname + "/svrjs/svr.js"); console.log("Deleting SVR.JS stub...");
// Modules aren't extracted in SVR.JS's 4.x stub, so no module extraction code here. fs.unlinkSync(__dirname + "/svrjs/svr.js");
console.log("Decompressing SVR.JS..."); // Modules aren't extracted in SVR.JS's 4.x stub, so no module extraction code here.
const script = zlib.gunzipSync( console.log("Decompressing SVR.JS...");
fs.readFileSync(__dirname + "/svrjs/svr.compressed") const script = zlib.gunzipSync(
); fs.readFileSync(__dirname + "/svrjs/svr.compressed")
fs.unlinkSync(__dirname + "/svrjs/svr.compressed"); );
fs.writeFileSync(__dirname + "/svrjs/svr.js", script); fs.unlinkSync(__dirname + "/svrjs/svr.compressed");
fs.writeFileSync(__dirname + "/svrjs/svr.js", script);
}
console.log("SVR.JS is installed successfully."); console.log("SVR.JS is installed successfully.");
}); });
} }