@dotenvx/dotenvx 0.6.7 → 0.6.9
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/package.json +1 -1
- package/src/cli/dotenvx.js +10 -1
- package/src/cli/helpers.js +9 -0
package/package.json
CHANGED
package/src/cli/dotenvx.js
CHANGED
|
@@ -187,6 +187,8 @@ program.command('encrypt')
|
|
|
187
187
|
}
|
|
188
188
|
|
|
189
189
|
const addedKeys = new Set()
|
|
190
|
+
const addedVaults = new Set()
|
|
191
|
+
const addedEnvFilepaths = new Set()
|
|
190
192
|
|
|
191
193
|
try {
|
|
192
194
|
logger.verbose(`generating .env.keys from ${optionEnvFile}`)
|
|
@@ -255,6 +257,9 @@ program.command('encrypt')
|
|
|
255
257
|
logger.verbose(`encrypting ${vault} as ${ciphertext}`)
|
|
256
258
|
|
|
257
259
|
dotenvVaults[vault] = ciphertext
|
|
260
|
+
|
|
261
|
+
addedVaults.add(vault) // for info logging to user
|
|
262
|
+
addedEnvFilepaths.add(envFilepath) // for info logging to user
|
|
258
263
|
} else {
|
|
259
264
|
logger.verbose(`existing ${vault}`)
|
|
260
265
|
logger.debug(`existing ${vault} as ${ciphertext}`)
|
|
@@ -279,7 +284,11 @@ program.command('encrypt')
|
|
|
279
284
|
process.exit(1)
|
|
280
285
|
}
|
|
281
286
|
|
|
282
|
-
|
|
287
|
+
if (addedEnvFilepaths.size > 0) {
|
|
288
|
+
logger.info(`encrypted to .env.vault (${[...addedEnvFilepaths]})`)
|
|
289
|
+
} else {
|
|
290
|
+
logger.info(`no changes (${optionEnvFile})`)
|
|
291
|
+
}
|
|
283
292
|
if (addedKeys.size > 0) {
|
|
284
293
|
logger.info(`${helpers.pluralize('key', addedKeys.size)} added to .env.keys (${[...addedKeys]})`)
|
|
285
294
|
}
|
package/src/cli/helpers.js
CHANGED
|
@@ -3,12 +3,15 @@ const path = require('path')
|
|
|
3
3
|
const crypto = require('crypto')
|
|
4
4
|
const { spawn } = require('child_process')
|
|
5
5
|
const xxhash = require('xxhashjs')
|
|
6
|
+
|
|
6
7
|
const XXHASH_SEED = 0xABCD
|
|
7
8
|
const NONCE_BYTES = 12
|
|
8
9
|
|
|
9
10
|
const main = require('./../lib/main')
|
|
11
|
+
const logger = require('./../shared/logger')
|
|
10
12
|
|
|
11
13
|
const RESERVED_ENV_FILES = ['.env.vault', '.env.projects', '.env.keys', '.env.me', '.env.x']
|
|
14
|
+
const REPORT_ISSUE_LINK = 'https://github.com/dotenvx/dotenvx/issues/new'
|
|
12
15
|
|
|
13
16
|
// resolve path based on current running process location
|
|
14
17
|
const resolvePath = function (filepath) {
|
|
@@ -23,6 +26,12 @@ const executeCommand = function (subCommand, env) {
|
|
|
23
26
|
})
|
|
24
27
|
|
|
25
28
|
subprocess.on('close', (code) => {
|
|
29
|
+
logger.error(`command [${subCommand.join(' ')}] failed`)
|
|
30
|
+
logger.error('')
|
|
31
|
+
logger.error(` try without dotenvx: [${subCommand.join(' ')}]`)
|
|
32
|
+
logger.error('')
|
|
33
|
+
logger.error('if that succeeds, then dotenvx is the culprit. report issue:')
|
|
34
|
+
logger.error(`<${REPORT_ISSUE_LINK}>`)
|
|
26
35
|
process.exit(code)
|
|
27
36
|
})
|
|
28
37
|
|