@karmaniverous/get-dotenv 3.1.6 → 3.1.7
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
|
@@ -7,7 +7,7 @@ Load environment variables with a cascade of environment-aware dotenv files. You
|
|
|
7
7
|
- Define dynamic variables progressively in terms of other variables and other logic.
|
|
8
8
|
- Exclude public, private, global, environment-specific, or dynamic variables.
|
|
9
9
|
- Specify explicit variables to include.
|
|
10
|
-
- Extract the resulting variables to an object, `process.env`, a dotenv file, or a logger, in any combination.
|
|
10
|
+
- Extract the resulting variables to an object, `process.env`, a dotenv file, or a logger object, in any combination.
|
|
11
11
|
- Execute a shell command within the resulting environment. You can even nest additional `getdotenv` calls!
|
|
12
12
|
- Specify the directories containing your dotenv files.
|
|
13
13
|
- Specify the filename token that identifies dotenv files (e.g. '.env').
|
|
@@ -235,7 +235,7 @@ get-dotenv options type
|
|
|
235
235
|
| [excludePublic] | <code>bool</code> | exclude public variables |
|
|
236
236
|
| [loadProcess] | <code>bool</code> | load dotenv to process.env |
|
|
237
237
|
| [log] | <code>bool</code> | log result to logger |
|
|
238
|
-
| [logger] | <code>function</code> | logger
|
|
238
|
+
| [logger] | <code>function</code> | logger object (defaults to console) |
|
|
239
239
|
| [outputPath] | <code>string</code> | if populated, writes consolidated .env file to this path (follows [dotenv-expand rules](https://github.com/motdotla/dotenv-expand/blob/master/tests/.env)) |
|
|
240
240
|
| [paths] | <code>Array.<string></code> | array of input directory paths |
|
|
241
241
|
| [privateToken] | <code>string</code> | token indicating private variables |
|
package/bin/getdotenv/index.js
CHANGED
|
@@ -35,7 +35,7 @@ const pruneVars = (getdotenvDefaultOptions, options) => (0, _lodash.default)({
|
|
|
35
35
|
* @property {bool} [excludePublic] - exclude public variables
|
|
36
36
|
* @property {bool} [loadProcess] - load dotenv to process.env
|
|
37
37
|
* @property {bool} [log] - log result to logger
|
|
38
|
-
* @property {function} [logger] - logger
|
|
38
|
+
* @property {function} [logger] - logger object (defaults to console)
|
|
39
39
|
* @property {string} [outputPath] - if populated, writes consolidated .env file to this path (follows {@link https://github.com/motdotla/dotenv-expand/blob/master/tests/.env dotenv-expand rules})
|
|
40
40
|
* @property {string[]} [paths] - array of input directory paths
|
|
41
41
|
* @property {string} [privateToken] - token indicating private variables
|
|
@@ -66,7 +66,7 @@ const getDotenv = async function () {
|
|
|
66
66
|
excludePublic,
|
|
67
67
|
loadProcess,
|
|
68
68
|
log,
|
|
69
|
-
logger = console
|
|
69
|
+
logger = console,
|
|
70
70
|
outputPath,
|
|
71
71
|
paths,
|
|
72
72
|
privateToken
|
|
@@ -159,7 +159,7 @@ const getDotenvSync = function () {
|
|
|
159
159
|
excludePublic,
|
|
160
160
|
loadProcess,
|
|
161
161
|
log,
|
|
162
|
-
logger = console
|
|
162
|
+
logger = console,
|
|
163
163
|
outputPath,
|
|
164
164
|
paths,
|
|
165
165
|
privateToken
|
|
@@ -66,7 +66,7 @@ var _options = require("./options.js");
|
|
|
66
66
|
*/
|
|
67
67
|
const getDotenvCli = function () {
|
|
68
68
|
let {
|
|
69
|
-
logger = console
|
|
69
|
+
logger = console,
|
|
70
70
|
preHook,
|
|
71
71
|
postHook,
|
|
72
72
|
...cliOptionsCustom
|
|
@@ -104,10 +104,10 @@ const getDotenvCli = function () {
|
|
|
104
104
|
const excludeAll = excludeDynamic && (excludeEnv && excludeGlobal || excludePrivate && excludePublic);
|
|
105
105
|
return new _commander.Command().name(alias).description(description).enablePositionalOptions().passThroughOptions().option('-e, --env <string>', 'target environment', _dotenvExpand.dotenvExpand, env).option('-v, --vars <string>', `dotenv-expanded delimited key-value pairs: ${[['KEY1', 'VAL1'], ['KEY2', 'VAL2']].map(v => v.join(varsAssignor)).join(varsDelimiter)}`, _dotenvExpand.dotenvExpand).option('-c, --command <string>', 'dotenv-expanded shell command string', _dotenvExpand.dotenvExpand, command).option('-o, --output-path <string>', 'consolidated output file, follows dotenv-expand rules using loaded env vars', _dotenvExpand.dotenvExpand, outputPath).addOption(new _commander.Option('-p, --load-process', `load variables to process.env ON${loadProcess ? ' (default)' : ''}`).conflicts('loadProcessOff')).addOption(new _commander.Option('-P, --load-process-off', `load variables to process.env OFF${!loadProcess ? ' (default)' : ''}`).conflicts('loadProcess')).addOption(new _commander.Option('-a, --exclude-all', `exclude all dotenv variables from loading ON${excludeAll ? ' (default)' : ''}`).conflicts('excludeAllOff')).addOption(new _commander.Option('-A, --exclude-all-off', `exclude all dotenv variables from loading OFF${!excludeAll ? ' (default)' : ''}`).conflicts('excludeAll')).addOption(new _commander.Option('-z, --exclude-dynamic', `exclude dynamic dotenv variables from loading ON${excludeDynamic ? ' (default)' : ''}`).conflicts('excludeDynamicOff')).addOption(new _commander.Option('-Z, --exclude-dynamic-off', `exclude dynamic dotenv variables from loading OFF${!excludeDynamic ? ' (default)' : ''}`).conflicts('excludeDynamic')).addOption(new _commander.Option('-n, --exclude-env', `exclude environment-specific dotenv variables from loading${excludeEnv ? ' (default)' : ''}`).conflicts('excludeEnvOff')).addOption(new _commander.Option('-N, --exclude-env-off', `exclude environment-specific dotenv variables from loading OFF${!excludeEnv ? ' (default)' : ''}`).conflicts('excludeEnv')).addOption(new _commander.Option('-g, --exclude-global', `exclude global dotenv variables from loading ON${excludeGlobal ? ' (default)' : ''}`).conflicts('excludeGlobalOff')).addOption(new _commander.Option('-G, --exclude-global-off', `exclude global dotenv variables from loading OFF${!excludeGlobal ? ' (default)' : ''}`).conflicts('excludeGlobal')).addOption(new _commander.Option('-r, --exclude-private', `exclude private dotenv variables from loading ON${excludePrivate ? ' (default)' : ''}`).conflicts('excludePrivateOff')).addOption(new _commander.Option('-R, --exclude-private-off', `exclude private dotenv variables from loading OFF${!excludePrivate ? ' (default)' : ''}`).conflicts('excludePrivate')).addOption(new _commander.Option('-u, --exclude-public', `exclude public dotenv variables from loading ON${excludePublic ? ' (default)' : ''}`).conflicts('excludePublicOff')).addOption(new _commander.Option('-U, --exclude-public-off', `exclude public dotenv variables from loading OFF${!excludePublic ? ' (default)' : ''}`).conflicts('excludePublic')).addOption(new _commander.Option('-l, --log', `console log loaded variables ON${log ? ' (default)' : ''}`).conflicts('logOff')).addOption(new _commander.Option('-L, --log-off', `console log loaded variables OFF${!log ? ' (default)' : ''}`).conflicts('log')).addOption(new _commander.Option('-d, --debug', `debug mode ON${debug ? ' (default)' : ''}`).conflicts('debugOff')).addOption(new _commander.Option('-D, --debug-off', `debug mode OFF${!debug ? ' (default)' : ''}`).conflicts('debug')).option('--default-env <string>', 'default target environment', _dotenvExpand.dotenvExpand, defaultEnv).option('--dotenv-token <string>', 'dotenv-expanded token indicating a dotenv file', _dotenvExpand.dotenvExpand, dotenvToken).option('--dynamic-path <string>', 'dynamic variables path', _dotenvExpand.dotenvExpand, dynamicPath).option('--paths <string>', 'dotenv-expanded delimited list of paths to dotenv directory', _dotenvExpand.dotenvExpand, paths).option('--paths-delimiter <string>', 'paths delimiter string', pathsDelimiter).option('--paths-delimiter-pattern <string>', 'paths delimiter regex pattern', pathsDelimiterPattern).option('--private-token <string>', 'dotenv-expanded token indicating private variables', _dotenvExpand.dotenvExpand, privateToken).option('--vars-delimiter <string>', 'vars delimiter string', varsDelimiter).option('--vars-delimiter-pattern <string>', 'vars delimiter regex pattern', varsDelimiterPattern).option('--vars-assignor <string>', 'vars assignment operator string', varsAssignor).option('--vars-assignor-pattern <string>', 'vars assignment operator regex pattern', varsAssignorPattern).addCommand(new _commander.Command().name('cmd').description('execute shell command string (default command)').configureHelp({
|
|
106
106
|
showGlobalOptions: true
|
|
107
|
-
}).enablePositionalOptions().passThroughOptions().action(async (options,
|
|
108
|
-
|
|
107
|
+
}).enablePositionalOptions().passThroughOptions().action(async (options, command) => {
|
|
108
|
+
const {
|
|
109
109
|
args
|
|
110
|
-
} =
|
|
110
|
+
} = command;
|
|
111
111
|
if (args.length) await (0, _execa.execaCommand)(args.join('\\ '), {
|
|
112
112
|
stdio: 'inherit',
|
|
113
113
|
shell: true
|
package/lib/getDotenv.js
CHANGED
|
@@ -32,7 +32,7 @@ const pruneVars = (getdotenvDefaultOptions, options) =>
|
|
|
32
32
|
* @property {bool} [excludePublic] - exclude public variables
|
|
33
33
|
* @property {bool} [loadProcess] - load dotenv to process.env
|
|
34
34
|
* @property {bool} [log] - log result to logger
|
|
35
|
-
* @property {function} [logger] - logger
|
|
35
|
+
* @property {function} [logger] - logger object (defaults to console)
|
|
36
36
|
* @property {string} [outputPath] - if populated, writes consolidated .env file to this path (follows {@link https://github.com/motdotla/dotenv-expand/blob/master/tests/.env dotenv-expand rules})
|
|
37
37
|
* @property {string[]} [paths] - array of input directory paths
|
|
38
38
|
* @property {string} [privateToken] - token indicating private variables
|
|
@@ -62,7 +62,7 @@ export const getDotenv = async (options = {}) => {
|
|
|
62
62
|
excludePublic,
|
|
63
63
|
loadProcess,
|
|
64
64
|
log,
|
|
65
|
-
logger = console
|
|
65
|
+
logger = console,
|
|
66
66
|
outputPath,
|
|
67
67
|
paths,
|
|
68
68
|
privateToken,
|
|
@@ -175,7 +175,7 @@ export const getDotenvSync = (options = {}) => {
|
|
|
175
175
|
excludePublic,
|
|
176
176
|
loadProcess,
|
|
177
177
|
log,
|
|
178
|
-
logger = console
|
|
178
|
+
logger = console,
|
|
179
179
|
outputPath,
|
|
180
180
|
paths,
|
|
181
181
|
privateToken,
|
package/lib/getDotenvCli.js
CHANGED
|
@@ -63,7 +63,7 @@ import {
|
|
|
63
63
|
* @returns {object} The CLI command.
|
|
64
64
|
*/
|
|
65
65
|
export const getDotenvCli = ({
|
|
66
|
-
logger = console
|
|
66
|
+
logger = console,
|
|
67
67
|
preHook,
|
|
68
68
|
postHook,
|
|
69
69
|
...cliOptionsCustom
|
|
@@ -326,7 +326,8 @@ export const getDotenvCli = ({
|
|
|
326
326
|
.configureHelp({ showGlobalOptions: true })
|
|
327
327
|
.enablePositionalOptions()
|
|
328
328
|
.passThroughOptions()
|
|
329
|
-
.action(async (options,
|
|
329
|
+
.action(async (options, command) => {
|
|
330
|
+
const { args } = command;
|
|
330
331
|
if (args.length)
|
|
331
332
|
await execaCommand(args.join('\\ '), {
|
|
332
333
|
stdio: 'inherit',
|