![Create React App Officially Deprecated Amid React 19 Compatibility Issues](https://cdn.sanity.io/images/cgdhsj6q/production/04fa08cf844d798abc0e1a6391c129363cc7e2ab-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
A Node.js library for managing the lifecycle of multi-process applications
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.
Acknowledgements:
thart
was inspired by throng and shamelessly uses a lot of code async-cleanup to manage process cleanup.node:cluster
and node:child_process
worker typesnpm install thart
pnpm add thart
yarn add thart
thart
can be imported via ES6 imports or CommonJS require as a default or named import.
import thart from 'thart';
// or
import { thart } from 'thart';
// or
const thart = require('thart');
// or
const { thart } = require('thart');
import thart from 'thart';
await thart({
worker: {
count: 4,
// allows TCP servers to be shared between workers
type: 'cluster',
start: async (id) => {
console.log(`Worker ${id} starting`);
// Your worker logic here
},
stop: async () => {
console.log('Worker stopping');
// Cleanup logic here
}
}
});
import thart from 'thart';
await thart({
primary: {
// this runs before any workers are forked
start: async () => {
console.log('Primary process started');
// Primary process initialization
},
// this runs after all workers have exited
stop: async () => {
console.log('Primary process stopping');
// Primary process cleanup
}
},
worker: {
count: 2,
type: 'childProcess',
start: async (id) => {
console.log(`Worker ${id} started`);
// Worker process logic
}
}
});
A powerful feature of thart
is the ability to spawn multiple types of workers in the same application.
import thart from 'thart';
await thart({
worker: [
{
count: 2,
type: 'cluster',
start: async (id) => {
console.log(`Cluster worker ${id} started`);
}
},
{
count: 1,
type: 'childProcess',
start: async (id) => {
console.log(`Child process worker ${id} started`);
}
}
]
});
The main function to start your application.
grace
(optional): Grace period in milliseconds for shutdown. Default: 10000 (10 seconds)primary
(optional): Configuration for the primary process
start
: Function to run when the primary process startsstop
(optional): Function to run when the primary process is shutting downworker
: Configuration for worker processes. Can be a single object or an array of objects
count
: Number of worker processes to spawn (when using an array of objects, this is optional and defaults to 1)type
: Type of worker process ('cluster' or 'childProcess')start
: Function to run in each worker processstop
(optional): Function to run when a worker process is shutting downstartupTimeoutMs
(optional): Timeout for worker startup in millisecondskillAfterCompleted
(optional): If true, kills the worker after the start function completesthart
is licensed under the MIT License.
Contributions are welcome! Please feel free to submit a Pull Request.
FAQs
A Node.js library for managing the lifecycle of multi-process applications
The npm package thart receives a total of 2 weekly downloads. As such, thart popularity was classified as not popular.
We found that thart demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.