@calvear/env 2.10.5 → 3.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/CHANGELOG.md +26 -0
- package/README.md +97 -113
- package/arguments.d.ts +15 -15
- package/arguments.d.ts.map +1 -1
- package/arguments.js +142 -131
- package/arguments.js.map +1 -1
- package/commands/env.command.d.ts +8 -2
- package/commands/env.command.d.ts.map +1 -1
- package/commands/env.command.js +65 -80
- package/commands/env.command.js.map +1 -1
- package/commands/export.command.d.ts +9 -2
- package/commands/export.command.d.ts.map +1 -1
- package/commands/export.command.js +54 -56
- package/commands/export.command.js.map +1 -1
- package/commands/index.d.ts +5 -5
- package/commands/index.d.ts.map +1 -1
- package/commands/index.js +5 -14
- package/commands/pull.command.d.ts +6 -1
- package/commands/pull.command.d.ts.map +1 -1
- package/commands/pull.command.js +21 -37
- package/commands/pull.command.js.map +1 -1
- package/commands/push.command.d.ts +6 -1
- package/commands/push.command.d.ts.map +1 -1
- package/commands/push.command.js +21 -36
- package/commands/push.command.js.map +1 -1
- package/commands/schema.command.d.ts +6 -1
- package/commands/schema.command.d.ts.map +1 -1
- package/commands/schema.command.js +17 -17
- package/commands/schema.command.js.map +1 -1
- package/exec.d.ts +7 -1
- package/exec.d.ts.map +1 -1
- package/exec.js +88 -147
- package/exec.js.map +1 -1
- package/index.d.ts +3 -3
- package/index.d.ts.map +1 -1
- package/index.js +3 -20
- package/interfaces/index.d.ts +1 -1
- package/interfaces/index.d.ts.map +1 -1
- package/interfaces/loader.interface.d.ts +29 -3
- package/interfaces/loader.interface.d.ts.map +1 -1
- package/main.d.ts +0 -1
- package/main.js +7 -26
- package/main.js.map +1 -1
- package/package.json +53 -33
- package/providers/app-settings.provider.d.ts +5 -3
- package/providers/app-settings.provider.d.ts.map +1 -1
- package/providers/app-settings.provider.js +36 -51
- package/providers/app-settings.provider.js.map +1 -1
- package/providers/index.d.ts +2 -2
- package/providers/index.d.ts.map +1 -1
- package/providers/index.js +18 -28
- package/providers/index.js.map +1 -1
- package/providers/local.provider.d.ts +5 -2
- package/providers/local.provider.d.ts.map +1 -1
- package/providers/local.provider.js +27 -40
- package/providers/local.provider.js.map +1 -1
- package/providers/package-json.provider.d.ts +5 -2
- package/providers/package-json.provider.d.ts.map +1 -1
- package/providers/package-json.provider.js +26 -28
- package/providers/package-json.provider.js.map +1 -1
- package/providers/secrets.provider.d.ts +5 -2
- package/providers/secrets.provider.d.ts.map +1 -1
- package/providers/secrets.provider.js +24 -33
- package/providers/secrets.provider.js.map +1 -1
- package/schemas/env.schema.json +1 -0
- package/utils/argv.util.d.ts +10 -0
- package/utils/argv.util.d.ts.map +1 -0
- package/utils/argv.util.js +24 -0
- package/utils/argv.util.js.map +1 -0
- package/utils/command.util.d.ts +71 -4
- package/utils/command.util.d.ts.map +1 -1
- package/utils/command.util.js +60 -135
- package/utils/command.util.js.map +1 -1
- package/utils/index.d.ts +8 -6
- package/utils/index.d.ts.map +1 -1
- package/utils/index.js +9 -23
- package/utils/interpolate.util.d.ts +29 -1
- package/utils/interpolate.util.d.ts.map +1 -1
- package/utils/interpolate.util.js +12 -29
- package/utils/interpolate.util.js.map +1 -1
- package/utils/json.util.d.ts +41 -3
- package/utils/json.util.d.ts.map +1 -1
- package/utils/json.util.js +29 -41
- package/utils/json.util.js.map +1 -1
- package/utils/logger.d.ts +21 -2
- package/utils/logger.d.ts.map +1 -1
- package/utils/logger.js +31 -17
- package/utils/logger.js.map +1 -1
- package/utils/normalize.util.d.ts +24 -2
- package/utils/normalize.util.d.ts.map +1 -1
- package/utils/normalize.util.js +35 -57
- package/utils/normalize.util.js.map +1 -1
- package/utils/schema.util.d.ts +62 -3
- package/utils/schema.util.d.ts.map +1 -1
- package/utils/schema.util.js +64 -92
- package/utils/schema.util.js.map +1 -1
- package/utils/ui.d.ts +14 -0
- package/utils/ui.d.ts.map +1 -0
- package/utils/ui.js +75 -0
- package/utils/ui.js.map +1 -0
- package/commands/index.js.map +0 -1
- package/index.js.map +0 -1
- package/interfaces/index.js +0 -18
- package/interfaces/index.js.map +0 -1
- package/interfaces/loader.interface.js +0 -3
- package/interfaces/loader.interface.js.map +0 -1
- package/tsconfig.build.tsbuildinfo +0 -1
- package/utils/index.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,32 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## [3.0.0] - 2026-05-31
|
|
6
|
+
|
|
7
|
+
### Breaking
|
|
8
|
+
|
|
9
|
+
- migrated to pure ESM (`"type": "module"`); package now ships ESM only
|
|
10
|
+
- minimum runtime is now NodeJS `>=20` (pnpm `>=9`)
|
|
11
|
+
- custom providers must be authored as ESM modules (`export default`)
|
|
12
|
+
|
|
13
|
+
### Changed
|
|
14
|
+
|
|
15
|
+
- build migrated from `tsc` to Vite (library mode) + `vite-plugin-dts`
|
|
16
|
+
- tests migrated from Jest to Vitest (unit suite at 100% coverage + integration project)
|
|
17
|
+
- ESLint migrated to flat config (`eslint.config.js`) + typescript-eslint
|
|
18
|
+
- dependency upgrades: tslog 3 → 4, yargs 17 → 18, ajv 8.x, TypeScript 6
|
|
19
|
+
- replaced `chalk` with `picocolors`
|
|
20
|
+
- logger rewritten for tslog v4 (`createLogger`/`configureLogger` factory)
|
|
21
|
+
- new pretty CLI output (`ui` module): banner, per-provider counts, masked
|
|
22
|
+
environment dump and run summary
|
|
23
|
+
- extracted the argv quote-composition parser into `utils/argv.util.ts`
|
|
24
|
+
|
|
25
|
+
### Fixed
|
|
26
|
+
|
|
27
|
+
- child process exit code is now propagated for any non-zero status (not only `1`)
|
|
28
|
+
- `normalize` strips the leading shared-prefix `$` explicitly (mid-key `$` preserved)
|
|
29
|
+
- accurate `flatten`/`normalize` return types and JSDoc; removed dead code
|
|
30
|
+
|
|
5
31
|
## [2.6.0] - 2022-10-31
|
|
6
32
|
|
|
7
33
|
- package.json pah param
|
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
|
|
16
16
|
<p align="center">
|
|
17
17
|
<img
|
|
18
|
-
src="https://img.shields.io/badge/version-
|
|
18
|
+
src="https://img.shields.io/badge/version-3.0.0-blue?style=flat-square"
|
|
19
19
|
alt="version"
|
|
20
20
|
/>
|
|
21
21
|
|
|
@@ -25,13 +25,18 @@
|
|
|
25
25
|
/>
|
|
26
26
|
|
|
27
27
|
<img
|
|
28
|
-
src="https://img.shields.io/badge/
|
|
28
|
+
src="https://img.shields.io/badge/ESM-only-f7df1e?style=flat-square"
|
|
29
|
+
alt="esm only"
|
|
30
|
+
/>
|
|
31
|
+
|
|
32
|
+
<img
|
|
33
|
+
src="https://img.shields.io/badge/nodejs->=20-darkgreen?style=flat-square"
|
|
29
34
|
alt="nodejs engine"
|
|
30
35
|
/>
|
|
31
36
|
|
|
32
37
|
<img
|
|
33
|
-
src="https://img.shields.io/badge/
|
|
34
|
-
alt="
|
|
38
|
+
src="https://img.shields.io/badge/pnpm->=9-darkgreen?style=flat-square"
|
|
39
|
+
alt="pnpm engine"
|
|
35
40
|
/>
|
|
36
41
|
|
|
37
42
|
<img
|
|
@@ -54,22 +59,26 @@ Eases NodeJS <b>environment variable handling</b>, like [env-cmd](https://www.np
|
|
|
54
59
|
|
|
55
60
|
## 📌 **Requirements**
|
|
56
61
|
|
|
57
|
-
First, [download](https://nodejs.org/) and install **NodeJS**. Version `
|
|
62
|
+
First, [download](https://nodejs.org/) and install **NodeJS**. Version `20` or higher is required.
|
|
63
|
+
|
|
64
|
+
> 🧩 **ESM only**: this package is published as native ECMAScript Modules
|
|
65
|
+
> (`"type": "module"`). Import it from ESM code, and author any custom provider
|
|
66
|
+
> as an ESM module with a `export default`.
|
|
58
67
|
|
|
59
|
-
Validate installed versions of node and
|
|
68
|
+
Validate installed versions of node and pnpm with:
|
|
60
69
|
|
|
61
70
|
```bash
|
|
62
71
|
> node -v
|
|
63
|
-
|
|
72
|
+
v20.0.0
|
|
64
73
|
|
|
65
|
-
>
|
|
66
|
-
|
|
74
|
+
> pnpm -v
|
|
75
|
+
9.0.0
|
|
67
76
|
```
|
|
68
77
|
|
|
69
|
-
You can initialize a new
|
|
78
|
+
You can initialize a new project using:
|
|
70
79
|
|
|
71
80
|
```bash
|
|
72
|
-
>
|
|
81
|
+
> pnpm init
|
|
73
82
|
```
|
|
74
83
|
|
|
75
84
|
<p align="right">(<a href="#top">back to top</a>)</p>
|
|
@@ -78,9 +87,9 @@ You can initialize a new npm project using:
|
|
|
78
87
|
|
|
79
88
|
## ⚡️ **Quick start**
|
|
80
89
|
|
|
81
|
-
> 🔔 Make sure that you have [NodeJS
|
|
90
|
+
> 🔔 Make sure that you have [NodeJS 20+](https://nodejs.org/) installed on your computer.
|
|
82
91
|
|
|
83
|
-
-
|
|
92
|
+
- Installs the package:
|
|
84
93
|
|
|
85
94
|
```bash
|
|
86
95
|
> npm install @calvear/env
|
|
@@ -92,7 +101,7 @@ You can initialize a new npm project using:
|
|
|
92
101
|
> _
|
|
93
102
|
```
|
|
94
103
|
|
|
95
|
-
-
|
|
104
|
+
- Executes binary directly:
|
|
96
105
|
|
|
97
106
|
```bash
|
|
98
107
|
> node_modules/.bin/env --help
|
|
@@ -108,7 +117,7 @@ You can initialize a new npm project using:
|
|
|
108
117
|
> _
|
|
109
118
|
```
|
|
110
119
|
|
|
111
|
-
-
|
|
120
|
+
- Or add desired commands in your **npm script** in `package.json`:
|
|
112
121
|
|
|
113
122
|
```javascript
|
|
114
123
|
{
|
|
@@ -132,7 +141,7 @@ You can initialize a new npm project using:
|
|
|
132
141
|
}
|
|
133
142
|
```
|
|
134
143
|
|
|
135
|
-
-
|
|
144
|
+
- Execs your command:
|
|
136
145
|
|
|
137
146
|
**file**: _dist/main.js_
|
|
138
147
|
|
|
@@ -195,9 +204,9 @@ console.log(`My environment loaded is: ${process.env.ENV}`);
|
|
|
195
204
|
│ ├── exec.ts # initialization logic (load config, commands, etc.)
|
|
196
205
|
│ └── main.ts
|
|
197
206
|
├── tests/ # integration tests
|
|
198
|
-
├── .
|
|
199
|
-
├──
|
|
200
|
-
├──
|
|
207
|
+
├── eslint.config.js
|
|
208
|
+
├── vite.config.ts
|
|
209
|
+
├── vitest.config.ts
|
|
201
210
|
└── tsconfig.json
|
|
202
211
|
```
|
|
203
212
|
|
|
@@ -219,45 +228,45 @@ _`[[root]]/config-file.[[env]].json`_ will be _`config/config-file.dev.json`_.
|
|
|
219
228
|
|
|
220
229
|
### Global options
|
|
221
230
|
|
|
222
|
-
| Option
|
|
231
|
+
| Option | Description | Type | Default | Required? |
|
|
223
232
|
| ---------------------------------- | ----------------------------------------------- | ---------- | ------- | --------- |
|
|
224
|
-
| `--help`
|
|
225
|
-
| `--e, --env`
|
|
226
|
-
| `-m, --modes`
|
|
227
|
-
| `--nd, --nestingDelimiter`
|
|
228
|
-
| `--arrDesc, --arrayDescomposition` | Whether serialize or break down arrays
|
|
229
|
-
| `-x, --expand`
|
|
230
|
-
| `-ci`
|
|
233
|
+
| `--help` | Shows help | `boolean` | | No |
|
|
234
|
+
| `--e, --env` | Environment for load | `string` | | Yes |
|
|
235
|
+
| `-m, --modes` | Execution modes | `string[]` | `[]` | No |
|
|
236
|
+
| `--nd, --nestingDelimiter` | Nesting level delimiter for flatten | `string` | `__` | No |
|
|
237
|
+
| `--arrDesc, --arrayDescomposition` | Whether serialize or break down arrays | `boolean` | `false` | No |
|
|
238
|
+
| `-x, --expand` | Interpolates environment variables using itself | `boolean` | `false` | No |
|
|
239
|
+
| `-ci` | Continuous Integration mode | `boolean` | `false` | No |
|
|
231
240
|
|
|
232
241
|
</br>
|
|
233
242
|
|
|
234
243
|
### Workspace options
|
|
235
244
|
|
|
236
|
-
| Option
|
|
245
|
+
| Option | Description | Type | Default | Required? |
|
|
237
246
|
| ------------------ | --------------------------------- | -------- | --------------------------------- | --------- |
|
|
238
|
-
| `--root`
|
|
239
|
-
| `-c, --configFile` | Config JSON file path
|
|
240
|
-
| `-s, --schemaFile` | Environment Schema JSON file path | `string` | `[[root]]/settings/schema.json` | No
|
|
247
|
+
| `--root` | Default environment folder path | `string` | `env` | No |
|
|
248
|
+
| `-c, --configFile` | Config JSON file path | `string` | `[[root]]/settings/settings.json` | No |
|
|
249
|
+
| `-s, --schemaFile` | Environment Schema JSON file path | `string` | `[[root]]/settings/schema.json` | No |
|
|
241
250
|
|
|
242
251
|
### JSON Schema options
|
|
243
252
|
|
|
244
|
-
| Option
|
|
253
|
+
| Option | Description | Type | Default | Required? |
|
|
245
254
|
| ---------------------- | ---------------------------------------------------------- | ----------------- | ------- | --------- |
|
|
246
|
-
| `-r, --resolve`
|
|
247
|
-
| `--null, --nullable` | Whether variables are nullable by default
|
|
248
|
-
| `--df, --detectFormat` | Whether format of strings variables are included in schema | `boolean`
|
|
255
|
+
| `-r, --resolve` | Whether merges new schema or override | `merge, override` | `merge` | No |
|
|
256
|
+
| `--null, --nullable` | Whether variables are nullable by default | `boolean` | `true` | No |
|
|
257
|
+
| `--df, --detectFormat` | Whether format of strings variables are included in schema | `boolean` | `false` | No |
|
|
249
258
|
|
|
250
259
|
### Logger options
|
|
251
260
|
|
|
252
|
-
| Option
|
|
261
|
+
| Option | Description | Type | Default | Required? |
|
|
253
262
|
| ------------------- | ----------- | ---------------------------------------- | ------- | --------- |
|
|
254
|
-
| `--log, --logLevel` | Log level | `silly, trace, debug, info, warn, error` | `info` | No
|
|
263
|
+
| `--log, --logLevel` | Log level | `silly, trace, debug, info, warn, error` | `info` | No |
|
|
255
264
|
|
|
256
265
|
<div align="center">
|
|
257
266
|
<span style="font-size:20px;font-weight:bold" align="center">Commands</span>
|
|
258
267
|
</div>
|
|
259
268
|
|
|
260
|
-
-
|
|
269
|
+
- ## **`env`**
|
|
261
270
|
|
|
262
271
|
Inject your environment variables into `process.env` and executes a command.
|
|
263
272
|
|
|
@@ -279,7 +288,7 @@ Examples:
|
|
|
279
288
|
> env -e prod -m build optimize : npm build
|
|
280
289
|
```
|
|
281
290
|
|
|
282
|
-
-
|
|
291
|
+
- ## **`pull`**
|
|
283
292
|
|
|
284
293
|
Pulls environment variables from providers stores.
|
|
285
294
|
|
|
@@ -287,9 +296,9 @@ Pulls environment variables from providers stores.
|
|
|
287
296
|
env pull -e [env] [options..]
|
|
288
297
|
```
|
|
289
298
|
|
|
290
|
-
| Option
|
|
299
|
+
| Option | Description | Type | Default | Required? |
|
|
291
300
|
| ----------------- | ------------------------- | --------- | ------- | --------- |
|
|
292
|
-
| `-o, --overwrite` | Overwrite local variables | `boolean` | `false` | No
|
|
301
|
+
| `-o, --overwrite` | Overwrite local variables | `boolean` | `false` | No |
|
|
293
302
|
|
|
294
303
|
Examples:
|
|
295
304
|
|
|
@@ -297,7 +306,7 @@ Examples:
|
|
|
297
306
|
> env pull -e dev
|
|
298
307
|
```
|
|
299
308
|
|
|
300
|
-
-
|
|
309
|
+
- ## **`push`**
|
|
301
310
|
|
|
302
311
|
Pushes environment variables to providers stores.
|
|
303
312
|
|
|
@@ -305,9 +314,9 @@ Pushes environment variables to providers stores.
|
|
|
305
314
|
env push -e [env] [options..]
|
|
306
315
|
```
|
|
307
316
|
|
|
308
|
-
| Option
|
|
317
|
+
| Option | Description | Type | Default | Required? |
|
|
309
318
|
| ------------- | ------------------------------------ | --------- | ------- | --------- |
|
|
310
|
-
| `-f, --force` | Force push for secrets (replace all) | `boolean` | `false` | No
|
|
319
|
+
| `-f, --force` | Force push for secrets (replace all) | `boolean` | `false` | No |
|
|
311
320
|
|
|
312
321
|
Examples:
|
|
313
322
|
|
|
@@ -315,7 +324,7 @@ Examples:
|
|
|
315
324
|
> env push -e dev
|
|
316
325
|
```
|
|
317
326
|
|
|
318
|
-
-
|
|
327
|
+
- ## **`schema`**
|
|
319
328
|
|
|
320
329
|
Generates validation schema from providers output variables.
|
|
321
330
|
|
|
@@ -329,7 +338,7 @@ Examples:
|
|
|
329
338
|
> env schema -e dev -m build
|
|
330
339
|
```
|
|
331
340
|
|
|
332
|
-
-
|
|
341
|
+
- ## **`export`**
|
|
333
342
|
|
|
334
343
|
Export unified environment variables to a file from providers.
|
|
335
344
|
|
|
@@ -337,10 +346,10 @@ Export unified environment variables to a file from providers.
|
|
|
337
346
|
env export -e [env] -m [modes] [options..]
|
|
338
347
|
```
|
|
339
348
|
|
|
340
|
-
| Option
|
|
349
|
+
| Option | Description | Type | Default | Required? |
|
|
341
350
|
| --------------- | ---------------------------------- | -------- | -------- | --------- |
|
|
342
|
-
| `-u, -p, --uri` | Uri for export file with variables | `string` | `.env` | No
|
|
343
|
-
| `-f, --format` | Format for export variables
|
|
351
|
+
| `-u, -p, --uri` | Uri for export file with variables | `string` | `.env` | No |
|
|
352
|
+
| `-f, --format` | Format for export variables | `string` | `dotenv` | No |
|
|
344
353
|
|
|
345
354
|
Examples:
|
|
346
355
|
|
|
@@ -355,9 +364,9 @@ Examples:
|
|
|
355
364
|
## 📡 **Providers**
|
|
356
365
|
|
|
357
366
|
Main feature of this library is using providers for get and set environment variables.
|
|
358
|
-
So, you can define your own provider, but lib came with
|
|
367
|
+
So, you can define your own provider, but lib came with 4 integrated providers:
|
|
359
368
|
|
|
360
|
-
-
|
|
369
|
+
- ## **`package-json`**
|
|
361
370
|
|
|
362
371
|
Load some info from your project `package.json`.
|
|
363
372
|
|
|
@@ -373,9 +382,9 @@ Info read is:
|
|
|
373
382
|
}
|
|
374
383
|
```
|
|
375
384
|
|
|
376
|
-
| Option
|
|
385
|
+
| Option | Description | Type | Default | Required? |
|
|
377
386
|
| ------------------- | --------------------------- | -------- | ------- | --------- |
|
|
378
|
-
| `--vp, --varPrefix` | Prefix for loaded variables | `string` | `""`
|
|
387
|
+
| `--vp, --varPrefix` | Prefix for loaded variables | `string` | `""` | No |
|
|
379
388
|
|
|
380
389
|
Examples:
|
|
381
390
|
|
|
@@ -385,7 +394,7 @@ Examples:
|
|
|
385
394
|
|
|
386
395
|
</br>
|
|
387
396
|
|
|
388
|
-
-
|
|
397
|
+
- ## **`app-settings`**
|
|
389
398
|
|
|
390
399
|
Non secrets loader for `appsettings.json`.
|
|
391
400
|
|
|
@@ -436,65 +445,38 @@ In example:
|
|
|
436
445
|
}
|
|
437
446
|
```
|
|
438
447
|
|
|
439
|
-
| Option
|
|
440
|
-
|
|
|
441
|
-
| `--ef, --envFile`
|
|
442
|
-
| `--sp, --sectionPrefix` | Prefix for env and modes in env file | `string` | `` | No |
|
|
448
|
+
| Option | Description | Type | Default | Required? |
|
|
449
|
+
| ----------------- | ------------------------------- | -------- | --------------------------- | --------- |
|
|
450
|
+
| `--ef, --envFile` | Environment variables file path | `string` | `[[root]]/appsettings.json` | No |
|
|
443
451
|
|
|
444
452
|
</br>
|
|
445
453
|
|
|
446
|
-
-
|
|
454
|
+
- ## **`secrets`**
|
|
447
455
|
|
|
448
456
|
Secrets loader for `env/[[env]].env.json`.
|
|
449
457
|
|
|
450
|
-
| Option
|
|
458
|
+
| Option | Description | Type | Default | Required? |
|
|
451
459
|
| --------------------- | -------------------------- | -------- | --------------------------- | --------- |
|
|
452
|
-
| `--sf, --secretsFile` | Secret variables file path | `string` | `[[root]]/[[env]].env.json` | No
|
|
460
|
+
| `--sf, --secretsFile` | Secret variables file path | `string` | `[[root]]/[[env]].env.json` | No |
|
|
453
461
|
|
|
454
|
-
-
|
|
462
|
+
- ## **`local`**
|
|
455
463
|
|
|
456
464
|
Local variables loader for `env/[[env]].local.env.json`.
|
|
457
465
|
|
|
458
|
-
| Option
|
|
466
|
+
| Option | Description | Type | Default | Required? |
|
|
459
467
|
| ------------------- | ------------------------- | -------- | --------------------------------- | --------- |
|
|
460
|
-
| `--lf, --localFile` | Local variables file path | `string` | `[[root]]/[[env]].local.env.json` | No
|
|
461
|
-
|
|
462
|
-
- ## **`package-json`**
|
|
463
|
-
|
|
464
|
-
Load some info from your project `package.json`.
|
|
465
|
-
|
|
466
|
-
Info read is:
|
|
467
|
-
|
|
468
|
-
```json
|
|
469
|
-
{
|
|
470
|
-
"version": "1.0.0",
|
|
471
|
-
"project": "project-name",
|
|
472
|
-
"name": "@package-name",
|
|
473
|
-
"title": "app-name",
|
|
474
|
-
"description": "any description"
|
|
475
|
-
}
|
|
476
|
-
```
|
|
477
|
-
|
|
478
|
-
| Option | Description | Type | Default | Required? |
|
|
479
|
-
| ------------------- | --------------------------- | -------- | ------- | --------- |
|
|
480
|
-
| `--vp, --varPrefix` | Prefix for loaded variables | `string` | `""` | No |
|
|
481
|
-
|
|
482
|
-
Examples:
|
|
483
|
-
|
|
484
|
-
```bash
|
|
485
|
-
> env -e dev -m build : react-script build : --vp REACT_APP_
|
|
486
|
-
```
|
|
468
|
+
| `--lf, --localFile` | Local variables file path | `string` | `[[root]]/[[env]].local.env.json` | No |
|
|
487
469
|
|
|
488
470
|
<p align="right">(<a href="#top">back to top</a>)</p>
|
|
489
471
|
|
|
490
|
-
<!-- PROVIDERS -->
|
|
472
|
+
<!-- CUSTOM PROVIDERS -->
|
|
491
473
|
|
|
492
474
|
## ✒ **Creating Custom Providers**
|
|
493
475
|
|
|
494
476
|
You can create your custom providers, in two ways:
|
|
495
477
|
|
|
496
|
-
-
|
|
497
|
-
-
|
|
478
|
+
- **Local Script**: you must create a JavaScript file (.js), exporting by default your "provider" following standard interface exported by this lib.
|
|
479
|
+
- **NPM Package**: you must create your custom NPM library and export by default your "provider" using standard interface exported by this lib.
|
|
498
480
|
|
|
499
481
|
How to load your provider is shown in Config Section.
|
|
500
482
|
|
|
@@ -617,19 +599,19 @@ You can configure any config argument inside you config file, but commonly provi
|
|
|
617
599
|
|
|
618
600
|
## 📑 Roadmap
|
|
619
601
|
|
|
620
|
-
-
|
|
621
|
-
-
|
|
622
|
-
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
-
|
|
629
|
-
-
|
|
630
|
-
-
|
|
631
|
-
-
|
|
632
|
-
-
|
|
602
|
+
- [x] Environment injection handling
|
|
603
|
+
- [x] Customizable variables store providers
|
|
604
|
+
- [x] Commands
|
|
605
|
+
- [x] `push` executes a pushing action over every providers
|
|
606
|
+
- [x] `pull` executes a pulling action over every providers
|
|
607
|
+
- [x] `schema` regenerates JSON schema using providers output
|
|
608
|
+
- [x] `export` exports environment variables in json or dotenv format
|
|
609
|
+
- [ ] `prepare` prepares environment (creates folder and files required)
|
|
610
|
+
- [ ] Improve documentation
|
|
611
|
+
- [ ] Providers pull history
|
|
612
|
+
- [ ] Providers pull and push difference calc and prompts
|
|
613
|
+
- [ ] Providers dependsOn option
|
|
614
|
+
- [ ] Programatic module
|
|
633
615
|
|
|
634
616
|
<p align="right">(<a href="#top">back to top</a>)</p>
|
|
635
617
|
|
|
@@ -637,7 +619,7 @@ You can configure any config argument inside you config file, but commonly provi
|
|
|
637
619
|
|
|
638
620
|
Project uses ESLint, for code formatting and code styling normalizing.
|
|
639
621
|
|
|
640
|
-
-
|
|
622
|
+
- **eslint**: linter integrated with TypeScript.
|
|
641
623
|
|
|
642
624
|
For correct interpretation of linters, is recommended to use [Visual Studio Code](https://code.visualstudio.com/) as IDE and install the plugins in .vscode folder at 'extensions.json', as well as use the config provided in 'settings.json'
|
|
643
625
|
|
|
@@ -655,12 +637,14 @@ For last changes see [CHANGELOG.md](CHANGELOG.md) file for details.
|
|
|
655
637
|
|
|
656
638
|
## 🛠️ Built with
|
|
657
639
|
|
|
658
|
-
-
|
|
659
|
-
-
|
|
660
|
-
-
|
|
661
|
-
-
|
|
662
|
-
-
|
|
663
|
-
-
|
|
640
|
+
- [yargs](http://yargs.js.org/)
|
|
641
|
+
- [tslog](https://tslog.js.org/#/) (v4)
|
|
642
|
+
- [picocolors](https://github.com/alexeyraspopov/picocolors)
|
|
643
|
+
- [subslate](https://github.com/josh-hemphill/subslate)
|
|
644
|
+
- [merge-deep](https://github.com/jonschlinkert/merge-deep)
|
|
645
|
+
- [ajv](https://ajv.js.org/)
|
|
646
|
+
- [to-json-schema](https://www.npmjs.com/package/to-json-schema)
|
|
647
|
+
- [vite](https://vite.dev/) + [vitest](https://vitest.dev/) (build & test)
|
|
664
648
|
|
|
665
649
|
<p align="right">(<a href="#top">back to top</a>)</p>
|
|
666
650
|
|
package/arguments.d.ts
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
import { JSONSchemaType } from 'ajv';
|
|
2
2
|
import { Arguments, Options } from 'yargs';
|
|
3
|
-
import { EnvProviderConfig } from './interfaces';
|
|
3
|
+
import { EnvProviderConfig } from './interfaces/index.js';
|
|
4
4
|
export interface CommandArguments extends Arguments {
|
|
5
|
-
env: string;
|
|
6
|
-
modes?: string[];
|
|
7
|
-
projectInfo: Record<string, unknown>;
|
|
8
|
-
schema?: Record<string, JSONSchemaType<object>>;
|
|
9
|
-
providers: EnvProviderConfig[];
|
|
10
|
-
ci: boolean;
|
|
11
|
-
nestingDelimiter: string;
|
|
12
5
|
arrayDescomposition: boolean;
|
|
13
|
-
|
|
14
|
-
root: string;
|
|
6
|
+
ci: boolean;
|
|
15
7
|
configFile: string;
|
|
16
|
-
|
|
8
|
+
detectFormat: boolean;
|
|
9
|
+
env: string;
|
|
10
|
+
expand: boolean;
|
|
11
|
+
nestingDelimiter: string;
|
|
12
|
+
nullable: boolean;
|
|
17
13
|
packageJson: string;
|
|
14
|
+
projectInfo: Record<string, string>;
|
|
15
|
+
providers: EnvProviderConfig[];
|
|
18
16
|
resolve: 'merge' | 'override';
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
root: string;
|
|
18
|
+
schemaFile: string;
|
|
19
|
+
exportIgnoreKeys?: string[];
|
|
20
|
+
logLevel?: 'debug' | 'error' | 'info' | 'silly' | 'trace' | 'warn';
|
|
22
21
|
logMaskAnyRegEx?: string[];
|
|
23
22
|
logMaskValuesOfKeys?: string[];
|
|
24
|
-
|
|
23
|
+
modes?: string[];
|
|
24
|
+
schema?: Record<string, JSONSchemaType<object>>;
|
|
25
25
|
}
|
|
26
26
|
export declare const args: Record<keyof CommandArguments, Options>;
|
|
27
27
|
//# sourceMappingURL=arguments.d.ts.map
|
package/arguments.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arguments.d.ts","sourceRoot":"","sources":["../src/arguments.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"arguments.d.ts","sourceRoot":"","sources":["../src/arguments.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAE1C,OAAO,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAU/D,MAAM,WAAW,gBAAiB,SAAQ,SAAS;IAClD,mBAAmB,EAAE,OAAO,CAAC;IAC7B,EAAE,EAAE,OAAO,CAAC;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,OAAO,CAAC;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,OAAO,CAAC;IAChB,gBAAgB,EAAE,MAAM,CAAC;IACzB,QAAQ,EAAE,OAAO,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,SAAS,EAAE,iBAAiB,EAAE,CAAC;IAC/B,OAAO,EAAE,OAAO,GAAG,UAAU,CAAC;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC5B,QAAQ,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,GAAG,MAAM,CAAC;IACnE,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC/B,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC;CAChD;AAGD,eAAO,MAAM,IAAI,EAAE,MAAM,CAAC,MAAM,gBAAgB,EAAE,OAAO,CA8HxD,CAAC"}
|