Comparing version 0.1.9 to 0.1.10
@@ -33,7 +33,7 @@ { | ||
"type": "git", | ||
"url": "https://github.com/ramipellumbi/thart/tree/main" | ||
"url": "https://github.com/Ramplex-Technologies/thart" | ||
}, | ||
"license": "MIT", | ||
"private": false, | ||
"version": "0.1.9", | ||
"version": "0.1.10", | ||
"main": "./dist/index.js", | ||
@@ -40,0 +40,0 @@ "module": "./dist/index.mjs", |
@@ -1,5 +0,7 @@ | ||
# thart | ||
# thart | ||
`thart` is a Node.js library for managing the lifecycle of multi-process applications. It provides a simple, flexible API for spawning and managing worker processes, handling graceful shutdowns, and coordinating between primary and worker processes. | ||
**IMPORTANT** `thart` and all future versions are now installable from `@ramplex/thart`. The original `thart` package has been deprecated and will no longer be maintained. | ||
Acknowledgements: | ||
@@ -20,20 +22,10 @@ | ||
### npm | ||
Thart is on the npm registry. Install it with your choice of npm, yarn, or pnpm. | ||
```bash | ||
npm install thart | ||
``` | ||
### pnpm | ||
```bash | ||
yarn add thart | ||
pnpm add thart | ||
``` | ||
### yarn | ||
```bash | ||
yarn add thart | ||
``` | ||
# Usage | ||
@@ -43,11 +35,10 @@ | ||
```javascript | ||
import thart from 'thart'; | ||
import thart from "@ramplex/thart"; | ||
// or | ||
import { thart } from 'thart'; | ||
import { thart } from "@ramplex/thart"; | ||
// or | ||
const thart = require('thart'); | ||
const thart = require("@ramplex/thart"); | ||
// or | ||
const { thart } = require('thart'); | ||
const { thart } = require("@ramplex/thart"); | ||
``` | ||
@@ -60,3 +51,3 @@ | ||
```javascript | ||
import thart from 'thart'; | ||
import thart from "@ramplex/thart"; | ||
@@ -67,3 +58,3 @@ await thart({ | ||
// allows TCP servers to be shared between workers | ||
type: 'cluster', | ||
type: "cluster", | ||
start: async (id) => { | ||
@@ -74,6 +65,6 @@ console.log(`Worker ${id} starting`); | ||
stop: async () => { | ||
console.log('Worker stopping'); | ||
console.log("Worker stopping"); | ||
// Cleanup logic here | ||
} | ||
} | ||
}, | ||
}, | ||
}); | ||
@@ -85,3 +76,3 @@ ``` | ||
```javascript | ||
import thart from 'thart'; | ||
import thart from "@ramplex/thart"; | ||
@@ -92,3 +83,3 @@ await thart({ | ||
start: async () => { | ||
console.log('Primary process started'); | ||
console.log("Primary process started"); | ||
// Primary process initialization | ||
@@ -98,14 +89,14 @@ }, | ||
stop: async () => { | ||
console.log('Primary process stopping'); | ||
console.log("Primary process stopping"); | ||
// Primary process cleanup | ||
} | ||
}, | ||
}, | ||
worker: { | ||
count: 2, | ||
type: 'childProcess', | ||
type: "childProcess", | ||
start: async (id) => { | ||
console.log(`Worker ${id} started`); | ||
// Worker process logic | ||
} | ||
} | ||
}, | ||
}, | ||
}); | ||
@@ -120,3 +111,3 @@ ``` | ||
```javascript | ||
import thart from 'thart'; | ||
import thart from "@ramplex/thart"; | ||
@@ -127,15 +118,15 @@ await thart({ | ||
count: 2, | ||
type: 'cluster', | ||
type: "cluster", | ||
start: async (id) => { | ||
console.log(`Cluster worker ${id} started`); | ||
} | ||
}, | ||
}, | ||
{ | ||
count: 1, | ||
type: 'childProcess', | ||
type: "childProcess", | ||
start: async (id) => { | ||
console.log(`Child process worker ${id} started`); | ||
} | ||
} | ||
] | ||
}, | ||
}, | ||
], | ||
}); | ||
@@ -142,0 +133,0 @@ ``` |
Unpublished package
Supply chain riskPackage version was not found on the registry. It may exist on a different registry and need to be configured to pull from that registry.
Found 1 instance in 1 package
Unpopular package
QualityThis package is not very popular.
Found 1 instance in 1 package
362047
0
342
4