Socket
Socket
Sign inDemoInstall

env-cmd

Package Overview
Dependencies
8
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    env-cmd

Executes a command using the envs in the provided env file


Version published
Weekly downloads
773K
decreased by-19.19%
Maintainers
1
Install size
98.3 kB
Created
Weekly downloads
 

Changelog

Source

3.0.0

  • Feature: Added ability to use an .env-cmdrc file to hold multiple configs
  • Feature: Added ability to pass in a regular .js file exporting an object for your env file (special thanks to Jon Scheiding!)
  • Change: Updated core cross-spawn lib to 5.0.1

Readme

Source

Travis Coveralls npm npm npm Standard - JavaScript Style Guide

env-cmd

A simple node program for executing commands using an environment from an env file.

Install

npm install env-cmd

Usage

Environment file ./test/.env

# This is a comment
ENV1=THANKS # Yay inline comments support
ENV2=FOR ALL
ENV3 THE FISH # This format is also accepted

Package.json

{
  "scripts": {
    "test": "env-cmd ./test/.env mocha -R spec"
  }
}

or

Terminal

./node_modules/.bin/env-cmd ./test/.env node index.js

or

.env-cmdrc file .env-cmdrc

{
  "development": {
    "ENV1": "Thanks",
    "ENV2": "For All"
  },
  "production": {
    "ENV1": "The Fish"
  }
}
./node_modules/.bin/env-cmd production node index.js

Environment File Formats

These are the currently accepted environment file formats. If any other formats are desired please create an issue.

  • key=value
  • key value
  • Key/value pairs as JSON
  • JavaScript file exporting an object
  • .env-cmdrc file (as valid json) in execution directory

Why

Because sometimes its just too cumbersome passing lots of environment variables to scripts. Its usually just easier to have a file with all the vars in them, especially for development and testing.

Do not commit sensitive environment data to a public git repo!

cross-env - Cross platform setting of environment scripts

Special Thanks

Special thanks to cross-env for inspiration (use's the same cross-spawn lib underneath too).

Contributors

  • Eric Lanehart
  • Jon Scheiding

Contributing Guide

I welcome all pull requests. Please make sure you add appropriate test cases for any features added. Before opening a PR please make sure to run the following scripts:

  • npm run lint checks for code errors and formats according to js-standard
  • npm test make sure all tests pass
  • npm run test-cover make sure the coverage has not decreased from current master

Keywords

FAQs

Last updated on 03 Dec 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