@dotenvx/dotenvx 0.6.6 → 0.6.8

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 CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.6.6",
2
+ "version": "0.6.8",
3
3
  "name": "@dotenvx/dotenvx",
4
4
  "description": "a better dotenv–from the creator of `dotenv`",
5
5
  "author": "@motdotla",
@@ -54,7 +54,7 @@ program
54
54
 
55
55
  // dotenvx run -- node index.js
56
56
  program.command('run')
57
- .description('inject env at runtime (example: `dotenvx run -- your-cmd`)')
57
+ .description('inject env at runtime [dotenvx run -- your-command-here]')
58
58
  .addHelpText('after', examples.run)
59
59
  .option('-f, --env-file <paths...>', 'path(s) to your env file(s)', '.env')
60
60
  .option('-o, --overload', 'override existing env variables')
@@ -159,7 +159,10 @@ program.command('run')
159
159
  // Extract command and arguments after '--'
160
160
  const commandIndex = process.argv.indexOf('--')
161
161
  if (commandIndex === -1 || commandIndex === process.argv.length - 1) {
162
- logger.error('at least one argument is required after the run command, received 0.')
162
+ logger.error('missing command after [dotenvx run --]')
163
+ logger.error('')
164
+ logger.error(' get help: [dotenvx help run]')
165
+ logger.error(' or try: [dotenvx run -- npm run dev]')
163
166
  process.exit(1)
164
167
  } else {
165
168
  const subCommand = process.argv.slice(commandIndex + 1)
@@ -1,14 +1,17 @@
1
1
  const run = function () {
2
2
  return `
3
- Example:
3
+ Examples:
4
4
 
5
- \`\`\`sh
6
- $ dotenvx run -- your-cmd
5
+ \`\`\`
6
+ $ dotenvx run -- npm run dev
7
+ $ dotenvx run -- flask --app index run
8
+ $ dotenvx run -- php artisan serve
9
+ $ dotenvx run -- bin/rails s
7
10
  \`\`\`
8
11
 
9
12
  Try it:
10
13
 
11
- \`\`\`sh
14
+ \`\`\`
12
15
  $ echo "HELLO=World" > .env
13
16
  $ echo "console.log('Hello ' + process.env.HELLO)" > index.js
14
17
 
@@ -21,15 +24,15 @@ Try it:
21
24
 
22
25
  const encrypt = function () {
23
26
  return `
24
- Example:
27
+ Examples:
25
28
 
26
- \`\`\`sh
29
+ \`\`\`
27
30
  $ dotenvx encrypt
28
31
  \`\`\`
29
32
 
30
33
  Try it:
31
34
 
32
- \`\`\`sh
35
+ \`\`\`
33
36
  $ echo "HELLO=World" > .env
34
37
  $ echo "HELLO=production" > .env.production
35
38
  $ echo "console.log('Hello ' + process.env.HELLO)" > index.js
@@ -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