jckw / dotenv-checker

πŸ”Œ CLI to check/generate .env files and maintain them synchronized

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

πŸ”Œ dotENV-checker standard-readme compliant

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

Automatically, when you installs the package it will add a "predev" script. In case you need it, here you have an example to make it manually

{
  "scripts": {
    // Script with "pre" in the name is executed before
    // the script named "dev" automatically
    "predev": "dotenv-checker -s .env.schema -e .env.local",
    "dev": "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-create-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 🎺🎡

This README.md file has been written keeping in mind

About

πŸ”Œ CLI to check/generate .env files and maintain them synchronized


Languages

Language:JavaScript 100.0%