0
0
mirror of https://github.com/sp-tarkov/server.git synced 2025-02-13 06:10:44 -05:00
server/project/scripts/fix-7za-permissions.js
Refringe f55861528a
Compress Database Location Files (#954)
Due to LFS storage issues... This PR removes all current LFS files (the
location loot files) and replaces them with a single 7-zip archive. The
archive is stored in LFS, but has decreased in size by roughly 95%.

The location `.json` files are now git-ignored.

There are two new npm commands to aid in working with the archive:
- `npm run database:compress`  
Compresses the JSON files into an archive *which can be committed into
the project*.
- `npm run database:decompress`  
Decompresses the archive into the original JSON files located in the
working directory.

The gulp file that handles builds has been updated to ensure that the
archive files are *always* used when a build is processed, regardless of
if the JSON files are already present in the working directory.
2024-11-28 15:51:53 +00:00

31 lines
837 B
JavaScript

// This script sets the execute permission on the 7za binary if you're on macOS or Linux.
const fs = require("node:fs");
const path = require("node:path");
const os = require("node:os");
const platform = os.platform();
const arch = os.arch();
let sevenZipPath;
if (platform === "darwin") {
// macOS
sevenZipPath = path.join(__dirname, "..", "node_modules", "7zip-bin", "mac", arch, "7za");
} else if (platform === "linux") {
// Linux
sevenZipPath = path.join(__dirname, "..", "node_modules", "7zip-bin", "linux", arch, "7za");
} else {
// Windows (or other)
process.exit(0);
}
fs.chmod(sevenZipPath, 0o755, (err) => {
if (err) {
console.error("Failed to set execute permission on 7za:", err);
process.exit(1);
} else {
console.log("Execute permission set on 7za.");
}
});