From fef016dd1c42a141e73f7027be1c69a6b163df38 Mon Sep 17 00:00:00 2001 From: Dorian Niemiec Date: Sat, 13 Jan 2024 08:27:41 +0100 Subject: [PATCH] Remove svrmodpack from node_modules --- node_modules/svrmodpack/index.js | 88 ---------------------------- node_modules/svrmodpack/package.json | 48 --------------- 2 files changed, 136 deletions(-) delete mode 100755 node_modules/svrmodpack/index.js delete mode 100755 node_modules/svrmodpack/package.json diff --git a/node_modules/svrmodpack/index.js b/node_modules/svrmodpack/index.js deleted file mode 100755 index d7cbb2a..0000000 --- a/node_modules/svrmodpack/index.js +++ /dev/null @@ -1,88 +0,0 @@ -var fs = require("fs"); -var zlib = require("zlib"); - - -const path = require('path'); - -function mkDirByPathSync(targetDir, { isRelativeToScript = false } = {}) { - const sep = path.sep; - const initDir = path.isAbsolute(targetDir) ? sep : ''; - const baseDir = isRelativeToScript ? __dirname : '.'; - - return targetDir.split(sep).reduce((parentDir, childDir) => { - const curDir = path.resolve(baseDir, parentDir, childDir); - try { - fs.mkdirSync(curDir); - } catch (err) { - if (err.code === 'EEXIST') { // curDir already exists! - return curDir; - } - - // To avoid `EISDIR` error on Mac and `EACCES`-->`ENOENT` and `EPERM` on Windows. - if (err.code === 'ENOENT') { // Throw the original parentDir error on curDir `ENOENT` failure. - throw new Error(`EACCES: permission denied, mkdir '${parentDir}'`); - } - - const caughtErr = ['EACCES', 'EPERM', 'EISDIR'].indexOf(err.code) > -1; - if (!caughtErr || caughtErr && curDir === path.resolve(targetDir)) { - throw err; // Throw if it's just the last created dir. - } - } - - return curDir; - }, initDir); -} - -function pack(ins, out, modinfof) { - if (typeof modinfof === 'undefined') { - modinfof = 'mod.info'; - } - var modinfo = JSON.parse(fs.readFileSync(modinfof)); - var file = "SVR\0"; - var modinfo2 = ""; - modinfo2 += modinfo.name; - modinfo2 += "\0"; - modinfo2 += modinfo.version; - modinfo2 += "\0"; - file += modinfo2 - for (var i = 0; i < ins.length; i++) { - var script = fs.readFileSync(ins[i]); - file += ins[i]; - file += "\0"; - file += script.toString(); - file += "\0"; - } - fs.writeFileSync(out, zlib.gzipSync(file)); -} - -function unpack(inputf, outf, modinfof) { - if (typeof outf === 'undefined') { - outf = ''; - } - if (typeof modinfof === 'undefined') { - modinfof = 'mod.info'; - } - try { - mkDirByPathSync(outf); - } catch (ex) {} - var script = ""; - var modinfo = {}; - var file = zlib.gunzipSync(fs.readFileSync(inputf)).toString(); - var tokens = file.split("\0"); - var files = []; - if (tokens[0] != "SVR") throw new Error("wrong signature"); - modinfo.name = tokens[1]; - modinfo.version = tokens[2]; - for (var i = 3; i < tokens.length - 1; i += 2) { - files.push({ - name: tokens[i], - content: tokens[i + 1] - }); - } - fs.writeFileSync((outf + "/" + modinfof).replace(/\/\//g, "/"), JSON.stringify(modinfo, null, 2)); - for (var i = 0; i < files.length; i++) { - fs.writeFileSync((outf + "/" + files[i].name).replace(/\/\//g, "/"), files[i].content); - } -} - -module.exports = {pack: pack, unpack: unpack} \ No newline at end of file diff --git a/node_modules/svrmodpack/package.json b/node_modules/svrmodpack/package.json deleted file mode 100755 index aabf582..0000000 --- a/node_modules/svrmodpack/package.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "_from": "svrmodpack", - "_id": "svrmodpack@1.0.0", - "_inBundle": false, - "_integrity": "sha512-17SjkfDtZL3KOGjzLTT/nEZzCuvD4rz07y4UFVXfo/Xo0qTMwgICnDSIEOonaAs1GdzZe0hiJxkPYvdTKQifwg==", - "_location": "/svrmodpack", - "_phantomChildren": {}, - "_requested": { - "type": "tag", - "registry": true, - "raw": "svrmodpack", - "name": "svrmodpack", - "escapedName": "svrmodpack", - "rawSpec": "", - "saveSpec": null, - "fetchSpec": "latest" - }, - "_requiredBy": [ - "#USER", - "/" - ], - "_resolved": "https://registry.npmjs.org/svrmodpack/-/svrmodpack-1.0.0.tgz", - "_shasum": "412def1c6ff93a7a15849519411a30b3281ee822", - "_spec": "svrmodpack", - "_where": "/media/serveradmin/Server/developement", - "author": { - "name": "Dorian Niemiec", - "email": "niemiecdorian2008@gmail.com" - }, - "bugs": { - "url": "https://github.com/dorian-tech/svrmodpack/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "DorianTech SVR.JS Mods packer/unpacker library ", - "homepage": "https://github.com/dorian-tech/svrmodpack#readme", - "license": "GPL-3.0-or-later", - "main": "index.js", - "name": "svrmodpack", - "repository": { - "type": "git", - "url": "git+https://github.com/dorian-tech/svrmodpack.git" - }, - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "version": "1.0.0" -}