@dotenvx/dotenvx
Advanced tools
Comparing version 1.22.1 to 1.22.2
@@ -5,4 +5,10 @@ # Changelog | ||
## [Unreleased](https://github.com/dotenvx/dotenvx/compare/v1.22.1...main) | ||
## [Unreleased](https://github.com/dotenvx/dotenvx/compare/v1.22.2...main) | ||
## 1.22.2 | ||
### Changed | ||
* more lenient handling of `--` separator and better error messaging when flags are ambiguous ([#438](https://github.com/dotenvx/dotenvx/pull/438)) | ||
## 1.22.1 | ||
@@ -9,0 +15,0 @@ |
{ | ||
"version": "1.22.1", | ||
"version": "1.22.2", | ||
"name": "@dotenvx/dotenvx", | ||
@@ -4,0 +4,0 @@ "description": "a better dotenv–from the creator of `dotenv`", |
@@ -16,2 +16,15 @@ const path = require('path') | ||
if (commandArgs.length < 1) { | ||
const hasSeparator = process.argv.indexOf('--') !== -1 | ||
if (hasSeparator) { | ||
console.error('missing command after [dotenvx run --]. try [dotenvx run -- yourcommand]') | ||
} else { | ||
const realExample = options.envFile[0] || '.env' | ||
console.error(`ambiguous command due to missing '--' separator. try [dotenvx run -f ${realExample} -- yourcommand]`) | ||
} | ||
process.exit(1) | ||
} | ||
try { | ||
@@ -110,15 +123,5 @@ let envs = [] | ||
// Extract command and arguments after '--' | ||
const commandIndex = process.argv.indexOf('--') | ||
if (commandIndex === -1 || commandIndex === process.argv.length - 1) { | ||
logger.error('missing command after [dotenvx run --]') | ||
logger.error('') | ||
logger.error(' get help: [dotenvx help run]') | ||
logger.error(' or try: [dotenvx run -- npm run dev]') | ||
process.exit(1) | ||
} else { | ||
await executeCommand(commandArgs, process.env) | ||
} | ||
await executeCommand(commandArgs, process.env) | ||
} | ||
module.exports = run |
@@ -18,3 +18,3 @@ const run = function () { | ||
$ dotenvx run -- node index.js | ||
$ dotenvx run -f .env -- node index.js | ||
[dotenvx] injecting env (1) from .env | ||
@@ -21,0 +21,0 @@ Hello World |
217452