1
0
mirror of https://github.com/c9fe/22120.git synced 2024-07-07 11:52:51 +02:00

Merge pull request #170 from dosyago/npm-publish

Npm publish
This commit is contained in:
Cris 2023-07-23 10:27:44 +08:00 committed by GitHub
commit 9640c37615
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 43 additions and 4 deletions

22
global-run.cjs Executable file
View File

@ -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' });

4
package-lock.json generated
View File

@ -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",

View File

@ -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",

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.network.server</key>
<true/>
<key>com.apple.security.cs.allow-jit</key>
<true/>
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
<true/>
<key>com.apple.security.cs.disable-library-validation</key>
<true/>
<key>com.apple.security.cs.disable-executable-page-protection</key>
<true/>
</dict>
</plist>