A clever .env (made clever-er with env-smart)
$ npm i vne
;// Your .env file, made more useful.// See example below.console;
vne has two assumptions about your project: 1) your environment file has a filename of
.env and 2) this file in the root of your project. If one of those assumptions are incorrect, you can specify an absolute
path to your environment file and
vne will use that.
Take this sample
vne takes the
.env file and produces an object like this:
Variables with names differentiated by numbers are intelligently placed into an array for easy iteration. A use case would be a handful of tokens you want to have admin access to your API.
Other variables in your
.env file with a
· gets placed into a nested object for easy querying. That way, you will be able to do something like this (check the
That one-liner checks to see if your app is running in a
development environment or not (of course, this assumes that you are setting your environment when starting your app). Check out the
scripts section of this
package.json file for reference.
Anyhoo, if your app is running in
development mode the parameter on the left side of the
: will be called. If not (it's running in
production mode), the parameter on the right side is called.
# Run all tests, sequentially$ npm test# Test dependencies for latest versions$ npm run test:dependencies# Lint "src" directory$ npm run test:typescript# Test this module$ npm run test:assert