lenv
v0.0.2
Published
A lightweight CLI tool to load .env variables into your shell environment seamlessly, supporting Node.js, React, Next.js, and TypeScript projects.
Maintainers
Readme
lenv ⚡
“Load your .env seamlessly. Keep your shell in sync.”
lenv is a lightweight CLI tool that reads a .env file and exports all variables into your shell environment. Perfect for Node.js, React, Next.js, TypeScript projects, or any workflow where you want your environment variables loaded instantly without extra dependencies.
Features
- 🛠 Simple CLI: load
.envinto your current shell - ⚡ Bash & Zsh compatible: works in any POSIX shell
- 🧩 No external dependencies: pure Node.js
- 🌐 Supports quotes & escapes: handles single/double quotes safely
- 🚀 Quick setup:
eval "$(lenv)"orsource env_vars.sh
Installation
npm install -g lenv
# or
yarn global add lenv
# or
pnpm add -g lenvBasic Usage
# Load environment variables into the current shell
eval "$(lenv)"
# Or create a file to source later
lenv > env_vars.sh
source env_vars.sh
# Now the variables are available
echo $MY_VARIABLE
lenvautomatically reads.envfrom your current working directory. You can pass a custom path as an argument:lenv /path/to/project.
Example .env
RUNTIME=SANDBOX
API_KEY="123456"
MY_SECRET='super secret'After running eval "$(lenv)", all variables are available in your shell:
echo $RUNTIME # SANDBOX
echo $API_KEY # 123456
echo $MY_SECRET # super secretAdvanced
- Quotes in values are stripped automatically.
- Single quotes are escaped for safe Bash export.
- Lines starting with
#or empty lines are ignored.
License
MIT License – see LICENSE for details.
Author: Estarlin R (estarlincito.com)
