Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

taskery

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

taskery

Taskery is a lightweight taskrunner, with a focus on code over configuration.

  • 0.0.1
  • unpublished
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

Taskery

Taskery is a lightweight taskrunner, with a focus on code over configuration.

Installation

npm install taskery --save

Usage

To start using taskery, either create a new instance or use the default provided by the module:

// Default instance
var taskery = require('taskery');

// New instance
var Taskery = require('taskery').Taskery;
var taskery = new Taskery();

Tasks

A task is defined by a name, its dependencies and a callback.

taskery.task('test', ['build'], function() {
    // Task execution
});

dependencies must be an array or undefined and callback must be a function or undefined, but at least one of them must be specified.

The dependencies array may contain task names or arrays of task names. Each object in the array is ran sequentially, while the arrays will themselves be ran in parallel. For example:

task('foo', () => setTimeout(() => console.log('Ran foo'), 500));
task('bar', () => console.log('Ran bar'));
task('foobar', [['foo', 'bar']])
task('foo-bar', ['foo', 'bar'])

If running 'foobar', the expected output is 'Ran bar', then 'Ran foo', while running 'foo-bar', the expected output is 'Ran foo', then 'Ran bar'.

If a task defines a callback that expects zero arguments, taskery assumes that when it returns, the task is done. If, however, asynchronous code is used inside a task, you can specify an argument that will receive a callback function:

taskery.task('asynctask', (done) => {
    someAsyncFunction(done);
})

A task may also return a Readable stream. If it does, the task is "done" when the stream emits the 'end' or 'error' events.

Middlewares

A middleware in taskery is an object with keys mapping to functions that will run on demand. Currently, there are two middleware keys available:

  • describe(name, description) => void
  • log(level, message) => void

The describe middleware is called whenever you call .describe() on a task, and the log middleware is called when taskery wants to log something.

For instance, if you are using commander, you can do this to expose your described tasks:

var commander = require('commander');
var tasks = [];
taskery.use({
    describe: (name, description) => {
        program
            .command(name)
            .description(description)
            .action(() => {
                tasks.push(name);
            })
    }
})

More examples can be seen in tests/index.spec.js

FAQs

Package last updated on 26 Jul 2016

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc