Spawn Apps
A utility for managing local application processes, starting them when needed and
stopping them after inactivity.
Features
-
Start and stop applications with a single line of code
-
Automatically manage process lifecycle
-
Set custom timeouts for auto-shutdown
-
Register custom applications with OS-specific paths
-
TypeScript support with type definitions
-
Cross-platform support (macOS, Windows, Linux)
TypeScript Setup
This project is now written in TypeScript.
The build process generates JavaScript files and TypeScript declaration files (.d.ts)
in the dist directory.
To build the project:
Alternatively, you can run the build script which handles all of the above:
./build.sh
Development
Usage
After building, you can import the library from the dist directory:
import { startApp, stopApp } from "./dist/index.js";
await startApp("Desktop Crawler", ["--headless", "--firecrawl-headless"]);
stopApp("Desktop Crawler");
API Reference
startApp(appName: string, args: string[] = [], timeout: number = DEFAULT_TIMEOUT): Promise<boolean>
Starts an app with the given arguments and sets an auto-shutdown timeout.
stopApp(appName: string, timeout: number = 0): boolean
Stops the app immediately or schedules a stop after the specified timeout.
registerApp(appName: string, options: AppOptions): void
Registers a new app with the registry, specifying bundle ID and OS-specific paths.
License
MIT