@karmaniverous/get-dotenv 4.5.2 → 4.6.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/LICENSE +28 -0
- package/README.md +262 -215
- package/dist/getdotenv.cli.mjs +838 -40938
- package/dist/index.cjs +884 -40978
- package/dist/index.d.cts +94 -11
- package/dist/index.d.mts +94 -11
- package/dist/index.d.ts +94 -11
- package/dist/index.mjs +839 -40934
- package/package.json +157 -139
package/LICENSE
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
BSD 3-Clause License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025, Jason Williscroft
|
|
4
|
+
|
|
5
|
+
Redistribution and use in source and binary forms, with or without
|
|
6
|
+
modification, are permitted provided that the following conditions are met:
|
|
7
|
+
|
|
8
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
9
|
+
list of conditions and the following disclaimer.
|
|
10
|
+
|
|
11
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
12
|
+
this list of conditions and the following disclaimer in the documentation
|
|
13
|
+
and/or other materials provided with the distribution.
|
|
14
|
+
|
|
15
|
+
3. Neither the name of the copyright holder nor the names of its
|
|
16
|
+
contributors may be used to endorse or promote products derived from
|
|
17
|
+
this software without specific prior written permission.
|
|
18
|
+
|
|
19
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
20
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
21
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
22
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
23
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
24
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
25
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
26
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
27
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
28
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
package/README.md
CHANGED
|
@@ -1,215 +1,262 @@
|
|
|
1
|
-
# get-dotenv
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
✅
|
|
18
|
-
|
|
19
|
-
✅
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
✅
|
|
28
|
-
|
|
29
|
-
✅
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
```
|
|
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
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
#
|
|
154
|
-
#
|
|
155
|
-
#
|
|
156
|
-
#
|
|
157
|
-
#
|
|
158
|
-
#
|
|
159
|
-
#
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
>
|
|
186
|
-
|
|
187
|
-
#
|
|
188
|
-
#
|
|
189
|
-
#
|
|
190
|
-
#
|
|
191
|
-
#
|
|
192
|
-
#
|
|
193
|
-
# -
|
|
194
|
-
#
|
|
195
|
-
#
|
|
196
|
-
#
|
|
197
|
-
#
|
|
198
|
-
#
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
1
|
+
# get-dotenv
|
|
2
|
+
|
|
3
|
+
## Requirements
|
|
4
|
+
|
|
5
|
+
- Node.js >= 22.19 (this repository pins 22.19.0 for CI/reproducibility)
|
|
6
|
+
|
|
7
|
+
## API Reference
|
|
8
|
+
|
|
9
|
+
Generated API documentation is hosted at:
|
|
10
|
+
|
|
11
|
+
- https://docs.karmanivero.us/get-dotenv
|
|
12
|
+
|
|
13
|
+
The site is built with TypeDoc from the source code in this repository.
|
|
14
|
+
|
|
15
|
+
Load environment variables with a cascade of environment-aware dotenv files. You can:
|
|
16
|
+
|
|
17
|
+
✅ Asynchronously load environment variables from multiple dotenv files.
|
|
18
|
+
|
|
19
|
+
✅ Segregate variables info distinct files:
|
|
20
|
+
|
|
21
|
+
- Public files (e.g. `.env`, `env.dev`, `env.test`) are synced with your git repository.
|
|
22
|
+
- Private files (e.g. `.env.local`, `env.dev.local`, `env.test.local`) are protected by `.gitignore`.
|
|
23
|
+
- Global files (e.g. `.env`, `env.local`) apply to all environments.
|
|
24
|
+
- Env files (e.g. `.env.dev`, `.env.dev.local`, `.env.test`, `.env.test.local`) apply to a specific environment.
|
|
25
|
+
- [Dynamic files](#dynamic-processing) (`.env.js`) export logic that dynamically & progressively generates new variables or overrides current ones.
|
|
26
|
+
|
|
27
|
+
✅ Dynamically specify which variables to load by type.
|
|
28
|
+
|
|
29
|
+
✅ Explicitly add variables to the loaded set.
|
|
30
|
+
|
|
31
|
+
✅ Extract the resulting variables to an object, `process.env`, a dotenv file, or a logger object, in any combination.
|
|
32
|
+
|
|
33
|
+
✅ Customize your dotenv file directories & naming patterns.
|
|
34
|
+
|
|
35
|
+
✅ Perform all of the above either programmatically or [from the command line](#command-line-interface), where you can also execute additional commands within the resulting context... including nested `getdotenv` commands that inherit the parent command's settings & context!
|
|
36
|
+
|
|
37
|
+
✅ [Execute batched CLI commands](#batch-command) across multiple working directories, with each command inheriting the `getdotenv` context.
|
|
38
|
+
|
|
39
|
+
✅ Set defaults for all options in a `getdotenv.config.json` file in your project root directory.
|
|
40
|
+
|
|
41
|
+
✅ [Generate an extensible `getdotenv`-based CLI](https://github.com/karmaniverous/get-dotenv-child) for use in your own projects.
|
|
42
|
+
|
|
43
|
+
`getdotenv` relies on the excellent [`dotenv`](https://www.npmjs.com/package/dotenv) parser and somewhat improves on [`dotenv-expand`](https://www.npmjs.com/package/dotenv-expand) for recursive variable expansion.
|
|
44
|
+
|
|
45
|
+
You can always use `getdotenv` directly on the command line, but its REAL power comes into play when you use it as the foundation of your own CLI. This lets you set defaults globally and configure pre- and post-hooks that mutate your `getdotenv` context and do useful things like grab an AWS session from your dev environment and add it to the command execution context.
|
|
46
|
+
|
|
47
|
+
When you plug your own [`commander`](https://www.npmjs.com/package/commander) CLI commands into the `getdotenv` base, they will execute within all of the environmental context created above!
|
|
48
|
+
|
|
49
|
+
## Breaking Changes
|
|
50
|
+
|
|
51
|
+
In version 4.0.0, in addition to a full TypeScript refactor, I replaced the use of the unsafe `Function` constructor for dynamic variable processing with a MUCH safer dynamic module import.
|
|
52
|
+
|
|
53
|
+
Dynamic importing is intrinsically asynchronous, and so far I haven't been able to figure out how to cram that into the synchronous `getDotenvSync` function. There really aren't THAT many users of this library, so rather than have async & sync versions that do different things, I just eliminated the sync version entirely.
|
|
54
|
+
|
|
55
|
+
If you have a use case for sync dotenv processing and DON'T need dynamic variables, let me know and I'll put the restricted version back in. If you have an idea of how to make dynamic imports synchronous, I'm all ears!
|
|
56
|
+
|
|
57
|
+
## Testing
|
|
58
|
+
|
|
59
|
+
This project uses Vitest with the V8 coverage provider. Run:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
npm run test
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Installation
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
npm install @karmaniverous/get-dotenv
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Usage
|
|
72
|
+
|
|
73
|
+
```js
|
|
74
|
+
import { getDotenv } from '@karmaniverous/get-dotenv';
|
|
75
|
+
|
|
76
|
+
const dotenv = await getDotenv(options);
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Options can be passed programmatically or set in a `getdotenv.config.json` file in your project root directory. The same file also sets default options for the `getdotenv` CLI or any child CLI you spawn from it.
|
|
80
|
+
|
|
81
|
+
See the [child CLI example repo](https://github.com/karmaniverous/get-dotenv-child#configuration) for an extensiive discussion of the various config options and how & where to set them.
|
|
82
|
+
|
|
83
|
+
## Dynamic Processing
|
|
84
|
+
|
|
85
|
+
This package supports the full [`dotenv-expand`](https://www.npmjs.com/package/dotenv-expand) syntax, with some internal performance improvements. Dynamic variables can be authored in JS or TS.
|
|
86
|
+
|
|
87
|
+
Use the `dynamicPath` option to add a relative path to a Javascript module with a default export like this:
|
|
88
|
+
|
|
89
|
+
```js
|
|
90
|
+
export default {
|
|
91
|
+
SOME_DYNAMIC_VARIABLE: (dotenv) => someLogic(dotenv),
|
|
92
|
+
ANOTHER_DYNAMIC_VARIABLE: (dotenv) =>
|
|
93
|
+
someOtherLogic(dotenv.SOME_DYNAMIC_VARIABLE),
|
|
94
|
+
ONE_MORE_TIME: ({ DESTRUCTRED_VARIABLE, ANOTHER_DYNAMIC_VARIABLE }) =>
|
|
95
|
+
DESTRUCTRED_VARIABLE + ANOTHER_DYNAMIC_VARIABLE,
|
|
96
|
+
};
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
If the value corresponding to a key is a function, it will be executed with the current state of `dotenv` as its single argument and the result applied back to the `dotenv` object. Otherwise, the value will just be applied back to `dotenv`. (Although if you're going to do that then you might as well just create a public global variable in the first place.)
|
|
100
|
+
|
|
101
|
+
Since keys will be evaluated progressively, each successive key function will have access to any previous ones. These keys can also override existing variables.
|
|
102
|
+
|
|
103
|
+
### TypeScript-first dynamic processing
|
|
104
|
+
|
|
105
|
+
You can write your dynamic module in TypeScript and point `dynamicPath` at a `.ts` file. Install [`esbuild`](https://esbuild.github.io/) as a dev dependency to enable automatic compilation:
|
|
106
|
+
|
|
107
|
+
```ts
|
|
108
|
+
// dynamic.ts
|
|
109
|
+
export default {
|
|
110
|
+
MY_DYNAMIC: ({ APP_SETTING = '' }) => `${APP_SETTING}-ts`,
|
|
111
|
+
};
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
If `esbuild` is not installed and a direct import fails, get-dotenv attempts a
|
|
115
|
+
simple fallback for single-file `.ts` modules without imports; otherwise it will
|
|
116
|
+
throw with clear guidance to install `esbuild`.
|
|
117
|
+
|
|
118
|
+
Programmatic users can skip files entirely and pass dynamic variables directly:
|
|
119
|
+
|
|
120
|
+
```ts
|
|
121
|
+
import { getDotenv, defineDynamic } from '@karmaniverous/get-dotenv';
|
|
122
|
+
|
|
123
|
+
const dynamic = defineDynamic({
|
|
124
|
+
MY_DYNAMIC(vars, env) {
|
|
125
|
+
return `${vars.APP_SETTING}-${env ?? ''}`;
|
|
126
|
+
},
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
const vars = await getDotenv({ dynamic, paths: ['./'], env: 'dev' });
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
Notes:
|
|
133
|
+
|
|
134
|
+
- Programmatic `dynamic` takes precedence over `dynamicPath` when both are provided.
|
|
135
|
+
- Dynamic keys are evaluated progressively, so later keys can reference earlier results.
|
|
136
|
+
|
|
137
|
+
#### Troubleshooting
|
|
138
|
+
|
|
139
|
+
- “Unknown file extension '.ts'” when loading `dynamic.ts`:
|
|
140
|
+
- Install `esbuild` (`npm i -D esbuild`).
|
|
141
|
+
|
|
142
|
+
- “Unable to load dynamic TypeScript file …”:
|
|
143
|
+
- Install `esbuild`. A simple transpile fallback exists only for trivial
|
|
144
|
+
single-file modules; any imports in `dynamic.ts` require `esbuild` bundling.
|
|
145
|
+
|
|
146
|
+
## Command Line Interface
|
|
147
|
+
|
|
148
|
+
You can also use `getdotenv` from the command line:
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
> npx getdotenv -h
|
|
152
|
+
|
|
153
|
+
# Usage: getdotenv [options] [command]
|
|
154
|
+
#
|
|
155
|
+
# Base CLI.
|
|
156
|
+
#
|
|
157
|
+
# Options:
|
|
158
|
+
# -e, --env <string> target environment (dotenv-expanded)
|
|
159
|
+
# -v, --vars <string> extra variables expressed as delimited key-value pairs (dotenv-expanded): KEY1=VAL1 KEY2=VAL2
|
|
160
|
+
# -c, --command <string> command executed according to the --shell option, conflicts with cmd subcommand (dotenv-expanded)
|
|
161
|
+
# -o, --output-path <string> consolidated output file (dotenv-expanded)
|
|
162
|
+
# -s, --shell [string] command execution shell, no argument for default OS shell or provide shell string (default OS shell)
|
|
163
|
+
# -S, --shell-off command execution shell OFF
|
|
164
|
+
# -p, --load-process load variables to process.env ON (default)
|
|
165
|
+
# -P, --load-process-off load variables to process.env OFF
|
|
166
|
+
# -a, --exclude-all exclude all dotenv variables from loading ON
|
|
167
|
+
# -A, --exclude-all-off exclude all dotenv variables from loading OFF (default)
|
|
168
|
+
# -z, --exclude-dynamic exclude dynamic dotenv variables from loading ON
|
|
169
|
+
# -Z, --exclude-dynamic-off exclude dynamic dotenv variables from loading OFF (default)
|
|
170
|
+
# -n, --exclude-env exclude environment-specific dotenv variables from loading
|
|
171
|
+
# -N, --exclude-env-off exclude environment-specific dotenv variables from loading OFF (default)
|
|
172
|
+
# -g, --exclude-global exclude global dotenv variables from loading ON
|
|
173
|
+
# -G, --exclude-global-off exclude global dotenv variables from loading OFF (default)
|
|
174
|
+
# -r, --exclude-private exclude private dotenv variables from loading ON
|
|
175
|
+
# -R, --exclude-private-off exclude private dotenv variables from loading OFF (default)
|
|
176
|
+
# -u, --exclude-public exclude public dotenv variables from loading ON
|
|
177
|
+
# -U, --exclude-public-off exclude public dotenv variables from loading OFF (default)
|
|
178
|
+
# -l, --log console log loaded variables ON
|
|
179
|
+
# -L, --log-off console log loaded variables OFF (default)
|
|
180
|
+
# -d, --debug debug mode ON
|
|
181
|
+
# -D, --debug-off debug mode OFF (default)
|
|
182
|
+
# --default-env <string> default target environment
|
|
183
|
+
# --dotenv-token <string> dotenv-expanded token indicating a dotenv file (default: ".env")
|
|
184
|
+
# --dynamic-path <string> dynamic variables path (.js or .ts; .ts is auto-compiled when esbuild is available, otherwise precompile)
|
|
185
|
+
# --paths <string> dotenv-expanded delimited list of paths to dotenv directory (default: "./")
|
|
186
|
+
# --paths-delimiter <string> paths delimiter string (default: " ")
|
|
187
|
+
# --paths-delimiter-pattern <string> paths delimiter regex pattern
|
|
188
|
+
# --private-token <string> dotenv-expanded token indicating private variables (default: "local")
|
|
189
|
+
# --vars-delimiter <string> vars delimiter string (default: " ")
|
|
190
|
+
# --vars-delimiter-pattern <string> vars delimiter regex pattern
|
|
191
|
+
# --vars-assignor <string> vars assignment operator string (default: "=")
|
|
192
|
+
# --vars-assignor-pattern <string> vars assignment operator regex pattern
|
|
193
|
+
# -h, --help display help for command
|
|
194
|
+
#
|
|
195
|
+
# Commands:
|
|
196
|
+
# batch [options] Batch shell commands across multiple working directories.
|
|
197
|
+
# cmd Batch execute command according to the --shell option, conflicts with --command option (default command)
|
|
198
|
+
# help [command] display help for command
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
### Default shell behavior
|
|
202
|
+
|
|
203
|
+
To normalize behavior across platforms, the CLI resolves a default shell when `--shell` is true or omitted:
|
|
204
|
+
|
|
205
|
+
- POSIX: `/bin/bash`
|
|
206
|
+
- Windows: `powershell.exe`
|
|
207
|
+
|
|
208
|
+
### Batch Command
|
|
209
|
+
|
|
210
|
+
The `getdotenv` base CLI includes one very useful subcommand: `batch`.
|
|
211
|
+
|
|
212
|
+
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!
|
|
213
|
+
|
|
214
|
+
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.
|
|
215
|
+
|
|
216
|
+
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!
|
|
217
|
+
|
|
218
|
+
Lest you doubt what that kind of leverage can do for you, consider this:
|
|
219
|
+
|
|
220
|
+
[](https://github.com/karmaniverous)
|
|
221
|
+
|
|
222
|
+
```bash
|
|
223
|
+
> getdotenv batch -h
|
|
224
|
+
|
|
225
|
+
# Usage: getdotenv batch [options] [command]
|
|
226
|
+
#
|
|
227
|
+
# Batch command execution across multiple working directories.
|
|
228
|
+
#
|
|
229
|
+
# Options:
|
|
230
|
+
# -p, --pkg-cwd use nearest package directory as current working directory
|
|
231
|
+
# -r, --root-path <string> path to batch root directory from current working directory (default: "./")
|
|
232
|
+
# -g, --globs <string> space-delimited globs from root path (default: "*")
|
|
233
|
+
# -c, --command <string> command executed according to the base --shell option, conflicts with cmd subcommand (dotenv-expanded)
|
|
234
|
+
# -l, --list list working directories without executing command
|
|
235
|
+
# -e, --ignore-errors ignore errors and continue with next path
|
|
236
|
+
# -h, --help display help for command
|
|
237
|
+
#
|
|
238
|
+
# Commands:
|
|
239
|
+
# cmd execute command, conflicts with --command option (default subcommand)
|
|
240
|
+
# help [command] display help for command
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
Note that `batch` executes its commands in sequence, rather than in parallel!
|
|
244
|
+
|
|
245
|
+
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.
|
|
246
|
+
|
|
247
|
+
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!
|
|
248
|
+
|
|
249
|
+
Meanwhile, [this issue](https://github.com/karmaniverous/get-dotenv/issues/7) documents the parallel-processing option requirement. Feel free to submit a PR!
|
|
250
|
+
|
|
251
|
+
---
|
|
252
|
+
|
|
253
|
+
## Guides
|
|
254
|
+
|
|
255
|
+
- Cascade and precedence:
|
|
256
|
+
- ./guides/cascade.md
|
|
257
|
+
- Shell execution behavior and quoting:
|
|
258
|
+
- ./guides/shell.md
|
|
259
|
+
|
|
260
|
+
The guides are also included in the hosted API docs.
|
|
261
|
+
|
|
262
|
+
See more great templates & tools on [my GitHub Profile](https://github.com/karmaniverous)!
|