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

task-graph-processor

v0.4.0

Published

A reference task-runner for the [watch-task-protocol](../watch-task-protocol/readme.md) including reference implementations for popular build tools like `TypeScript`.

Readme

task-graph-processor

A reference task-runner for the watch-task-protocol including reference implementations for popular build tools like TypeScript.

taskfiles

Your tasks are declared in so-called "taskfiles". A taskfile can contain multiple tasks and you can also have as many taskfiles as you wish. Tasks can depend on tasks from other taskfiles.

Example:

// frontend/taskfile.json
{
  "build": {
    "command": "tsc",
    "dependencies": ["../lib:build"]
  }
}

// backend/taskfile.json
{
  "build": {
    "command": "tsc",
    "dependencies": ["../lib:build"]
  }
}

// lib/taskfile.json
{
  "build": {
    "command": "tsc"
  }
}

Running tgp build:frontend build:backend will then first build the project lib and then the projects frontend and backend in parallel. If the task build of lib fails, then it won't attempt building frontend or backend.

watch mode

The whole point of this project is correctly supporting & orchestrating the watch mode of build tools. If all your build tools support the watch-task-protocol you can just run tgp taskname --watch and it will automatically re-run your task-graph correctly.

If you have tools that don't support the watch-task-protocol you have the following options:

let the task runner watch files

Instead of starting your build tool in watch-mode, you can tell the task-runner which files to watch, and to restart the task when changes are detected. For this, just specify your glob patterns in an array to the watch property of the task.

An example taskfile could then look like this:

{
  "build": {
    "command": "tsc",
    "watch": ["src/**/*.ts"]
  }
}

create a wrapper

If the tool also has a library-interface, we may be able to build a wrapper around it that does support the protocol. Until we get a broad adoption of the protocol, we welcome such wrappers in this repository. You can find them in the build-tools directory. Currently the following build tools are supported:

  • TypeScript

request support for a restart-trigger

You might be able to convince the authors of the build-tool to give us some way to tell it to only re-run a task if it gets a message from the outside of the process (for example a STDIN-input or a http-request). Detecting a finished or failed task can usually be achieved by parsing the STDOUT of the process and usually does not require a change.

If the tool finally supports the features we need, although not in a protocol-conformant way, we can tell the task-graph-processor how to handle it. This can be done through the following task properties:

triggerStart:

An object of the following stucture:

{ "stdin": "START_MESSAGE"}

where START_MESSAGE is the text that should be written to STDIN of the process to trigger the restart. In the future, we might support different channels than STDIN, like for example HTTP.

When not specified, it defaults to the watch-task-protocol:

{ "stdin": "WATCH_TASK_PROTOCOL:START" }

detectEnd:

An object of the following structure:

{ "stdout": {
  "success": "SUCCESS_MESSAGE",
  "failure": "FAILURE_MESSAGE"
}}

In this configuration, the task is considered successful as soon as SUCCESS_MESSAGE is received via STDOUT and it is considered as failed when FAILURE_MESSAGE is received. In the future, we might support different channels than STDOUT.

When not specified, it defaults to the watch-task-protocol:

{ "stdout": {
  "success": "WATCH_TASK_PROTOCOL:SUCCEEDED",
  "failure": "WATCH_TASK_PROTOCOL:FAILED"
}}

detectChanges:

An object of the following structure:

{ "stdout": "CHANGE_MESSAGE" }

In this configuration, the the task runner will schedula a re-run as soon as CHANGE_MESSAGE is received via STDOUT. In the future, we might support different channels than STDOUT.

When not specified, it defaults to the watch-task-protocol:

{ "stdout": "WATCH_TASK_PROTOCOL:DETECTED_CHANGES" }