diff --git a/global-run.cjs b/global-run.cjs new file mode 100755 index 0000000..cce1fab --- /dev/null +++ b/global-run.cjs @@ -0,0 +1,22 @@ +#!/usr/bin/env node + +const os = require('os'); +const { spawn } = require('child_process'); +const fs = require('fs'); +const path = require('path'); + +if (!fs.existsSync(path.join(process.cwd(), 'node_modules'))) { + spawn('npm', ['i'], { stdio: 'inherit' }); +} + +// Getting the total system memory +const totalMemory = os.totalmem(); + +// Allocating 90% of the total memory +const memoryAllocation = Math.floor((totalMemory / (1024 * 1024)) * 0.8); // Converted bytes to MB and took 90% of it + +console.log(`Index can use up to: ${memoryAllocation}MB RAM`); + +// Running the application +spawn('node', [`--max-old-space-size=${memoryAllocation}`, path.resolve(__dirname, 'build', 'diskernet.cjs')], { stdio: 'inherit' }); + diff --git a/package-lock.json b/package-lock.json index d0ae7e8..55ac94e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "diskernet", - "version": "2.9.0", + "version": "3.0.6", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "diskernet", - "version": "2.9.0", + "version": "3.0.6", "license": "PolyForm Strict 1.0", "dependencies": { "@667/ps-list": "^1.1.3", diff --git a/package.json b/package.json index 1991883..14a88e3 100644 --- a/package.json +++ b/package.json @@ -1,12 +1,12 @@ { "name": "diskernet", - "version": "3.0.0", + "version": "3.0.6", "type": "module", "description": "Library server and an archivist browser controller.", "main": "src/app.js", "module": "dist/diskernet.mjs", "bin": { - "diskernet": "build/diskernet.cjs" + "diskernet": "./global-run.cjs" }, "scripts": { "start": "node src/app.js", diff --git a/scripts/download-entitlements.xml b/scripts/download-entitlements.xml new file mode 100644 index 0000000..f9174c0 --- /dev/null +++ b/scripts/download-entitlements.xml @@ -0,0 +1,17 @@ + + + + + com.apple.security.network.server + + com.apple.security.cs.allow-jit + + com.apple.security.cs.allow-unsigned-executable-memory + + com.apple.security.cs.disable-library-validation + + com.apple.security.cs.disable-executable-page-protection + + + +