README
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
π΅ When environment file doesn't have some needed variable indicated in schema file
π 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 πΊπ΅