Socket
Socket
Sign inDemoInstall

async-workflow

Package Overview
Dependencies
3
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    async-workflow

Run JSON based workflows


Version published
Weekly downloads
4
Maintainers
1
Install size
686 kB
Created
Weekly downloads
 

Readme

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

Last updated on 16 Sep 2016

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc