Socket
Socket
Sign inDemoInstall

chainprocess

Package Overview
Dependencies
0
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    chainprocess

Nodejs utility to chain executable commands with js functions as a promise chain of processes


Version published
Maintainers
1
Install size
7.05 kB
Created

Readme

Source

Example usage

import chainProcess from 'chainprocess';

// # Standard output is the input for the next chain item
chainProcess('git rev-parse --abbrev-ref HEAD')
// # You can include your own logic to process inputs
    .chain( branch => {
        console.log(`Current branch:${branch}`);
        if (branch !== 'release') {
// # Returning a function will break the chain
            return ()=> console.error('Must be on the release branch!')
        }
    })
    .chain('git add . -A')
// # Continue execution on success return code
    .chain(`git commit -m "Automated commit."`)
    .chain(`git push origin release:master --force`)
// # Can pass output to the next step
    .chain(()=> 'output is the input for the next chain item.')
// # Can pass promise as the next step
    .chain( input => new Promise(resolve => setTimeout(resolve, input.length )))
// # Chain is executed on calling the `run()` function on it
    .run()
// # Processing the erronous exit
    .catch(console.error);

Keywords

FAQs

Last updated on 04 Jul 2018

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