Skip to content

Commit 9640c37

Browse files
authored
Merge pull request #170 from dosyago/npm-publish
Npm publish
2 parents 0d94d86 + 922af49 commit 9640c37

4 files changed

Lines changed: 43 additions & 4 deletions

File tree

global-run.cjs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/env node
2+
3+
const os = require('os');
4+
const { spawn } = require('child_process');
5+
const fs = require('fs');
6+
const path = require('path');
7+
8+
if (!fs.existsSync(path.join(process.cwd(), 'node_modules'))) {
9+
spawn('npm', ['i'], { stdio: 'inherit' });
10+
}
11+
12+
// Getting the total system memory
13+
const totalMemory = os.totalmem();
14+
15+
// Allocating 90% of the total memory
16+
const memoryAllocation = Math.floor((totalMemory / (1024 * 1024)) * 0.8); // Converted bytes to MB and took 90% of it
17+
18+
console.log(`Index can use up to: ${memoryAllocation}MB RAM`);
19+
20+
// Running the application
21+
spawn('node', [`--max-old-space-size=${memoryAllocation}`, path.resolve(__dirname, 'build', 'diskernet.cjs')], { stdio: 'inherit' });
22+

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{
22
"name": "diskernet",
3-
"version": "3.0.0",
3+
"version": "3.0.6",
44
"type": "module",
55
"description": "Library server and an archivist browser controller.",
66
"main": "src/app.js",
77
"module": "dist/diskernet.mjs",
88
"bin": {
9-
"diskernet": "build/diskernet.cjs"
9+
"diskernet": "./global-run.cjs"
1010
},
1111
"scripts": {
1212
"start": "node src/app.js",

scripts/download-entitlements.xml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>com.apple.security.network.server</key>
6+
<true/>
7+
<key>com.apple.security.cs.allow-jit</key>
8+
<true/>
9+
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
10+
<true/>
11+
<key>com.apple.security.cs.disable-library-validation</key>
12+
<true/>
13+
<key>com.apple.security.cs.disable-executable-page-protection</key>
14+
<true/>
15+
</dict>
16+
</plist>
17+

0 commit comments

Comments
 (0)