JavaScript Task Specification
Task is unit of execution. In the javascript world, there have existing hundreds of tasks that we can use,
like coffee-script, sass, less, jade, haml, uglifyjs, cleancss, jshint, csslint, jasmine, etc. But they are all unconnected, this specification addresses how tasks should be written in order to be connected that can be both client and server side.
taskis an object or function with arunmethod whose behavior conforms to this specification.thenableis an object or function that defines athenmethod.inputsis an array of Record instances or javascript objects.loggeris aLoggingobject, default isconsole.
A task must provide a run method must returning a thenable. A task’s run method accepts three arguments, and all arguments are optional:
run([inputs [, options [, logger]]])Within Common.JS modules ecosystem, the entry point module like index.js should exports run method:
// index.js
exports.run = function(inputs, options, logger){
return new Promise(function(resolve, reject){
logger.log("it's work")
resolve(inputs);
})
}