@karmaniverous/get-dotenv 4.0.0-3 → 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 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
- ## More to Come!
80
-
81
- Implementation always runs a little behind documentation. These topics & improvements are coming soon:
82
-
83
- - An example of dotenv-based environment config.
84
- - Integrating `getdotenv` into your npm scripts.
85
- - Creating a `getdotenv`-based CLI.
86
- - Some gotchas & tips around managing your shell execution context.
87
-
88
- # Command Line Interface
89
-
90
- Note that the defaults below can be changed in your own environment by deriving your base CLI using the [`generateDotenvCli`](./src/generateGetDotenvCli.ts) function or placing a `getdotenv.options.json` file in your project root directory.
91
-
92
- ```text
93
- Usage: getdotenv [options] [command]
94
-
95
- Base CLI.
96
-
97
- Options:
98
- -e, --env <string> target environment (dotenv-expanded)
99
- -v, --vars <string> extra variables expressed as delimited key-value pairs (dotenv-expanded): KEY1=VAL1 KEY2=VAL2
100
- -c, --command <string> shell command string (dotenv-expanded)
101
- -o, --output-path <string> consolidated output file (dotenv-expanded)
102
- -p, --load-process load variables to process.env ON (default)
103
- -P, --load-process-off load variables to process.env OFF
104
- -a, --exclude-all exclude all dotenv variables from loading ON
105
- -A, --exclude-all-off exclude all dotenv variables from loading OFF (default)
106
- -z, --exclude-dynamic exclude dynamic dotenv variables from loading ON
107
- -Z, --exclude-dynamic-off exclude dynamic dotenv variables from loading OFF (default)
108
- -n, --exclude-env exclude environment-specific dotenv variables from loading
109
- -N, --exclude-env-off exclude environment-specific dotenv variables from loading OFF (default)
110
- -g, --exclude-global exclude global dotenv variables from loading ON
111
- -G, --exclude-global-off exclude global dotenv variables from loading OFF (default)
112
- -r, --exclude-private exclude private dotenv variables from loading ON
113
- -R, --exclude-private-off exclude private dotenv variables from loading OFF (default)
114
- -u, --exclude-public exclude public dotenv variables from loading ON
115
- -U, --exclude-public-off exclude public dotenv variables from loading OFF (default)
116
- -l, --log console log loaded variables ON
117
- -L, --log-off console log loaded variables OFF (default)
118
- -d, --debug debug mode ON
119
- -D, --debug-off debug mode OFF (default)
120
- --default-env <string> default target environment
121
- --dotenv-token <string> dotenv-expanded token indicating a dotenv file (default: ".env")
122
- --dynamic-path <string> dynamic variables path
123
- --paths <string> dotenv-expanded delimited list of paths to dotenv directory (default: "./")
124
- --paths-delimiter <string> paths delimiter string (default: " ")
125
- --paths-delimiter-pattern <string> paths delimiter regex pattern
126
- --private-token <string> dotenv-expanded token indicating private variables (default: "local")
127
- --vars-delimiter <string> vars delimiter string (default: " ")
128
- --vars-delimiter-pattern <string> vars delimiter regex pattern
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
@@ -8,14 +8,14 @@ interface GetDotenvCliOptions extends Omit<GetDotenvOptions, 'paths' | 'vars'> {
8
8
  * Cli alias. Should align with the `bin` property in `package.json`.
9
9
  */
10
10
  alias?: string;
11
- /**
12
- * Cli description (appears in CLI help).
13
- */
14
- description?: string;
15
11
  /**
16
12
  * Logs CLI internals when true.
17
13
  */
18
14
  debug?: boolean;
15
+ /**
16
+ * Cli description (appears in CLI help).
17
+ */
18
+ description?: string;
19
19
  /**
20
20
  * A delimited string of paths to dotenv files.
21
21
  */
@@ -78,7 +78,7 @@ interface GetDotenvOptions {
78
78
  */
79
79
  dotenvToken?: string;
80
80
  /**
81
- * path to file exporting an object keyed to dynamic variable functions
81
+ * path to JS module default-exporting an object keyed to dynamic variable functions
82
82
  */
83
83
  dynamicPath?: string;
84
84
  /**
@@ -86,31 +86,31 @@ interface GetDotenvOptions {
86
86
  */
87
87
  env?: string;
88
88
  /**
89
- * exclude dynamic variables
89
+ * exclude dynamic variables from loading
90
90
  */
91
91
  excludeDynamic?: boolean;
92
92
  /**
93
- * exclude environment-specific variables
93
+ * exclude environment-specific variables from loading
94
94
  */
95
95
  excludeEnv?: boolean;
96
96
  /**
97
- * exclude global variables
97
+ * exclude global variables from loading
98
98
  */
99
99
  excludeGlobal?: boolean;
100
100
  /**
101
- * exclude private variables
101
+ * exclude private variables from loading
102
102
  */
103
103
  excludePrivate?: boolean;
104
104
  /**
105
- * exclude public variables
105
+ * exclude public variables from loading
106
106
  */
107
107
  excludePublic?: boolean;
108
108
  /**
109
- * load dotenv to process.env
109
+ * load dotenv variables to `process.env`
110
110
  */
111
111
  loadProcess?: boolean;
112
112
  /**
113
- * log result to logger
113
+ * log loaded dotenv variables to `logger`
114
114
  */
115
115
  log?: boolean;
116
116
  /**
@@ -118,7 +118,7 @@ interface GetDotenvOptions {
118
118
  */
119
119
  logger?: Logger;
120
120
  /**
121
- * if populated, writes consolidated .env file to this path (follows dotenvExpand rules)
121
+ * if populated, writes consolidated dotenv file to this path (follows dotenvExpand rules)
122
122
  */
123
123
  outputPath?: string;
124
124
  /**
package/dist/index.d.mts CHANGED
@@ -8,14 +8,14 @@ interface GetDotenvCliOptions extends Omit<GetDotenvOptions, 'paths' | 'vars'> {
8
8
  * Cli alias. Should align with the `bin` property in `package.json`.
9
9
  */
10
10
  alias?: string;
11
- /**
12
- * Cli description (appears in CLI help).
13
- */
14
- description?: string;
15
11
  /**
16
12
  * Logs CLI internals when true.
17
13
  */
18
14
  debug?: boolean;
15
+ /**
16
+ * Cli description (appears in CLI help).
17
+ */
18
+ description?: string;
19
19
  /**
20
20
  * A delimited string of paths to dotenv files.
21
21
  */
@@ -78,7 +78,7 @@ interface GetDotenvOptions {
78
78
  */
79
79
  dotenvToken?: string;
80
80
  /**
81
- * path to file exporting an object keyed to dynamic variable functions
81
+ * path to JS module default-exporting an object keyed to dynamic variable functions
82
82
  */
83
83
  dynamicPath?: string;
84
84
  /**
@@ -86,31 +86,31 @@ interface GetDotenvOptions {
86
86
  */
87
87
  env?: string;
88
88
  /**
89
- * exclude dynamic variables
89
+ * exclude dynamic variables from loading
90
90
  */
91
91
  excludeDynamic?: boolean;
92
92
  /**
93
- * exclude environment-specific variables
93
+ * exclude environment-specific variables from loading
94
94
  */
95
95
  excludeEnv?: boolean;
96
96
  /**
97
- * exclude global variables
97
+ * exclude global variables from loading
98
98
  */
99
99
  excludeGlobal?: boolean;
100
100
  /**
101
- * exclude private variables
101
+ * exclude private variables from loading
102
102
  */
103
103
  excludePrivate?: boolean;
104
104
  /**
105
- * exclude public variables
105
+ * exclude public variables from loading
106
106
  */
107
107
  excludePublic?: boolean;
108
108
  /**
109
- * load dotenv to process.env
109
+ * load dotenv variables to `process.env`
110
110
  */
111
111
  loadProcess?: boolean;
112
112
  /**
113
- * log result to logger
113
+ * log loaded dotenv variables to `logger`
114
114
  */
115
115
  log?: boolean;
116
116
  /**
@@ -118,7 +118,7 @@ interface GetDotenvOptions {
118
118
  */
119
119
  logger?: Logger;
120
120
  /**
121
- * if populated, writes consolidated .env file to this path (follows dotenvExpand rules)
121
+ * if populated, writes consolidated dotenv file to this path (follows dotenvExpand rules)
122
122
  */
123
123
  outputPath?: string;
124
124
  /**
package/dist/index.d.ts CHANGED
@@ -8,14 +8,14 @@ interface GetDotenvCliOptions extends Omit<GetDotenvOptions, 'paths' | 'vars'> {
8
8
  * Cli alias. Should align with the `bin` property in `package.json`.
9
9
  */
10
10
  alias?: string;
11
- /**
12
- * Cli description (appears in CLI help).
13
- */
14
- description?: string;
15
11
  /**
16
12
  * Logs CLI internals when true.
17
13
  */
18
14
  debug?: boolean;
15
+ /**
16
+ * Cli description (appears in CLI help).
17
+ */
18
+ description?: string;
19
19
  /**
20
20
  * A delimited string of paths to dotenv files.
21
21
  */
@@ -78,7 +78,7 @@ interface GetDotenvOptions {
78
78
  */
79
79
  dotenvToken?: string;
80
80
  /**
81
- * path to file exporting an object keyed to dynamic variable functions
81
+ * path to JS module default-exporting an object keyed to dynamic variable functions
82
82
  */
83
83
  dynamicPath?: string;
84
84
  /**
@@ -86,31 +86,31 @@ interface GetDotenvOptions {
86
86
  */
87
87
  env?: string;
88
88
  /**
89
- * exclude dynamic variables
89
+ * exclude dynamic variables from loading
90
90
  */
91
91
  excludeDynamic?: boolean;
92
92
  /**
93
- * exclude environment-specific variables
93
+ * exclude environment-specific variables from loading
94
94
  */
95
95
  excludeEnv?: boolean;
96
96
  /**
97
- * exclude global variables
97
+ * exclude global variables from loading
98
98
  */
99
99
  excludeGlobal?: boolean;
100
100
  /**
101
- * exclude private variables
101
+ * exclude private variables from loading
102
102
  */
103
103
  excludePrivate?: boolean;
104
104
  /**
105
- * exclude public variables
105
+ * exclude public variables from loading
106
106
  */
107
107
  excludePublic?: boolean;
108
108
  /**
109
- * load dotenv to process.env
109
+ * load dotenv variables to `process.env`
110
110
  */
111
111
  loadProcess?: boolean;
112
112
  /**
113
- * log result to logger
113
+ * log loaded dotenv variables to `logger`
114
114
  */
115
115
  log?: boolean;
116
116
  /**
@@ -118,7 +118,7 @@ interface GetDotenvOptions {
118
118
  */
119
119
  logger?: Logger;
120
120
  /**
121
- * if populated, writes consolidated .env file to this path (follows dotenvExpand rules)
121
+ * if populated, writes consolidated dotenv file to this path (follows dotenvExpand rules)
122
122
  */
123
123
  outputPath?: string;
124
124
  /**
package/package.json CHANGED
@@ -130,5 +130,5 @@
130
130
  },
131
131
  "type": "module",
132
132
  "types": "dist/index.d.ts",
133
- "version": "4.0.0-3"
133
+ "version": "4.0.0"
134
134
  }