@dotenvx/dotenvx 0.31.1 → 0.32.0

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.31.1",
2
+ "version": "0.32.0",
3
3
  "name": "@dotenvx/dotenvx",
4
4
  "description": "a better dotenv–from the creator of `dotenv`",
5
5
  "author": "@motdotla",
@@ -5,8 +5,6 @@ const logger = require('./../../shared/logger')
5
5
 
6
6
  const Run = require('./../../lib/services/run')
7
7
 
8
- const REPORT_ISSUE_LINK = 'https://github.com/dotenvx/dotenvx/issues/new'
9
-
10
8
  const executeCommand = async function (commandArgs, env) {
11
9
  const signals = [
12
10
  'SIGHUP', 'SIGQUIT', 'SIGILL', 'SIGTRAP', 'SIGABRT',
@@ -43,7 +41,6 @@ const executeCommand = async function (commandArgs, env) {
43
41
  logger.debug(`could not expand process command. using [${systemCommandPath} ${commandArgs.slice(1).join(' ')}]`)
44
42
  }
45
43
 
46
- // commandProcess = execa(commandArgs[0], commandArgs.slice(1), {
47
44
  commandProcess = execa(systemCommandPath, commandArgs.slice(1), {
48
45
  stdio: 'inherit',
49
46
  env: { ...process.env, ...env }
@@ -60,17 +57,18 @@ const executeCommand = async function (commandArgs, env) {
60
57
 
61
58
  if (exitCode !== 0) {
62
59
  logger.debug(`received exitCode ${exitCode}`)
63
- throw new Error(`Command failed with exit code ${exitCode}`)
60
+ throw new Error(`Command exited with exit code ${exitCode}`)
64
61
  }
65
62
  } catch (error) {
63
+ // no color on these errors as they can be standard errors for things like jest exiting with exitCode 1 for a single failed test.
66
64
  if (error.signal !== 'SIGINT') {
67
- logger.error(error.message)
68
- logger.error(`command [${commandArgs.join(' ')}] failed`)
69
- logger.error('')
70
- logger.error(` try without dotenvx: [${commandArgs.join(' ')}]`)
71
- logger.error('')
72
- logger.error('if that succeeds, then dotenvx is the culprit. report issue:')
73
- logger.error(`<${REPORT_ISSUE_LINK}>`)
65
+ if (error.code === 'ENOENT') {
66
+ logger.errornocolor(`Unknown command: ${error.command}`)
67
+ } else if (error.message.includes('Command failed with exit code 1')) {
68
+ logger.errornocolor(`Command exited with exit code 1: ${error.command}`)
69
+ } else {
70
+ logger.errornocolor(error.message)
71
+ }
74
72
  }
75
73
 
76
74
  // Exit with the error code from the command process, or 1 if unavailable
@@ -14,6 +14,7 @@ const levels = {
14
14
  errorv: 0,
15
15
  errorvp: 0,
16
16
  errorvpb: 0,
17
+ errornocolor: 0,
17
18
  warn: 1,
18
19
  warnv: 1,
19
20
  warnvp: 1,
@@ -56,6 +57,8 @@ const dotenvxFormat = printf(({ level, message, label, timestamp }) => {
56
57
  return error(`[dotenvx@${packageJson.version}][precommit] ${formattedMessage}`)
57
58
  case 'errorvpb':
58
59
  return error(`[dotenvx@${packageJson.version}][prebuild] ${formattedMessage}`)
60
+ case 'errornocolor':
61
+ return formattedMessage
59
62
  case 'warn':
60
63
  return warn(formattedMessage)
61
64
  case 'warnv':