dotenv-extended-prepare
Protects developers from manually doing boring stuff — isn't that what we're here for?
Just run it on a cloned repo, and .env
preset will be sitting in the top-level directory for you to fill it.
.env is created based on
.env.defaults
and.env.schema
Preview
NODE_ENV=
# PORT=
# npm_package_name=
TOKEN=
Variables from
.env.defaults
are taken as optional — commented out with#
on line start.
The
.env.schema
variables definitely want you to fill them in.
Quick start
For personal usage
Simply run it after cloning another genius repo telling you to scrap around the files looking for variable names
npx dotenv-extended-prepare
For automatically respecting the time of other developers
- Install
dotenv-extended-prepare
as a development dependency:
npm i -D dotenv-extended-prepare
- Specify a
postinstall
script in your package file — it will run onnpm i
e.g.
"scripts": { "postinstall": "dotenv-extended-prepare" }
in package.json
npm set-script postinstall "dotenv-extended-prepare"
TODO
If you need to specify a custom path or name to schemas/defaults, or you don't use
dotenv-extended
at all, or you prefer using regular OGdotenv
like our grandpas did and your env sample is named.env.example
— just wait a couple of days. I'm planning to add more names for auto-search and some configuration.
Experimental
Auto-generate .env.schema
if a repo doesn't specify one
In the future, we could make it also generate .env.defaults
npx dotenv-extended-prepare generate
Why?
I like high development convenience. Almost every new project has its .env schemas/examples/samples or defaults. Usually, after cloning a new repository, the developer has to not just enter environment variables, but also search for their names, check which ones are already set by default and create an .env file.
This package is actively maintained. Give it a star, and maybe share some thoughts by opening an issue.
Caught a Bug?
- Fork this repository to your own GitHub account and then clone it to your local device
- Link the package to the global module directory:
npm link
- Within the Node app you want to test your local development instance of dotenv-extended-prepare, just link it to the dependencies:
npm link dotenv-extended-prepare
(Skip this step if you're using it vianpx
only). Instead of the default one from npm, Node.js will now use your clone of the tool!