@karmaniverous/get-dotenv 4.0.0-2 → 4.0.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 +51 -57
- package/dist/index.d.cts +19 -15
- package/dist/index.d.mts +19 -15
- package/dist/index.d.ts +19 -15
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -76,62 +76,56 @@ If the value corresponding to a key is a function, it will be executed with the
|
|
|
76
76
|
|
|
77
77
|
Since keys will be evaluated progressively, each successive key function will have access to any previous ones. These keys can also override existing variables.
|
|
78
78
|
|
|
79
|
-
##
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
#
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
--vars-assignor <string> vars assignment operator string (default: "=")
|
|
130
|
-
--vars-assignor-pattern <string> vars assignment operator regex pattern
|
|
131
|
-
-h, --help display help for command
|
|
132
|
-
|
|
133
|
-
Commands:
|
|
134
|
-
cmd execute shell command string (default command)
|
|
135
|
-
help [command] display help for command
|
|
79
|
+
## Command Line Interface
|
|
80
|
+
|
|
81
|
+
You can also use `getdotenv` from the command line:
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
> npx getdotenv -h
|
|
85
|
+
|
|
86
|
+
# Usage: getdotenv [options] [command]
|
|
87
|
+
#
|
|
88
|
+
# Base CLI.
|
|
89
|
+
#
|
|
90
|
+
# Options:
|
|
91
|
+
# -e, --env <string> target environment (dotenv-expanded)
|
|
92
|
+
# -v, --vars <string> extra variables expressed as delimited key-value pairs (dotenv-expanded): KEY1=VAL1 KEY2=VAL2
|
|
93
|
+
# -c, --command <string> shell command string (dotenv-expanded)
|
|
94
|
+
# -o, --output-path <string> consolidated output file (dotenv-expanded)
|
|
95
|
+
# -p, --load-process load variables to process.env ON (default)
|
|
96
|
+
# -P, --load-process-off load variables to process.env OFF
|
|
97
|
+
# -a, --exclude-all exclude all dotenv variables from loading ON
|
|
98
|
+
# -A, --exclude-all-off exclude all dotenv variables from loading OFF (default)
|
|
99
|
+
# -z, --exclude-dynamic exclude dynamic dotenv variables from loading ON
|
|
100
|
+
# -Z, --exclude-dynamic-off exclude dynamic dotenv variables from loading OFF (default)
|
|
101
|
+
# -n, --exclude-env exclude environment-specific dotenv variables from loading
|
|
102
|
+
# -N, --exclude-env-off exclude environment-specific dotenv variables from loading OFF (default)
|
|
103
|
+
# -g, --exclude-global exclude global dotenv variables from loading ON
|
|
104
|
+
# -G, --exclude-global-off exclude global dotenv variables from loading OFF (default)
|
|
105
|
+
# -r, --exclude-private exclude private dotenv variables from loading ON
|
|
106
|
+
# -R, --exclude-private-off exclude private dotenv variables from loading OFF (default)
|
|
107
|
+
# -u, --exclude-public exclude public dotenv variables from loading ON
|
|
108
|
+
# -U, --exclude-public-off exclude public dotenv variables from loading OFF (default)
|
|
109
|
+
# -l, --log console log loaded variables ON
|
|
110
|
+
# -L, --log-off console log loaded variables OFF (default)
|
|
111
|
+
# -d, --debug debug mode ON
|
|
112
|
+
# -D, --debug-off debug mode OFF (default)
|
|
113
|
+
# --default-env <string> default target environment
|
|
114
|
+
# --dotenv-token <string> dotenv-expanded token indicating a dotenv file (default: ".env")
|
|
115
|
+
# --dynamic-path <string> dynamic variables path
|
|
116
|
+
# --paths <string> dotenv-expanded delimited list of paths to dotenv directory (default: "./")
|
|
117
|
+
# --paths-delimiter <string> paths delimiter string (default: " ")
|
|
118
|
+
# --paths-delimiter-pattern <string> paths delimiter regex pattern
|
|
119
|
+
# --private-token <string> dotenv-expanded token indicating private variables (default: "local")
|
|
120
|
+
# --vars-delimiter <string> vars delimiter string (default: " ")
|
|
121
|
+
# --vars-delimiter-pattern <string> vars delimiter regex pattern
|
|
122
|
+
# --vars-assignor <string> vars assignment operator string (default: "=")
|
|
123
|
+
# --vars-assignor-pattern <string> vars assignment operator regex pattern
|
|
124
|
+
# -h, --help display help for command
|
|
125
|
+
#
|
|
126
|
+
# Commands:
|
|
127
|
+
# cmd execute shell command string (default command)
|
|
128
|
+
# help [command] display help for command
|
|
136
129
|
```
|
|
137
130
|
|
|
131
|
+
See [this example repo](https://github.com/karmaniverous/get-dotenv-child) for a deep dive on using the `getDotenv` CLI and how to extend it for your own projects.
|
package/dist/index.d.cts
CHANGED
|
@@ -4,10 +4,18 @@ import { Command } from '@commander-js/extra-typings';
|
|
|
4
4
|
* Options passed programmatically to `getDotenvCli`.
|
|
5
5
|
*/
|
|
6
6
|
interface GetDotenvCliOptions extends Omit<GetDotenvOptions, 'paths' | 'vars'> {
|
|
7
|
+
/**
|
|
8
|
+
* Cli alias. Should align with the `bin` property in `package.json`.
|
|
9
|
+
*/
|
|
10
|
+
alias?: string;
|
|
7
11
|
/**
|
|
8
12
|
* Logs CLI internals when true.
|
|
9
13
|
*/
|
|
10
14
|
debug?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Cli description (appears in CLI help).
|
|
17
|
+
*/
|
|
18
|
+
description?: string;
|
|
11
19
|
/**
|
|
12
20
|
* A delimited string of paths to dotenv files.
|
|
13
21
|
*/
|
|
@@ -70,7 +78,7 @@ interface GetDotenvOptions {
|
|
|
70
78
|
*/
|
|
71
79
|
dotenvToken?: string;
|
|
72
80
|
/**
|
|
73
|
-
* path to
|
|
81
|
+
* path to JS module default-exporting an object keyed to dynamic variable functions
|
|
74
82
|
*/
|
|
75
83
|
dynamicPath?: string;
|
|
76
84
|
/**
|
|
@@ -78,31 +86,31 @@ interface GetDotenvOptions {
|
|
|
78
86
|
*/
|
|
79
87
|
env?: string;
|
|
80
88
|
/**
|
|
81
|
-
* exclude dynamic variables
|
|
89
|
+
* exclude dynamic variables from loading
|
|
82
90
|
*/
|
|
83
91
|
excludeDynamic?: boolean;
|
|
84
92
|
/**
|
|
85
|
-
* exclude environment-specific variables
|
|
93
|
+
* exclude environment-specific variables from loading
|
|
86
94
|
*/
|
|
87
95
|
excludeEnv?: boolean;
|
|
88
96
|
/**
|
|
89
|
-
* exclude global variables
|
|
97
|
+
* exclude global variables from loading
|
|
90
98
|
*/
|
|
91
99
|
excludeGlobal?: boolean;
|
|
92
100
|
/**
|
|
93
|
-
* exclude private variables
|
|
101
|
+
* exclude private variables from loading
|
|
94
102
|
*/
|
|
95
103
|
excludePrivate?: boolean;
|
|
96
104
|
/**
|
|
97
|
-
* exclude public variables
|
|
105
|
+
* exclude public variables from loading
|
|
98
106
|
*/
|
|
99
107
|
excludePublic?: boolean;
|
|
100
108
|
/**
|
|
101
|
-
* load dotenv to process.env
|
|
109
|
+
* load dotenv variables to `process.env`
|
|
102
110
|
*/
|
|
103
111
|
loadProcess?: boolean;
|
|
104
112
|
/**
|
|
105
|
-
* log
|
|
113
|
+
* log loaded dotenv variables to `logger`
|
|
106
114
|
*/
|
|
107
115
|
log?: boolean;
|
|
108
116
|
/**
|
|
@@ -110,7 +118,7 @@ interface GetDotenvOptions {
|
|
|
110
118
|
*/
|
|
111
119
|
logger?: Logger;
|
|
112
120
|
/**
|
|
113
|
-
* if populated, writes consolidated
|
|
121
|
+
* if populated, writes consolidated dotenv file to this path (follows dotenvExpand rules)
|
|
114
122
|
*/
|
|
115
123
|
outputPath?: string;
|
|
116
124
|
/**
|
|
@@ -180,13 +188,9 @@ type GetDotenvCliPostHookCallback = (dotenv: ProcessEnv) => Promise<void>;
|
|
|
180
188
|
*/
|
|
181
189
|
interface GetDotenvCliGenerateOptions extends Omit<GetDotenvCliOptions, 'env'> {
|
|
182
190
|
/**
|
|
183
|
-
*
|
|
191
|
+
* Logger object (defaults to console)
|
|
184
192
|
*/
|
|
185
|
-
|
|
186
|
-
/**
|
|
187
|
-
* Cli description (appears in CLI help).
|
|
188
|
-
*/
|
|
189
|
-
description?: string;
|
|
193
|
+
logger?: Logger;
|
|
190
194
|
/**
|
|
191
195
|
* Mutates inbound options & executes side effects within the `getDotenv`
|
|
192
196
|
* context before executing CLI commands.
|
package/dist/index.d.mts
CHANGED
|
@@ -4,10 +4,18 @@ import { Command } from '@commander-js/extra-typings';
|
|
|
4
4
|
* Options passed programmatically to `getDotenvCli`.
|
|
5
5
|
*/
|
|
6
6
|
interface GetDotenvCliOptions extends Omit<GetDotenvOptions, 'paths' | 'vars'> {
|
|
7
|
+
/**
|
|
8
|
+
* Cli alias. Should align with the `bin` property in `package.json`.
|
|
9
|
+
*/
|
|
10
|
+
alias?: string;
|
|
7
11
|
/**
|
|
8
12
|
* Logs CLI internals when true.
|
|
9
13
|
*/
|
|
10
14
|
debug?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Cli description (appears in CLI help).
|
|
17
|
+
*/
|
|
18
|
+
description?: string;
|
|
11
19
|
/**
|
|
12
20
|
* A delimited string of paths to dotenv files.
|
|
13
21
|
*/
|
|
@@ -70,7 +78,7 @@ interface GetDotenvOptions {
|
|
|
70
78
|
*/
|
|
71
79
|
dotenvToken?: string;
|
|
72
80
|
/**
|
|
73
|
-
* path to
|
|
81
|
+
* path to JS module default-exporting an object keyed to dynamic variable functions
|
|
74
82
|
*/
|
|
75
83
|
dynamicPath?: string;
|
|
76
84
|
/**
|
|
@@ -78,31 +86,31 @@ interface GetDotenvOptions {
|
|
|
78
86
|
*/
|
|
79
87
|
env?: string;
|
|
80
88
|
/**
|
|
81
|
-
* exclude dynamic variables
|
|
89
|
+
* exclude dynamic variables from loading
|
|
82
90
|
*/
|
|
83
91
|
excludeDynamic?: boolean;
|
|
84
92
|
/**
|
|
85
|
-
* exclude environment-specific variables
|
|
93
|
+
* exclude environment-specific variables from loading
|
|
86
94
|
*/
|
|
87
95
|
excludeEnv?: boolean;
|
|
88
96
|
/**
|
|
89
|
-
* exclude global variables
|
|
97
|
+
* exclude global variables from loading
|
|
90
98
|
*/
|
|
91
99
|
excludeGlobal?: boolean;
|
|
92
100
|
/**
|
|
93
|
-
* exclude private variables
|
|
101
|
+
* exclude private variables from loading
|
|
94
102
|
*/
|
|
95
103
|
excludePrivate?: boolean;
|
|
96
104
|
/**
|
|
97
|
-
* exclude public variables
|
|
105
|
+
* exclude public variables from loading
|
|
98
106
|
*/
|
|
99
107
|
excludePublic?: boolean;
|
|
100
108
|
/**
|
|
101
|
-
* load dotenv to process.env
|
|
109
|
+
* load dotenv variables to `process.env`
|
|
102
110
|
*/
|
|
103
111
|
loadProcess?: boolean;
|
|
104
112
|
/**
|
|
105
|
-
* log
|
|
113
|
+
* log loaded dotenv variables to `logger`
|
|
106
114
|
*/
|
|
107
115
|
log?: boolean;
|
|
108
116
|
/**
|
|
@@ -110,7 +118,7 @@ interface GetDotenvOptions {
|
|
|
110
118
|
*/
|
|
111
119
|
logger?: Logger;
|
|
112
120
|
/**
|
|
113
|
-
* if populated, writes consolidated
|
|
121
|
+
* if populated, writes consolidated dotenv file to this path (follows dotenvExpand rules)
|
|
114
122
|
*/
|
|
115
123
|
outputPath?: string;
|
|
116
124
|
/**
|
|
@@ -180,13 +188,9 @@ type GetDotenvCliPostHookCallback = (dotenv: ProcessEnv) => Promise<void>;
|
|
|
180
188
|
*/
|
|
181
189
|
interface GetDotenvCliGenerateOptions extends Omit<GetDotenvCliOptions, 'env'> {
|
|
182
190
|
/**
|
|
183
|
-
*
|
|
191
|
+
* Logger object (defaults to console)
|
|
184
192
|
*/
|
|
185
|
-
|
|
186
|
-
/**
|
|
187
|
-
* Cli description (appears in CLI help).
|
|
188
|
-
*/
|
|
189
|
-
description?: string;
|
|
193
|
+
logger?: Logger;
|
|
190
194
|
/**
|
|
191
195
|
* Mutates inbound options & executes side effects within the `getDotenv`
|
|
192
196
|
* context before executing CLI commands.
|
package/dist/index.d.ts
CHANGED
|
@@ -4,10 +4,18 @@ import { Command } from '@commander-js/extra-typings';
|
|
|
4
4
|
* Options passed programmatically to `getDotenvCli`.
|
|
5
5
|
*/
|
|
6
6
|
interface GetDotenvCliOptions extends Omit<GetDotenvOptions, 'paths' | 'vars'> {
|
|
7
|
+
/**
|
|
8
|
+
* Cli alias. Should align with the `bin` property in `package.json`.
|
|
9
|
+
*/
|
|
10
|
+
alias?: string;
|
|
7
11
|
/**
|
|
8
12
|
* Logs CLI internals when true.
|
|
9
13
|
*/
|
|
10
14
|
debug?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Cli description (appears in CLI help).
|
|
17
|
+
*/
|
|
18
|
+
description?: string;
|
|
11
19
|
/**
|
|
12
20
|
* A delimited string of paths to dotenv files.
|
|
13
21
|
*/
|
|
@@ -70,7 +78,7 @@ interface GetDotenvOptions {
|
|
|
70
78
|
*/
|
|
71
79
|
dotenvToken?: string;
|
|
72
80
|
/**
|
|
73
|
-
* path to
|
|
81
|
+
* path to JS module default-exporting an object keyed to dynamic variable functions
|
|
74
82
|
*/
|
|
75
83
|
dynamicPath?: string;
|
|
76
84
|
/**
|
|
@@ -78,31 +86,31 @@ interface GetDotenvOptions {
|
|
|
78
86
|
*/
|
|
79
87
|
env?: string;
|
|
80
88
|
/**
|
|
81
|
-
* exclude dynamic variables
|
|
89
|
+
* exclude dynamic variables from loading
|
|
82
90
|
*/
|
|
83
91
|
excludeDynamic?: boolean;
|
|
84
92
|
/**
|
|
85
|
-
* exclude environment-specific variables
|
|
93
|
+
* exclude environment-specific variables from loading
|
|
86
94
|
*/
|
|
87
95
|
excludeEnv?: boolean;
|
|
88
96
|
/**
|
|
89
|
-
* exclude global variables
|
|
97
|
+
* exclude global variables from loading
|
|
90
98
|
*/
|
|
91
99
|
excludeGlobal?: boolean;
|
|
92
100
|
/**
|
|
93
|
-
* exclude private variables
|
|
101
|
+
* exclude private variables from loading
|
|
94
102
|
*/
|
|
95
103
|
excludePrivate?: boolean;
|
|
96
104
|
/**
|
|
97
|
-
* exclude public variables
|
|
105
|
+
* exclude public variables from loading
|
|
98
106
|
*/
|
|
99
107
|
excludePublic?: boolean;
|
|
100
108
|
/**
|
|
101
|
-
* load dotenv to process.env
|
|
109
|
+
* load dotenv variables to `process.env`
|
|
102
110
|
*/
|
|
103
111
|
loadProcess?: boolean;
|
|
104
112
|
/**
|
|
105
|
-
* log
|
|
113
|
+
* log loaded dotenv variables to `logger`
|
|
106
114
|
*/
|
|
107
115
|
log?: boolean;
|
|
108
116
|
/**
|
|
@@ -110,7 +118,7 @@ interface GetDotenvOptions {
|
|
|
110
118
|
*/
|
|
111
119
|
logger?: Logger;
|
|
112
120
|
/**
|
|
113
|
-
* if populated, writes consolidated
|
|
121
|
+
* if populated, writes consolidated dotenv file to this path (follows dotenvExpand rules)
|
|
114
122
|
*/
|
|
115
123
|
outputPath?: string;
|
|
116
124
|
/**
|
|
@@ -180,13 +188,9 @@ type GetDotenvCliPostHookCallback = (dotenv: ProcessEnv) => Promise<void>;
|
|
|
180
188
|
*/
|
|
181
189
|
interface GetDotenvCliGenerateOptions extends Omit<GetDotenvCliOptions, 'env'> {
|
|
182
190
|
/**
|
|
183
|
-
*
|
|
191
|
+
* Logger object (defaults to console)
|
|
184
192
|
*/
|
|
185
|
-
|
|
186
|
-
/**
|
|
187
|
-
* Cli description (appears in CLI help).
|
|
188
|
-
*/
|
|
189
|
-
description?: string;
|
|
193
|
+
logger?: Logger;
|
|
190
194
|
/**
|
|
191
195
|
* Mutates inbound options & executes side effects within the `getDotenv`
|
|
192
196
|
* context before executing CLI commands.
|
package/package.json
CHANGED