build: modify the SVR.JS installation script to extract all files from the archive
This commit is contained in:
parent
17363178cd
commit
6bea2e78cc
1 changed files with 12 additions and 18 deletions
|
@ -42,15 +42,10 @@ function downloadSVRJS(version) {
|
||||||
const reader = zip.Reader(zipData);
|
const reader = zip.Reader(zipData);
|
||||||
const allFiles = reader.toObject();
|
const allFiles = reader.toObject();
|
||||||
Object.keys(allFiles).forEach((filename) => {
|
Object.keys(allFiles).forEach((filename) => {
|
||||||
var paths = filename.split("/");
|
const paths = filename.split("/");
|
||||||
if (
|
for (let i = 0; i < paths.length - 1; i++) {
|
||||||
filename.match(
|
|
||||||
/^(?:[^/.]+\.compressed|(?:log(?:viewer|highlight)|svr(?:passwd|_new)?)\.js|node_modules(?:\/|$))/
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
for (var j = 0; j < paths.length - 1; j++) {
|
|
||||||
const dirname = JSON.parse(JSON.stringify(paths))
|
const dirname = JSON.parse(JSON.stringify(paths))
|
||||||
.splice(0, j + 1)
|
.splice(0, i + 1)
|
||||||
.join("/");
|
.join("/");
|
||||||
if (!fs.existsSync(__dirname + "/svrjs/" + dirname)) {
|
if (!fs.existsSync(__dirname + "/svrjs/" + dirname)) {
|
||||||
fs.mkdirSync(__dirname + "/svrjs/" + dirname);
|
fs.mkdirSync(__dirname + "/svrjs/" + dirname);
|
||||||
|
@ -60,9 +55,8 @@ function downloadSVRJS(version) {
|
||||||
__dirname + "/svrjs/" + filename,
|
__dirname + "/svrjs/" + filename,
|
||||||
allFiles[filename]
|
allFiles[filename]
|
||||||
);
|
);
|
||||||
}
|
|
||||||
});
|
});
|
||||||
fs.mkdirSync(__dirname + "/svrjs/mods");
|
if (!fs.existsSync(__dirname + "/svrjs/mods")) fs.mkdirSync(__dirname + "/svrjs/mods");
|
||||||
console.log("Deleting SVR.JS stub...");
|
console.log("Deleting SVR.JS stub...");
|
||||||
fs.unlinkSync(__dirname + "/svrjs/svr.js");
|
fs.unlinkSync(__dirname + "/svrjs/svr.js");
|
||||||
// Modules aren't extracted in SVR.JS's 4.x stub, so no module extraction code here.
|
// Modules aren't extracted in SVR.JS's 4.x stub, so no module extraction code here.
|
||||||
|
|
Loading…
Reference in a new issue