npm-package-to-env
Load package.json data and make it accessible via process.env (similar to npm/yarn scripts)
Install
# with npm
npm install npm-package-to-env
# or with Yarn
yarn add npm-package-to-env
Usage
As early as possible in your application, require and configure npm-package-to-env
.
;
This command will place the values defined in your package.json
into environment variables following the same convention as yarn or npm.
And then in your app:
; console; // 'my-package'console; // 'bar'
Thanks
Thanks to Jess Telford who initially shared the script behavior and the folks who maintain dotenv which I had a look at how they do things. :)
License
See LICENSE
Contributors
Thanks goes to these wonderful people (emoji key):
This project follows the all-contributors specification. Contributions of any kind welcome!