1.0.2 • Published 12 months ago
en-toolkit v1.0.2
en-toolkit
en-toolkit
is a command-line tool for generating and managing environment variables. It scans a directory for environment variables and creates a .env
file based on the results. You can configure it to exclude certain folders, specify prefixes for environment variables, and control whether to overwrite existing .env
files.
Installation
To use en-toolkit
, you need to have Node.js and npm installed. You can install the package globally using npm:
npm install -g en-toolkit
Usage
You can run en-toolkit
using the command line. Below are the available options:
Command Line Options
Option | Alias | Description | Type | Default Value |
---|---|---|---|---|
directory | -d | The directory to scan for .env variables | string | Current working directory (process.cwd() ) |
exclude | -e | Folders to exclude from the scan | array | ["node_modules", "dist", "build", "test", ".git", "coverage", "public", "out", "tmp"] |
prefixes | -p | Prefixes used with env variables | array | ["process.env"] |
name | -n | Name of the output .env file | string | .env -timestamp |
output | -o | Directory to place the generated .env file | string | Current working directory (process.cwd() ) |
overwrite | -w | Flag to overwrite the previous .env file | boolean | false |
print | Print all of the environment variables found in the directory | boolean | false | |
version | -v | Displays the current version | ||
help | -h | List all the commands |
Example
- It will generate an env in the root directory with name .env-timestamp
en-toolkit
- Specify directory and exclude folders:
en-toolkit --directory ./src --exclude '["node_modules", "dist"]'
- Specify prefixes and output directory:
en-toolkit --prefixes '["MY_APP"]' --output ./config
- Print environment variables without creating a file:
en-toolkit --print
- Overwrite existing .env file:
en-toolkit --overwrite
Contributing
Contributions are welcome! Please open an issue or a pull request if you have any improvements or bug fixes.
License
This project is licensed under the ISC License. See the LICENSE file for details.