Introducing taskz

Rap2h - Jul 24 '19 - - Dev Community

Taskz is a library for Node.js, a simple sequential and parallel task list runner for terminal.

Getting started

Install it via npm i taskz. Create your task sequence in any script file then run it.

const taskz = require("taskz");

taskz([
  {
    text: "first task - sleeps for 200ms",
    task: async () => await new Promise(resolve => setTimeout(resolve, 200));
  },
  {
    text: "this task will fail",
    task: async () => {
      throw new Error("this task failed");
    }
  }
]).run();
Enter fullscreen mode Exit fullscreen mode

So in other word, you have to create a array of tasks:

const myTasks = [
  { text: "task 1", task: () => { /* ... */ } },
  { text: "task 2", task: () => { /* ... */ } }
];
Enter fullscreen mode Exit fullscreen mode

Then pass it to the taskz function and call run to start the process:

taskz(myTasks).run();
Enter fullscreen mode Exit fullscreen mode

You can also run task in parallel:

taskz(myTasks, { parallel: true }).run();
Enter fullscreen mode Exit fullscreen mode

Other features: subtasks, stop on fail, pass context from task to task,
change text within a task during execution.

Have fun with it: link to github repository

. . . . . . . .
Terabox Video Player