Registry / devops / dotenv-flow-cli

dotenv-flow-cli

JSON →
library1.1.1jsnpmunverified

dotenv-flow-cli is a command-line interface (CLI) tool designed to execute shell commands with environment variables loaded from `.env` files using `dotenv-flow`'s sophisticated loading logic. It automatically processes different `.env` files based on the `NODE_ENV` and other `dotenv-flow` conventions, allowing for environment-specific configurations (e.g., `.env.development`, `.env.production`, `.env.local`). The current stable version is 1.1.1, with the last publish date over two years ago, suggesting a maintenance or stable cadence driven by its upstream dependencies, `dotenv-flow` and `dotenv-expand`. Its key differentiator from `dotenv-cli` is the reliance on `dotenv-flow`'s specific cascading `.env` file loading strategy, which includes support for `development`, `test`, `production`, and `.local` overrides, along with automatic variable expansion. It is intended as a direct wrapper, providing a convenient executable for managing environment variables for CLI commands.

npm install dotenv-flow-cli
INSTALL
IMPORT
SIG · DOTENV-FLOW-CLI
D
dotenv-flow-cli
devopsjavascriptv1.1.1
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

dotenv-flow CLI execution
dotenv-flow <command> [args...]
Primary usage is via direct shell command invocation in `package.json` scripts or terminal.
dotenv-flow with custom path
dotenv-flow -p path/to/project <command> [args...]
Use the `-p` or `--path` option to specify an alternative directory where `.env*` files are located.
dotenv-flow with command arguments
dotenv-flow -- <command> <command-arguments...>
dotenv-flow <command> <command-arguments...>
Always use the `--` separator before the command if the command itself takes arguments, to prevent `dotenv-flow-cli` from misinterpreting them.

Demonstrates global installation, creation of layered `.env` files, and executing Node.js commands to show how `dotenv-flow-cli` loads environment variables based on `NODE_ENV` and `.local` overrides.

npm install -g dotenv-flow-cli # Create example .env files echo "APP_NAME=MyFlowApp" > .env echo "API_KEY=dev_123" > .env.development echo "API_KEY=prod_xyz" > .env.production echo "DEBUG_MODE=true" > .env.development.local # Run a command in development environment NODE_ENV=development dotenv-flow -- node -e "console.log('App Name:', process.env.APP_NAME); console.log('API Key:', process.env.API_KEY); console.log('Debug Mode:', process.env.DEBUG_MODE);" # Run a command in production environment NODE_ENV=production dotenv-flow -- node -e "console.log('App Name:', process.env.APP_NAME); console.log('API Key:', process.env.API_KEY); console.log('Debug Mode:', process.env.DEBUG_MODE);"
dotenv-flow --version
Debug
Known issues
gotchaArguments intended for the underlying command may be parsed by `dotenv-flow-cli` instead, leading to unexpected behavior or lost arguments.
fix
Always use the `--` separator before the actual command if it takes additional arguments (e.g., `dotenv-flow -- my-command -p something`).
affects: >=1.0.0
gotchaMisunderstanding `dotenv-flow`'s specific file loading order (e.g., `.env.development.local` overrides `.env.development`, which overrides `.env`) can lead to environment variables not being what's expected.
fix
Refer to the comprehensive `dotenv-flow` documentation to understand the exact file loading precedence and override rules.
affects: >=1.0.0
gotchaVariable expansion (interpolation) is automatically enabled using `dotenv-expand` under the hood. This can be unexpected if users are accustomed to `dotenv-cli` without explicit expansion.
fix
Be aware that variables like `APP_URL=http://${IP}:${PORT}` will automatically resolve. If this behavior is undesired, ensure variables are properly escaped or consider alternative tools.
affects: >=1.0.0
gotchaThe package `dotenv-flow-cli` itself has not been updated in over two years (last published January 7, 2024), indicating a stable but potentially unmaintained state.
fix
While functional, major updates or compatibility with newer Node.js versions or dependency changes might be slow. Consider pinning specific versions of underlying dependencies like `dotenv-flow` if stability is critical.
affects: <=1.1.1
Errors
Common errors & fixes
command not found: dotenv-flow
`dotenv-flow-cli` is not installed globally or is not in the system's PATH.
fix
Install globally using `npm install -g dotenv-flow-cli` or `yarn global add dotenv-flow-cli`. Alternatively, use `npx dotenv-flow <command>` for ad-hoc execution without global installation.
Environment variable 'MY_VAR' is not set, but I defined it in .env
Incorrect `.env` file naming convention, `NODE_ENV` not matching, or files are not located in the current working directory or the specified path.
fix
Verify `.env` filenames adhere to `dotenv-flow` conventions (e.g., `.env`, `.env.development`, `.env.production`, `.env.local`). Ensure `NODE_ENV` is correctly set before running the `dotenv-flow` command, or use the `-p` option to specify the correct directory.
Upgrade
Version history
1.1.1latest on npm
Audit
Dependencies
dotenv-flowrequiredProvides the core logic for loading environment variables from cascading .env files.
dotenv-expandrequiredEnables variable expansion (interpolation) within .env files, allowing variables to reference each other.
Agent activity
4 hits · last 30 days
node
4
Resources
dotenv-flow-cli — npm install dotenv-flow-cli · libregistry