-
-
Notifications
You must be signed in to change notification settings - Fork 66
Open
Labels
Description
The Problem
I expect that the order of options isn't affecting the execution. These two options should both work the same way.
./node_modules/.bin/env-cmd -r .env-cmdrc -e development --use-shell 'echo "$TEST"'
./node_modules/.bin/env-cmd -r .env-cmdrc --use-shell 'echo "$TEST"' -e development
The position of
-e
is different
But the second results in the following error while the first one works:
Error: Failed to find .env file at default paths: [./.env,./.env.js,./.env.json]
at getEnvFile (/<...>/node_modules/env-cmd/dist/get-env-vars.js:58:11)
at async Object.EnvCmd (/<...>/node_modules/env-cmd/dist/env-cmd.js:39:15)
at async Object.CLI (/<...>/node_modules/env-cmd/dist/env-cmd.js:19:16)
Why we need -e
to be the last option
We are using multiple npm scripts for different environments. For example build:staging
and build:prod
. To reduce the boilerplate code of repeating everything except the -e
option we want to create a general build
task without the -e
option that can be called in other npm scripts like this: npm run build -e development
.