GithubHelp home page GithubHelp logo

bebraw / taskist Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 176 KB

Glues your project configuration and tasks together (MIT)

Home Page: https://npmjs.org/package/taskist

License: MIT License

JavaScript 100.00%

taskist's Introduction

build status

taskist - Glues your project configuration and tasks together

taskist provides a simple and safe way to glue your project configuration and tasks together. It uses node-schedule internally. The basic idea is simple. Consider the example below (see also demo/):

  • index.js - Project main
  • config.js - Project configuration
  • tasks/ - Project tasks
  • tasks/index.js - Task aggregator (use require-dir) or similar if you like
  • tasks/demo.js - Just a demo task

File contents:

index.js:

var taskist = require('taskist');

var tasks = require('./tasks');
var config = require('./config');


main();

function main() {
    // initialize and start tasks here
    taskist(config.tasks, tasks);
}

config.js:

module.exports = {
    tasks: {
        demo: {second: 30} // trigger twice per minute
    }
};

tasks/index.js:

module.exports = require('require-dir')('.');

tasks/demo.js:

module.exports = function(cb) {
    console.log('demo');

    cb();
};

taskist simply glues your tasks and configuration together and begins to run your tasks. That's it! In case you misspell a task at your configuration or forget to invoke some task, taskist will kindly remind you about it. This way you can be sure the right tasks get run.

In case you wish to trigger the tasks immediately pass {instant: true} as third parameter to taskist. Besides a boolean you may also pass a function to instant. In this case the function will be invoked once the functions have completed. It is possible to override this behavior per task by setting instant as false at configuration. Ie. task: {hour: 10, instant: false} would work.

If you want to execute instant tasks in series, set {series: true}.

License

taskist is available under MIT. See LICENSE for more details.

taskist's People

Contributors

bebraw avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.