@kinsoncodehesion/enlint
v1.5.0
Published
Provides utility which allows the creating and syncing of env files.
Downloads
536
Readme
enlint 
Environment files can become bulky and modifying them can become quite an effort, especally when you need to make sure that your new environment variables are also duplicated in your .env.example.
Enlint will provide utility which allows the creating and syncing of env files easily.
⚙️ Installation
Install enlint as a developer dependency using npm or yarn to make it available as a command line utility in your project directory.
# Using npm
npm install --save enlint
# Using yarn
yarn -D add enlint🚀 Usage
The primary command for the CLI is enlint. You can run enlint --help to see the full list of available commands and options.
|Option|Description| | --- | --- | |-V, --version| Output the current version of the CLI. |-h, --help| Display help for the command.
📝 Example
This is an example of a formatted environment file using enlint:
#############[API Integration]
CLIENT_ID='client-123'
CLIENT_SECRET='secret-123'
HOST='https://api.integration'
#############[DB Config]
DB_HOST='localhost'
DB_NAME='postgres'
DB_PASSWORD='password'
DB_PORT='5432'
DB_USER='postgres'
#############[General]
ENVIRONMENT='staging'🧩 Commands
1. format
Formats the specified environment file by sorting variables and groups to adhere to the standard format requirements.
|Argument | Description | Required/Optional | |---|---|---| |target| The path to the .env file to format (e.g., .env.dev) |Required|
Example:
enlint format .env.local2. sync
Synchronizes the specified environment file against the default configuration file, .env.example. This is typically used to ensure a target file contains all required variables defined in the example file.
|Argument | Description | Required/Optional | |---|---|---| |target| The path to the .env file to sync (e.g., .env.production)| Required|
Example:
enlint sync .env.staging3. add
Adds a new variable to an existing group within your primary configuration file, .env.example.
Arguments:
All arguments for the add command are optional. If omitted, the CLI helper will prompt you interactively for the necessary values.
|Argument | Description | Required/Optional | |---|---|---| |section| The section (group) the new variable should be added under| Optional |name| The name of the new variable (e.g., API_KEY)| Optional |value| The default value for the new variable| Optional
Example (Direct):
enlint add CACHING REDIS_URL 'redis://127.0.0.1:6379'Example (Interactive):
enlint add
# Will prompt for section, name, and value.4. move
Allows you to move variables from your primary configuration file, .env.example . This command is designed to be interactive, prompting you to select the variable to move.
Example:
enlint move
# The CLI will guide you through selecting the variable to move.5. remove
Removes a variable from your primary configuration file, .env.example . This command is designed to be interactive, prompting you to select the variable to delete.
Arguments:
All arguments for the add command are optional. If omitted, the CLI helper will prompt you interactively for the necessary values.
|Argument | Description | Required/Optional | |---|---|---| |name| The name of the variable to be removed (e.g., API_KEY)| Optional
Example (Direct):
enlint remove REDIS_URLExample (Interactive):
enlint remove
# Will prompt for section and name.