@karmaniverous/get-dotenv 2.2.3 → 2.3.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/README.md CHANGED
@@ -78,17 +78,10 @@ dotenv files. You can:
78
78
  * Specify a default environment, override the default with an existing
79
79
  environment variable, and override both with a direct setting.
80
80
  * Exclude public, private, global, environment-specific, or dynamic variables.
81
- * Execute a &&-delimited series of shell commands after loading variables.
81
+ * Execute a &&-delimited series of shell commands after loading variables,
82
+ optionally ignoring errors.
82
83
  * Place the shell commands inside the invocation to support npm script
83
84
  arguments for other options.
84
- * Specify the token that identifies dotenv files (e.g. '.env').
85
- * Specify the token that identifies private vatiables (e.g. '.local').
86
-
87
- Options:
88
- -p, --paths <strings...> space-delimited paths to dotenv directory (default './')
89
- -y, --dynamic-path <string> dynamic variables path
90
- -o, --output-path <string> consolidated output file (follows dotenv-expand rules using loaded env vars)
91
- -d, --defaultEnvironment <string> default environment (prefix with $ to use environment variable)
92
85
  -e, --environment <string> designated environment (prefix with $ to use environment variable)
93
86
  -n, --exclude-env exclude environment-specific variables (default: false)
94
87
  -g, --exclude-global exclude global & dynamic variables (default: false)
@@ -99,6 +92,7 @@ Options:
99
92
  -l, --log log extracted variables (default: false)
100
93
  -t, --dotenv-token <string> token indicating a dotenv file (default: '.env')
101
94
  -i, --private-token <string> token indicating private variables (default: 'local')
95
+ -q, --throw-error throw error to shell & terminate sequential process (default: false)
102
96
  -h, --help display help for command
103
97
  ```
104
98
 
@@ -33,7 +33,8 @@ program
33
33
  `* Specify a default environment, override the default with an existing`,
34
34
  ` environment variable, and override both with a direct setting.`,
35
35
  `* Exclude public, private, global, environment-specific, or dynamic variables.`,
36
- `* Execute a &&-delimited series of shell commands after loading variables.`,
36
+ `* Execute a &&-delimited series of shell commands after loading variables,`,
37
+ ` optionally ignoring errors.`,
37
38
  `* Place the shell commands inside the invocation to support npm script`,
38
39
  ` arguments for other options.`,
39
40
  `* Specify the token that identifies dotenv files (e.g. '.env').`,
@@ -82,6 +83,10 @@ program
82
83
  .option(
83
84
  '-i, --private-token <string>',
84
85
  "token indicating private variables (default: 'local')"
86
+ )
87
+ .option(
88
+ '-q, --throw-error',
89
+ 'throw error to shell & terminate sequential process (default: false)'
85
90
  );
86
91
 
87
92
  // Parse CLI options from command line.
@@ -100,6 +105,7 @@ const {
100
105
  outputPath,
101
106
  paths,
102
107
  privateToken,
108
+ throwError,
103
109
  } = program.opts();
104
110
 
105
111
  if (command && program.args.length) program.error('command specified twice');
@@ -129,6 +135,8 @@ if (command || program.args.length) {
129
135
  .split('&&')
130
136
  .map((c) => parseArgsStringToArgv(c));
131
137
 
132
- for (const argv of argvs)
133
- spawn.sync(argv[0], argv.slice(1), { stdio: 'inherit' });
138
+ for (const argv of argvs) {
139
+ const { error } = spawn.sync(argv[0], argv.slice(1), { stdio: 'inherit' });
140
+ if (error && throwError) throw error;
141
+ }
134
142
  }
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "bin": {
4
4
  "getdotenv": "bin/getdotenv/index.js"
5
5
  },
6
- "version": "2.2.3",
6
+ "version": "2.3.0",
7
7
  "publishConfig": {
8
8
  "access": "public"
9
9
  },
@@ -31,31 +31,31 @@
31
31
  ],
32
32
  "license": "BSD-3-Clause",
33
33
  "dependencies": {
34
- "commander": "^10.0.0",
34
+ "commander": "^10.0.1",
35
35
  "cross-spawn": "^7.0.3",
36
36
  "dotenv": "^16.0.3",
37
37
  "dotenv-expand": "^10.0.0",
38
- "fs-extra": "^11.1.0",
39
- "string-argv": "^0.3.1",
38
+ "fs-extra": "^11.1.1",
39
+ "string-argv": "^0.3.2",
40
40
  "uuid": "^9.0.0"
41
41
  },
42
42
  "devDependencies": {
43
- "@babel/cli": "^7.21.0",
44
- "@babel/core": "^7.21.0",
45
- "@babel/eslint-parser": "^7.19.1",
43
+ "@babel/cli": "^7.21.5",
44
+ "@babel/core": "^7.21.8",
45
+ "@babel/eslint-parser": "^7.21.8",
46
46
  "@babel/plugin-syntax-import-assertions": "^7.20.0",
47
- "@babel/preset-env": "^7.20.2",
47
+ "@babel/preset-env": "^7.21.5",
48
48
  "@babel/register": "^7.21.0",
49
- "@types/node": "^18.15.3",
49
+ "@types/node": "^20.1.1",
50
50
  "chai": "^4.3.7",
51
51
  "concat-md": "^0.5.1",
52
- "eslint": "^8.36.0",
52
+ "eslint": "^8.40.0",
53
53
  "eslint-config-standard": "^17.0.0",
54
54
  "eslint-plugin-mocha": "^10.1.0",
55
55
  "jsdoc-to-markdown": "^8.0.0",
56
56
  "mocha": "^10.2.0",
57
- "prettier": "^2.8.4",
58
- "release-it": "^15.8.0"
57
+ "prettier": "^2.8.8",
58
+ "release-it": "^15.10.3"
59
59
  },
60
60
  "exports": {
61
61
  ".": {