
Product
Introducing Webhook Events for Alert Changes
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.
Executes a command using the environment variables in an package.json config file
A fork of env-cmd with diffrent defaults
A simple node program for executing commands using a package.json config.
npm install varz or npm install -g varz
Package.json
{
"config": {
"varz": {
"dev": {
"ENV1": "THANKS",
"ENV2": "FOR ALL",
"ENV3": "THE FISH"
}
}
},
"scripts": {
"test": "varz -e dev \"mocha -R spec\""
}
}
Usage: _ [options] <command> [...args]
Options:
-v, --version output the version number
-e, --environments [env1,env2,...] The rc file environment(s) to use
-f, --file [path] Custom env file path (default path: ./.env)
--fallback Fallback to default env file path, if custom env file path not found
--no-override Do not override existing environment variables
-r, --rc-file [path] Custom rc file path (default path: ./.varzrc(|.js|.json)
--silent Ignore any varz errors and only fail on executed program failure.
--use-shell Execute the command in a new shell with the given environment (true by default)
--verbose Print helpful debugging information
-x, --expand-envs Replace $var in args and command with environment variables
-h, --help output usage information
EnvCmdA function that executes a given command in a new child process with the given environment and options
options { object }
command { string }: The command to execute (node, mocha, ...)commandArgs { string[] }: List of arguments to pass to the command (['-R', 'Spec'])envFile { object }
filePath { string }: Custom path to .env file to read from (defaults to: ./.env)fallback { boolean }: Should fall back to default ./.env file if custom path does not existrc { object }
environments { string[] }: List of environment to read from the .rc filefilePath { string }: Custom path to the .rc file (defaults to: ./.varzrc(|.js|.json))options { object }
expandEnvs { boolean }: Expand $var values passed to commandArgs (default: false)noOverride { boolean }: Prevent .env file vars from overriding existing process.env vars (default: false)silent { boolean }: Ignore any errors thrown by varz, used to ignore missing file errors (default: false)useShell { boolean }: Runs command inside a new shell instance (default: true)verbose { boolean }: Prints extra debug logs to console.info (default: false)Promise<object> }: key is env var name and value is the env var valueGetEnvVarsA function that parses environment variables from a .env or a .rc file
options { object }
envFile { object }
filePath { string }: Custom path to .env file to read from (defaults to: ./.env)fallback { boolean }: Should fall back to default ./.env file if custom path does not existrc { object }
environments { string[] }: List of environment to read from the .rc filefilePath { string }: Custom path to the .rc file (defaults to: ./.varzrc(|.js|.json))verbose { boolean }: Prints extra debug logs to console.info (default: false)Promise<object> }: key is env var name and value is the env var valueBecause sometimes it is just too cumbersome passing a lot of environment variables to scripts. It is 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! 🚨
env-cmd - Executes a command using the environment variables in an env file
cross-env - Cross platform setting of environment scripts
Special thanks to env-cmd and cross-env for inspiration (uses the
same cross-spawn lib underneath too).
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 format according to ts-standardnpm test make sure all tests passnpm run test-cover make sure the coverage has not decreased from current masterFAQs
Executes a command using the environment variables in an package.json config file
We found that varz demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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.

Product
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.

Security News
ENISA has become a CVE Program Root, giving the EU a central authority for coordinating vulnerability reporting, disclosure, and cross-border response.

Product
Socket now scans OpenVSX extensions, giving teams early detection of risky behaviors, hidden capabilities, and supply chain threats in developer tools.