dotenv-checker
v1.1.7
Published
π CLI to check/generate .env files and maintain them synchronized
Downloads
15,855
Maintainers
Readme
π dotENV-checker
Environment file checker/generator
π Description
This application is a checker/generator for environment files. It checks, based on a schema/base file, if your .env is up-to-date and it maintains them synchronized.
π¦ Installation
# Install the cli in devDependencies
$ npm i dotenv-checker -D
π Usage
{
"scripts": {
"check-env": "dotenv-checker -s .env.schema -e .env.local",
// Execute the check-env before starting your application
"dev": "npm run check-env && next dev"
}
}
π οΈ CLI Options
You can customize the cli options. Here you have the possible customizations:
π£ --schema or -s
(default: ".env.schema")
Sets the custom file to be used as a schema/base file. This is the file which is used to sync the environment file
# Set a custom schema (file to be based on)
dotenv-checker --schema .env.base
π£ --env or -e
(default: ".env.local")
Sets the custom file to be synchronized with the schema file. In case this file is out-of-sync and has some keys that the schema doesn't have, it reports the named keys to you through terminal
# File to check that needs to be in sync with schema file
dotenv-checker --env .env.local
π£ --skip-create-question or -scq
(default: "true")
By default it auto create the environment file if it doesn't exist. If you set this to "false" you can force to be asked to create it or not in case it's needed
# File to check that needs to be in sync with schema file
dotenv-checker --skip-create-question=false
π£ --skip-update-question or -suq
(default: "true")
By default it auto updates the environment file if it differs from schema file. If you set this to "false" you can force to be asked to update it or not in case it's needed
# File to check that needs to be in sync with schema file
dotenv-checker --skip-update-question=false
π» Examples
Files are in sync and no problems were found
Schema has new keys and env file is not synchronized
Environment file has keys that are not in schema
π€ Happy Code
Created with Typescript! β‘ and latin music πΊπ΅