@dotenvx/dotenvx 1.22.0 → 1.22.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -1
- package/README.md +1 -1
- package/package.json +1 -1
- package/src/cli/actions/run.js +14 -11
- package/src/cli/examples.js +1 -1
- package/src/lib/helpers/parseDecryptEvalExpand.js +3 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,7 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
-
## [Unreleased](https://github.com/dotenvx/dotenvx/compare/v1.22.
|
|
5
|
+
## [Unreleased](https://github.com/dotenvx/dotenvx/compare/v1.22.2...main)
|
|
6
|
+
|
|
7
|
+
## 1.22.2
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
|
|
11
|
+
* more lenient handling of `--` separator and better error messaging when flags are ambiguous ([#438](https://github.com/dotenvx/dotenvx/pull/438))
|
|
12
|
+
|
|
13
|
+
## 1.22.1
|
|
14
|
+
|
|
15
|
+
### Changed
|
|
16
|
+
|
|
17
|
+
* 🐞 patch loading order issue with single quotes ([#436](https://github.com/dotenvx/dotenvx/pull/436))
|
|
6
18
|
|
|
7
19
|
## 1.22.0
|
|
8
20
|
|
package/README.md
CHANGED
|
@@ -867,7 +867,7 @@ More examples
|
|
|
867
867
|
|
|
868
868
|
```sh
|
|
869
869
|
$ touch .env.ci
|
|
870
|
-
$ dotenvx set HELLO "ci encrypted" -f .env.
|
|
870
|
+
$ dotenvx set HELLO "ci encrypted" -f .env.ci
|
|
871
871
|
$ echo "console.log('Hello ' + process.env.HELLO)" > index.js
|
|
872
872
|
|
|
873
873
|
# check .env.keys for your privateKey
|
package/package.json
CHANGED
package/src/cli/actions/run.js
CHANGED
|
@@ -13,6 +13,19 @@ async function run () {
|
|
|
13
13
|
const options = this.opts()
|
|
14
14
|
logger.debug(`options: ${JSON.stringify(options)}`)
|
|
15
15
|
|
|
16
|
+
if (commandArgs.length < 1) {
|
|
17
|
+
const hasSeparator = process.argv.indexOf('--') !== -1
|
|
18
|
+
|
|
19
|
+
if (hasSeparator) {
|
|
20
|
+
console.error('missing command after [dotenvx run --]. try [dotenvx run -- yourcommand]')
|
|
21
|
+
} else {
|
|
22
|
+
const realExample = options.envFile[0] || '.env'
|
|
23
|
+
console.error(`ambiguous command due to missing '--' separator. try [dotenvx run -f ${realExample} -- yourcommand]`)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
process.exit(1)
|
|
27
|
+
}
|
|
28
|
+
|
|
16
29
|
try {
|
|
17
30
|
let envs = []
|
|
18
31
|
// handle shorthand conventions - like --convention=nextjs
|
|
@@ -106,17 +119,7 @@ async function run () {
|
|
|
106
119
|
}
|
|
107
120
|
}
|
|
108
121
|
|
|
109
|
-
|
|
110
|
-
const commandIndex = process.argv.indexOf('--')
|
|
111
|
-
if (commandIndex === -1 || commandIndex === process.argv.length - 1) {
|
|
112
|
-
logger.error('missing command after [dotenvx run --]')
|
|
113
|
-
logger.error('')
|
|
114
|
-
logger.error(' get help: [dotenvx help run]')
|
|
115
|
-
logger.error(' or try: [dotenvx run -- npm run dev]')
|
|
116
|
-
process.exit(1)
|
|
117
|
-
} else {
|
|
118
|
-
await executeCommand(commandArgs, process.env)
|
|
119
|
-
}
|
|
122
|
+
await executeCommand(commandArgs, process.env)
|
|
120
123
|
}
|
|
121
124
|
|
|
122
125
|
module.exports = run
|
package/src/cli/examples.js
CHANGED
|
@@ -20,6 +20,7 @@ function parseDecryptEvalExpand (src, privateKey = null, processEnv = process.en
|
|
|
20
20
|
const parsed = dotenv.parse(src)
|
|
21
21
|
const _quotes = quotes(src)
|
|
22
22
|
const originalParsed = { ...parsed }
|
|
23
|
+
const originalProcessEnv = { ...processEnv }
|
|
23
24
|
for (const key in parsed) {
|
|
24
25
|
try {
|
|
25
26
|
const decryptedValue = decryptValue(parsed[key], privateKey)
|
|
@@ -56,10 +57,11 @@ function parseDecryptEvalExpand (src, privateKey = null, processEnv = process.en
|
|
|
56
57
|
warnings.push(warning(e, key, privateKey))
|
|
57
58
|
}
|
|
58
59
|
}
|
|
60
|
+
|
|
59
61
|
for (const key in processEnv) {
|
|
60
62
|
// unset eval and expansion for single quotes
|
|
61
63
|
if (_quotes[key] === "'") {
|
|
62
|
-
processEnv[key] = originalParsed[key] // reset to original
|
|
64
|
+
processEnv[key] = originalProcessEnv[key] || originalParsed[key] // reset to original
|
|
63
65
|
}
|
|
64
66
|
|
|
65
67
|
try {
|