@dotenvx/dotenvx 0.45.0 → 1.0.1
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 +39 -1
- package/README.md +245 -150
- package/package.json +1 -2
- package/src/cli/actions/{convert.js → encrypt.js} +4 -4
- package/src/cli/actions/{genexample.js → ext/genexample.js} +4 -4
- package/src/cli/actions/{gitignore.js → ext/gitignore.js} +1 -1
- package/src/cli/actions/{hub → ext/hub}/login.js +4 -4
- package/src/cli/actions/{hub → ext/hub}/logout.js +4 -4
- package/src/cli/actions/{hub → ext/hub}/open.js +9 -9
- package/src/cli/actions/{hub → ext/hub}/pull.js +9 -9
- package/src/cli/actions/{hub → ext/hub}/push.js +12 -12
- package/src/cli/actions/{hub → ext/hub}/status.js +2 -2
- package/src/cli/actions/{hub → ext/hub}/token.js +2 -2
- package/src/cli/actions/{ls.js → ext/ls.js} +3 -3
- package/src/cli/actions/{prebuild.js → ext/prebuild.js} +2 -2
- package/src/cli/actions/{precommit.js → ext/precommit.js} +2 -2
- package/src/cli/actions/{scan.js → ext/scan.js} +1 -1
- package/src/cli/actions/{settings.js → ext/settings.js} +2 -2
- package/src/cli/actions/{vault → ext/vault}/decrypt.js +4 -4
- package/src/cli/actions/{vault → ext/vault}/encrypt.js +6 -6
- package/src/cli/actions/{vault → ext/vault}/migrate.js +7 -7
- package/src/cli/actions/{vault → ext/vault}/status.js +2 -2
- package/src/cli/actions/run.js +1 -1
- package/src/cli/actions/set.js +8 -2
- package/src/cli/commands/ext/hub.js +89 -0
- package/src/cli/commands/ext/vault.js +36 -0
- package/src/cli/commands/ext.js +58 -0
- package/src/cli/commands/hub.js +22 -22
- package/src/cli/commands/vault.js +31 -10
- package/src/cli/dotenvx.js +88 -61
- package/src/cli/examples.js +12 -12
- package/src/cli/pro.txt +22 -0
- package/src/lib/helpers/dotenvExpand.js +81 -0
- package/src/lib/helpers/installPrecommitHook.js +5 -5
- package/src/lib/helpers/parseDecryptEvalExpand.js +10 -9
- package/src/lib/main.js +1 -7
- package/src/lib/services/precommit.js +1 -1
- package/src/lib/services/run.js +4 -3
- package/src/lib/services/sets.js +1 -1
- package/src/lib/services/vaultEncrypt.js +2 -2
|
@@ -56,7 +56,7 @@ class Precommit {
|
|
|
56
56
|
// if contents are encrypted don't raise an error
|
|
57
57
|
if (!encrypted) {
|
|
58
58
|
const error = new Error(`${file} not encrypted (or not gitignored)`)
|
|
59
|
-
error.help = `? encrypt it with [dotenvx
|
|
59
|
+
error.help = `? encrypt it with [dotenvx encrypt -f ${file}] or add ${file} to .gitignore with [echo ".env*" >> .gitignore]`
|
|
60
60
|
throw error
|
|
61
61
|
}
|
|
62
62
|
}
|
package/src/lib/services/run.js
CHANGED
|
@@ -63,7 +63,8 @@ class Run {
|
|
|
63
63
|
row.string = env
|
|
64
64
|
|
|
65
65
|
try {
|
|
66
|
-
const parsed = parseDecryptEvalExpand(env)
|
|
66
|
+
const { parsed } = parseDecryptEvalExpand(env, null, this.processEnv)
|
|
67
|
+
|
|
67
68
|
row.parsed = parsed
|
|
68
69
|
this.readableStrings.add(env)
|
|
69
70
|
|
|
@@ -93,7 +94,7 @@ class Run {
|
|
|
93
94
|
|
|
94
95
|
// if DOTENV_PRIVATE_KEY_* already set in process.env then use it
|
|
95
96
|
const privateKey = smartDotenvPrivateKey(envFilepath)
|
|
96
|
-
const parsed = parseDecryptEvalExpand(src, privateKey)
|
|
97
|
+
const { parsed } = parseDecryptEvalExpand(src, privateKey, this.processEnv)
|
|
97
98
|
row.parsed = parsed
|
|
98
99
|
|
|
99
100
|
const { injected, preExisted } = this._inject(this.processEnv, parsed, this.overload)
|
|
@@ -162,7 +163,7 @@ class Run {
|
|
|
162
163
|
|
|
163
164
|
try {
|
|
164
165
|
// parse this. it's the equivalent of the .env file
|
|
165
|
-
const parsed = parseDecryptEvalExpand(decrypted)
|
|
166
|
+
const { parsed } = parseDecryptEvalExpand(decrypted, null, this.processEnv)
|
|
166
167
|
row.parsed = parsed
|
|
167
168
|
|
|
168
169
|
const { injected, preExisted } = this._inject(this.processEnv, parsed, this.overload)
|
package/src/lib/services/sets.js
CHANGED
|
@@ -11,7 +11,7 @@ const replace = require('./../helpers/replace')
|
|
|
11
11
|
const ENCODING = 'utf8'
|
|
12
12
|
|
|
13
13
|
class Sets {
|
|
14
|
-
constructor (key, value, envFile = '.env', encrypt =
|
|
14
|
+
constructor (key, value, envFile = '.env', encrypt = true) {
|
|
15
15
|
this.key = key
|
|
16
16
|
this.value = value
|
|
17
17
|
this.envFile = envFile
|
|
@@ -22,7 +22,7 @@ class VaultEncrypt {
|
|
|
22
22
|
if (this.envFile.length < 1) {
|
|
23
23
|
const code = 'MISSING_ENV_FILES'
|
|
24
24
|
const message = 'no .env* files found'
|
|
25
|
-
const help = '? add one with [echo "HELLO=World" > .env] and then run [dotenvx vault encrypt]'
|
|
25
|
+
const help = '? add one with [echo "HELLO=World" > .env] and then run [dotenvx ext vault encrypt]'
|
|
26
26
|
|
|
27
27
|
const error = new Error(message)
|
|
28
28
|
error.code = code
|
|
@@ -41,7 +41,7 @@ class VaultEncrypt {
|
|
|
41
41
|
if (!fs.existsSync(filepath)) {
|
|
42
42
|
const code = 'MISSING_ENV_FILE'
|
|
43
43
|
const message = `file does not exist at [${filepath}]`
|
|
44
|
-
const help = `? add it with [echo "HELLO=World" > ${envFilepath}] and then run [dotenvx vault encrypt]`
|
|
44
|
+
const help = `? add it with [echo "HELLO=World" > ${envFilepath}] and then run [dotenvx ext vault encrypt]`
|
|
45
45
|
|
|
46
46
|
const error = new Error(message)
|
|
47
47
|
error.code = code
|