@karmaniverous/get-dotenv 4.0.0 → 4.2.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 +50 -2
- package/dist/getdotenv.cli.mjs +8387 -477
- package/dist/index.cjs +8392 -482
- package/dist/index.d.cts +8 -37
- package/dist/index.d.mts +8 -37
- package/dist/index.d.ts +8 -37
- package/dist/index.mjs +8387 -477
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -90,7 +90,7 @@ You can also use `getdotenv` from the command line:
|
|
|
90
90
|
# Options:
|
|
91
91
|
# -e, --env <string> target environment (dotenv-expanded)
|
|
92
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)
|
|
93
|
+
# -c, --command <string> shell command string, conflicts with cmd subcommand (dotenv-expanded)
|
|
94
94
|
# -o, --output-path <string> consolidated output file (dotenv-expanded)
|
|
95
95
|
# -p, --load-process load variables to process.env ON (default)
|
|
96
96
|
# -P, --load-process-off load variables to process.env OFF
|
|
@@ -124,8 +124,56 @@ You can also use `getdotenv` from the command line:
|
|
|
124
124
|
# -h, --help display help for command
|
|
125
125
|
#
|
|
126
126
|
# Commands:
|
|
127
|
-
#
|
|
127
|
+
# batch [options] Batch shell commands across multiple working directories.
|
|
128
|
+
# cmd execute shell command, conflicts with --command option (default command)
|
|
128
129
|
# help [command] display help for command
|
|
129
130
|
```
|
|
130
131
|
|
|
131
132
|
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.
|
|
133
|
+
|
|
134
|
+
### Batch Command
|
|
135
|
+
|
|
136
|
+
The `getdotenv` base CLI includes one very useful subcommand: `batch`.
|
|
137
|
+
|
|
138
|
+
This command lets you execute a shell command across multiple working directories. Executions occur within the loaded `dotenv` context. Might not be relevant to your specific use case, but when you need it, it's a game-changer!
|
|
139
|
+
|
|
140
|
+
My most common use case for this command is a microservice project where release day finds me updating dependencies & performing a release in well over a dozen very similar repositories. The sequence of steps in each case is exactly the same, but I need to respond individually as issues arise, so scripting the whole thing out would fail more often than it would work.
|
|
141
|
+
|
|
142
|
+
I use the `batch` command to perform each step across all repositories at once. Once you get used to it, it feels like a superpower!
|
|
143
|
+
|
|
144
|
+
Lest you doubt what that kind of leverage can do for you, consider this:
|
|
145
|
+
|
|
146
|
+
[](https://github.com/karmaniverous)
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
> getdotenv batch -h
|
|
150
|
+
|
|
151
|
+
# Usage: getdotenv batch [options] [command]
|
|
152
|
+
#
|
|
153
|
+
# Batch shell commands across multiple working directories.
|
|
154
|
+
#
|
|
155
|
+
# Options:
|
|
156
|
+
# -p, --pkg-cwd use nearest package directory as current working directory
|
|
157
|
+
# -r, --root-path <string> path to batch root directory from current working directory (default: "./")
|
|
158
|
+
# -g, --globs <strings...> space-delimited globs from root path (default: "*")
|
|
159
|
+
# -c, --command <string> shell command string, conflicts with cmd subcommand (dotenv-expanded)
|
|
160
|
+
# -l, --list list working directories without executing command
|
|
161
|
+
# -e, --ignore-errors ignore errors and continue with next path
|
|
162
|
+
# -h, --help display help for command
|
|
163
|
+
#
|
|
164
|
+
# Commands:
|
|
165
|
+
# cmd batch execute shell command, conflicts with --command option (default command)
|
|
166
|
+
# help [command] display help for command
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
Note that `batch` executes its commands in sequence, rather than in parallel!
|
|
170
|
+
|
|
171
|
+
To understand why, imagine running `npm install` in a dozen repos from the same command line. The visual feedback would be impossible to follow, and if something broke you'd have a really hard time figuring out why.
|
|
172
|
+
|
|
173
|
+
Instead, everything runs in sequence, and you get a clear record of exactly what heppened and where. Also worth noting that many complex processes are resource hogs: you would not _want_ to run a dozen Serverless deployments at once!
|
|
174
|
+
|
|
175
|
+
Meanwhile, [this issue](https://github.com/karmaniverous/get-dotenv/issues/7) documents the parallel-processing option requirement. Feel free to submit a PR!
|
|
176
|
+
|
|
177
|
+
---
|
|
178
|
+
|
|
179
|
+
See more great templates & tools on [my GitHub Profile](https://github.com/karmaniverous)!
|