npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@lilbunnyrabbit/task-manager

v1.0.1

Published

A flexible and powerful task management system for managing asynchronous and synchronous tasks in TypeScript.

Readme

TypeScript Task Manager

npm version npm downloads

A flexible and powerful task management system built with TypeScript. It helps in managing both synchronous and asynchronous tasks with ease, allowing you to queue tasks, execute them sequentially or in parallel, and monitor their progress.

✨ Check out the Landing Page for an Overview, Examples, and Use Cases!

🚀 Installation

To install the package, run:

npm i @lilbunnyrabbit/task-manager

🎯 Features

  • Task Orchestration – Manage workflows with sequential or parallel execution.
  • Progress Tracking – Monitor task progress with built-in state handling.
  • Type Safety – Built with TypeScript for safe task handling.
  • Composable Workflows – Reuse task groups for structured execution.
  • Error Recovery – Handle failures and continue execution.
  • Query Interface – Access task results, states, and logs.

For more details, visit the API Documentation.

🔥 Getting Started

This system revolves around three core components: Task, TaskGroup, and TaskManager.

  • Task: Represents a single unit of work with its own logic, data, execution state, and error handling.
  • TaskGroup: Allows grouping related tasks together, managing dependencies, and structuring workflows.
  • TaskManager: Orchestrates execution, handles progress tracking, and manages error recovery.

Creating a Task

Define a task using createTask:

import { createTask } from "@lilbunnyrabbit/task-manager";

const myTask = createTask<number, string>({
  name: "Example Task",
  async execute(id) {
    return `Task #${id} Completed!`;
  },
});

Grouping Tasks with TaskGroup

A TaskGroup allows structuring workflows by managing multiple tasks:

import { createTaskGroup } from "@lilbunnyrabbit/task-manager";

const exampleGroup = createTaskGroup({
  name: "Example Group",
  tasks(ids: number[]) {
    return ids.map((id) => myTask(id));
  },
});

Managing Execution with TaskManager

A TaskManager runs and tracks task execution:

import { TaskManager } from "@lilbunnyrabbit/task-manager";

const manager = new TaskManager();
manager.addTasks(exampleGroup([1, 2, 3]), myTask(4));
manager.start();

For more examples, visit the Examples Section.

📂 Use Cases

Some practical use cases of @lilbunnyrabbit/task-manager include:

See more in the Use Cases Section.

📚 API Overview

This section provides a rough TypeScript definition of the main components.

Task

A Task represents a unit of work with execution logic, progress tracking, and result management.

interface Task<TSpec extends TaskSpec> extends TaskBase<TSpec> {
  readonly id: string;
  readonly name: string;
  readonly data: TSpec["TData"]
  readonly builder: TaskBuilder<TSpec>
  readonly logs: LogEntry[];
  readonly query?: TaskQuery;

  execute(): Promise<Optional<TSpec["TResult"]>>;
  parse(): ParsedTask;
  toString(pretty?: boolean): string;
  clone(): Task<TSpec>;
}

TaskGroup

A TaskGroup manages multiple tasks and defines execution order.

interface TaskGroup<TArgs extends unknown[]> extends TaskGroupBase {
  readonly id: string;
  readonly name: string;
  readonly args: TArgs;
  readonly builder: TaskGroupBuilder<TArgs>;
  readonly mode: ExecutionMode;
  readonly tasks: ExecutableTask[];
  readonly query: TaskQuery;

  execute(): Promise<this>;
  toString(pretty?: boolean): string;
  clone(): TaskGroup<TArgs>;
}

TaskManager

A TaskManager executes tasks, tracks progress, and manages execution settings.

interface TaskManager extends TaskManagerBase {
  readonly tasks: ExecutableTask[];
  readonly query: TaskQuery;

  addTask(task: ExecutableTask): this;
  addTasks(...tasks: ExecutableTask[]): this;
  start(force?: boolean): Promise<void>;
  stop(): void;
  reset(): void;
  clearQueue(): this;
}

For full API documentation, visit the Docs.

🔧 Development

Setup

Clone the repository and install dependencies:

git clone https://github.com/lilBunnyRabbit/task-manager.git
cd task-manager
npm install

Available Scripts

| Command | Description | | ----------------------- | ----------------------------------------------------------------------------------------------------- | | npm run build | Compiles TypeScript code. | | npm test | Runs tests with Jest. | | npm run clean | Clears dist/ and node_modules/. | | npm run changeset | Manages versioning and changelog updates with Changesets. | | npm run release | Publishes the package to npm. | | npm run generate:docs | Generates API documentation. |

📦 Related Packages

These utilities complement @lilbunnyrabbit/task-manager:

| Package | Description | | ------------------------------------------------------------------------------------------------ | -------------------------------------------------- | | @lilbunnyrabbit/event-emitter | A lightweight event system for tasks. | | @lilbunnyrabbit/optional | A TypeScript utility for handling optional values. | | @lilbunnyrabbit/utils | Collection of helper functions and utilities. |

🎉 Contribution

Contributions are always welcome! For any enhancements or bug fixes, please open a pull request linked to the relevant issue. If there's no existing issue related to your contribution, feel free to create one.

💖 Support

Your support is greatly appreciated! If this package has been helpful, consider supporting its development. Your contributions help maintain and improve this project.

GitHub Sponsor

📜 License

MIT © Andraž Mesarič-Sirec