@carrd/tasks

A task runnder using ES6 syntax

Usage no npm install needed!

<script type="module">
  import carrdTasks from 'https://cdn.skypack.dev/@carrd/tasks';
</script>

README

A task runner using ES2015 syntax

It uses babel to compile the code.

Task example

./tasks/echo.js - output the source of the given file

import readFile from 'fs'
import join from 'path'

export default function * (options, run) {
  if (!options.path) {
    return console.error('Missing file path')
  }

  let source = yield (done) => { readFile(options.path, 'utf8', done) }

  console.log(source)
}

Run from terminal:

$ task echo --path=./tasks/echo.js

Run programmatically:

var co = require('co')
var task = require('@card/tasks')


co(function * () {
  yield task('echo', { some: 'options' })
})

Lookup formula

task setup --config=./file.json

  1. looks for a file ./tasks/setup.js
  2. looks for a file ./tasks.js and for an exported function named setup

License MIT