dotenv-checker

πŸ”Œ Generates through prompts the .env variables file based on a schema/defaults file

Usage no npm install needed!

<script type="module">
  import dotenvChecker from 'https://cdn.skypack.dev/dotenv-checker';
</script>

README

πŸ”Œ dotENV-checker standard-readme compliant

Environment file checker/generator

πŸ”– Description

This application is a simple checker/generator for environment files. It checks, based on a schema file, if your .env is up-to-date compared with schema variables.

In case you don't have .env file created or if it differs from schema file, it allows you to create the file through terminal prompt.

πŸ“ Installation

npm i --save-dev dotenv-checker

πŸ’» Examples

πŸ”΄ When environment file doesn't exist

Create file example

πŸ”΅ When environment file doesn't have some needed variable indicated in schema file

Update file example

πŸš€ Usage

As the library process are executed asynchronously it returns a Promise<void> when the process is done.

/**
 * Import the dotenv-checker library
 * (main method with object destructuring)
 **/
import { checkEnvFile } from 'dotenv-checker';

// Check environment variable with default config
await checkEnvFile();

βš™οΈ Usage with custom options

The library allows you to customize some options:

  • schemaFile (default '.env.schema') -- Allows you to specify the schema file with a custom name or location (paths must be specified from root directory)
  • envFile (default '.env') -- Allows you to specify the environment file to be created/checked with a custom name or location (paths must be specified from root directory)
/**
 * Import the dotenv-checker library
 * (main method with object destructuring)
 **/
import { checkEnvFile } from 'dotenv-checker';

// Check environment variable with custom config
await checkEnvFile({
  schemaFile: '.env.example',
  envFile: '.env.local',
});



πŸ“Œ Methodologies and Guidelines

These are the methodologies and guides.

Visual Studio Code Editor configurations and plugins.

Guideline JS and CSS.

⚑️ Technologies and Tools

πŸ‘· How to work with this project

βœ… Prerequisites

In order to work with this project, your local environment must have at least the following versions:

  • NodeJS Version: 10.xx or higher
  • NPM Version: 6.12.0

The following steps must be followed in order to work with this project locally.

1️⃣ Install NodeJS Dependencies

To work with this project locally, it is necessary to install the NPM dependencies.

# Install npm dependencies
$npm i

2️⃣ Development

To start working locally with the project you will need to execute the following command:

# Development
$npm run start:watch

To run the linters for this project you will need to execute the following command:

# ESLint linter
$npm run lint

# Duplicated code
$npm run lint:copy-paste

πŸ“‚ Code scaffolding

/
β”œβ”€β”€ doc
|   β”œβ”€β”€ qac πŸ”°              # Quality Assurance Code.
|   |   └── ...             # ...
|   |
β”œβ”€β”€ src
|   β”œβ”€β”€ lib
|   |   β”œβ”€β”€ file            # Methods for file writting/reading
|   |   β”œβ”€β”€ helpers         # Common methods to be used in the app
|   |   β”œβ”€β”€ logger          # Custom pretty console logs
|   |   β”œβ”€β”€ questions       # Prompt's questions code related
|   |   └── ... index.js    # Main Lib logic method
|   └── ... index.js        # Main Lib folder functionality export
└── ...

Happy Code

Created with Typescript! ⚑ and latin music 🎺🎡

This README.md file has been written keeping in mind