vinm-nodejs-emitter

Node.js emitter for Vinm CLI.

Usage no npm install needed!

<script type="module">
  import vinmNodejsEmitter from 'https://cdn.skypack.dev/vinm-nodejs-emitter';
</script>

README

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.