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

async-workflow

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

async-workflow

Run JSON based workflows

  • 1.2.0
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

async-workflow

Run JSON based workflows

npm Travis branch

Example

const Bluebird = require('bluebird')
const Runner = require('async-workflow')

const runner = new Runner({
  startTaskId: 'clone',
  tasks: {
    clone: {
      fn(options) {
        return Bluebird.resolve('clone')
      },
      options: {
        repo: 'knownasilya/async-workflow'
      },
      successTaskId: 'install',
      failureTaskId: 'cleanup'
    },

    install: {
      // Run in parallel
      tasks: {
        installA: {
          fn() {
            return new Bluebird((resolve) => {
              setTimeout(() => {
                resolve('installA')
              }, 300)
            })
          }
        },
        installB: {
          fn() {
            return new Bluebird((resolve) => {
              setTimeout(() => {
                resolve('installB')
              }, 100)
            })
          }
        }
      },
      // Run once all pass or any fail
      successTaskId: 'test',
      failureTaskId: 'cleanup'
    },

    test: {
      fn() {
        return Bluebird.resolve('test')
      },
      successTaskId: 'deploy',
      failureTaskId: 'cleanup'
    },

    deploy: {
      fn() {
        return Bluebird.resolve('deploy')
      }
    },

    cleanup: {
      fn() {
        return Bluebird.resolve('cleanup')
      }
    }
  }
})

const results = await runner.start()

TODO

  • Test parallel tasks
  • Figure out how results should be formatted/passed along
  • Time tasks
  • docker shell run

FAQs

Package last updated on 16 Sep 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