npm.io
2.0.0 • Published 6 years ago

vinm-nodejs-emitter

Licence
MIT
Version
2.0.0
Deps
0
Size
3 kB
Vulns
0
Weekly
0

Vīnm Node.js Emitter

Node.js emitter for Vinm CLI.

Extend the Vinm CLI

When executing a Node.js script using Vinm CLI, vinm-emitter provide the ability to emit variables back to the execution pipeline so that it can be used in all the following tasks.

Installation

# With npm
npm i vinm-nodejs-emitter

# OR With yarn
yarn add vinm-nodejs-emitter

Usage

Considering the below Node.js script myscript.js:

module.exports.getSecret = () => {
    const vinmEmit = require('vinm-nodejs-emitter')()
    vinmEmit('mysecret', '123456')
}

Here's how we would access the mysecret var from vinm.yml:

tasks:
    get-mysecret:
        shell: >-
            node -e "require(\"./myscript.js\").getSecret()"
    print-mysecret:
        shell: >-
            echo "$vinm.mysecret"

Contributing

Contributions, issues and feature requests are welcome.

License

Copyright 2020 maoosi.
This project is MIT licensed.