@calvear/env 2.10.6 โ†’ 3.0.1

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.
Files changed (108) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/README.md +515 -677
  3. package/arguments.d.ts +15 -15
  4. package/arguments.d.ts.map +1 -1
  5. package/arguments.js +142 -131
  6. package/arguments.js.map +1 -1
  7. package/assets/logo.svg +30 -0
  8. package/commands/env.command.d.ts +8 -2
  9. package/commands/env.command.d.ts.map +1 -1
  10. package/commands/env.command.js +65 -81
  11. package/commands/env.command.js.map +1 -1
  12. package/commands/export.command.d.ts +9 -2
  13. package/commands/export.command.d.ts.map +1 -1
  14. package/commands/export.command.js +54 -56
  15. package/commands/export.command.js.map +1 -1
  16. package/commands/index.d.ts +5 -5
  17. package/commands/index.d.ts.map +1 -1
  18. package/commands/index.js +5 -14
  19. package/commands/pull.command.d.ts +6 -1
  20. package/commands/pull.command.d.ts.map +1 -1
  21. package/commands/pull.command.js +21 -37
  22. package/commands/pull.command.js.map +1 -1
  23. package/commands/push.command.d.ts +6 -1
  24. package/commands/push.command.d.ts.map +1 -1
  25. package/commands/push.command.js +21 -36
  26. package/commands/push.command.js.map +1 -1
  27. package/commands/schema.command.d.ts +6 -1
  28. package/commands/schema.command.d.ts.map +1 -1
  29. package/commands/schema.command.js +17 -17
  30. package/commands/schema.command.js.map +1 -1
  31. package/exec.d.ts +7 -1
  32. package/exec.d.ts.map +1 -1
  33. package/exec.js +88 -147
  34. package/exec.js.map +1 -1
  35. package/index.d.ts +3 -3
  36. package/index.d.ts.map +1 -1
  37. package/index.js +3 -20
  38. package/interfaces/index.d.ts +1 -1
  39. package/interfaces/index.d.ts.map +1 -1
  40. package/interfaces/loader.interface.d.ts +29 -3
  41. package/interfaces/loader.interface.d.ts.map +1 -1
  42. package/main.d.ts +0 -1
  43. package/main.js +7 -26
  44. package/main.js.map +1 -1
  45. package/package.json +53 -33
  46. package/providers/app-settings.provider.d.ts +5 -3
  47. package/providers/app-settings.provider.d.ts.map +1 -1
  48. package/providers/app-settings.provider.js +36 -51
  49. package/providers/app-settings.provider.js.map +1 -1
  50. package/providers/index.d.ts +2 -2
  51. package/providers/index.d.ts.map +1 -1
  52. package/providers/index.js +18 -28
  53. package/providers/index.js.map +1 -1
  54. package/providers/local.provider.d.ts +5 -2
  55. package/providers/local.provider.d.ts.map +1 -1
  56. package/providers/local.provider.js +27 -40
  57. package/providers/local.provider.js.map +1 -1
  58. package/providers/package-json.provider.d.ts +5 -2
  59. package/providers/package-json.provider.d.ts.map +1 -1
  60. package/providers/package-json.provider.js +26 -28
  61. package/providers/package-json.provider.js.map +1 -1
  62. package/providers/secrets.provider.d.ts +5 -2
  63. package/providers/secrets.provider.d.ts.map +1 -1
  64. package/providers/secrets.provider.js +24 -33
  65. package/providers/secrets.provider.js.map +1 -1
  66. package/utils/argv.util.d.ts +10 -0
  67. package/utils/argv.util.d.ts.map +1 -0
  68. package/utils/argv.util.js +24 -0
  69. package/utils/argv.util.js.map +1 -0
  70. package/utils/command.util.d.ts +71 -4
  71. package/utils/command.util.d.ts.map +1 -1
  72. package/utils/command.util.js +60 -135
  73. package/utils/command.util.js.map +1 -1
  74. package/utils/index.d.ts +8 -6
  75. package/utils/index.d.ts.map +1 -1
  76. package/utils/index.js +9 -23
  77. package/utils/interpolate.util.d.ts +29 -1
  78. package/utils/interpolate.util.d.ts.map +1 -1
  79. package/utils/interpolate.util.js +12 -29
  80. package/utils/interpolate.util.js.map +1 -1
  81. package/utils/json.util.d.ts +41 -3
  82. package/utils/json.util.d.ts.map +1 -1
  83. package/utils/json.util.js +29 -41
  84. package/utils/json.util.js.map +1 -1
  85. package/utils/logger.d.ts +21 -2
  86. package/utils/logger.d.ts.map +1 -1
  87. package/utils/logger.js +31 -17
  88. package/utils/logger.js.map +1 -1
  89. package/utils/normalize.util.d.ts +24 -2
  90. package/utils/normalize.util.d.ts.map +1 -1
  91. package/utils/normalize.util.js +35 -57
  92. package/utils/normalize.util.js.map +1 -1
  93. package/utils/schema.util.d.ts +62 -3
  94. package/utils/schema.util.d.ts.map +1 -1
  95. package/utils/schema.util.js +64 -92
  96. package/utils/schema.util.js.map +1 -1
  97. package/utils/ui.d.ts +14 -0
  98. package/utils/ui.d.ts.map +1 -0
  99. package/utils/ui.js +75 -0
  100. package/utils/ui.js.map +1 -0
  101. package/commands/index.js.map +0 -1
  102. package/index.js.map +0 -1
  103. package/interfaces/index.js +0 -18
  104. package/interfaces/index.js.map +0 -1
  105. package/interfaces/loader.interface.js +0 -3
  106. package/interfaces/loader.interface.js.map +0 -1
  107. package/tsconfig.build.tsbuildinfo +0 -1
  108. package/utils/index.js.map +0 -1
package/README.md CHANGED
@@ -1,677 +1,515 @@
1
- <div id="top" align="center">
2
- <img
3
- alt="logo"
4
- src="https://nodejs.org/static/images/logo.svg"
5
- width="256px"
6
- />
7
-
8
- </br>
9
-
10
- <h1><b>env</b></h1>
11
- <h4>ยกEnvironment variables made easy!</h4>
12
- </div>
13
-
14
- <br />
15
-
16
- <p align="center">
17
- <img
18
- src="https://img.shields.io/badge/version-1.0.0-blue?style=flat-square"
19
- alt="version"
20
- />
21
- &nbsp;
22
- <img
23
- src="https://img.shields.io/badge/TypeScript-007ACC?style=flat-square&logo=typescript&logoColor=white"
24
- alt="typescript"
25
- />
26
- &nbsp;
27
- <img
28
- src="https://img.shields.io/badge/nodejs-~14.0.0_||_^16.14.2-darkgreen?style=flat-square"
29
- alt="nodejs engine"
30
- />
31
- &nbsp;
32
- <img
33
- src="https://img.shields.io/badge/npm->=7.5.6-darkgreen?style=flat-square"
34
- alt="npm engine"
35
- />
36
- &nbsp;
37
- <img
38
- src="https://img.shields.io/badge/License-MIT-yellow.svg?style=flat-square"
39
- alt="license"
40
- />
41
- </p>
42
-
43
- <br />
44
-
45
- <!-- ABOUT THE PROJECT -->
46
-
47
- ## ๐Ÿ“– **About**
48
-
49
- Eases NodeJS <b>environment variable handling</b>, like [env-cmd](https://www.npmjs.com/package/env-cmd) or [dotenv](https://www.npmjs.com/package/dotenv), but with <b>powerfull features and extensibility</b> for adding custom providers (as plugins) for <u>load</u>, <u>pull</u> and <u>push</u> the variables from different stores.
50
-
51
- <p align="right">(<a href="#top">back to top</a>)</p>
52
-
53
- <!-- REQUIREMENTS -->
54
-
55
- ## ๐Ÿ“Œ **Requirements**
56
-
57
- First, [download](https://nodejs.org/) and install **NodeJS**. Version `16` or higher is required.
58
-
59
- Validate installed versions of node and npm with:
60
-
61
- ```bash
62
- > node -v
63
- v16.14.2
64
-
65
- > npm -v
66
- 8.3.0
67
- ```
68
-
69
- You can initialize a new npm project using:
70
-
71
- ```bash
72
- > npm init
73
- ```
74
-
75
- <p align="right">(<a href="#top">back to top</a>)</p>
76
-
77
- <!-- QUICK START -->
78
-
79
- ## โšก๏ธ **Quick start**
80
-
81
- > ๐Ÿ”” Make sure that you have [NodeJS 14+](https://nodejs.org/) installed on your computer.
82
-
83
- - Installs the package:
84
-
85
- ```bash
86
- > npm install @calvear/env
87
-
88
- added 1 packages, and audited 1 packages in 1s
89
-
90
- found 0 vulnerabilities
91
-
92
- > _
93
- ```
94
-
95
- - Executes binary directly:
96
-
97
- ```bash
98
- > node_modules/.bin/env --help
99
-
100
- Usage: env [command] [options..] [: subcmd [:]] [options..]
101
-
102
- Commands:
103
- env [options..] [: <subcmd> :]
104
- env pull [options..]
105
- env push [options..]
106
- env schema [options..]
107
-
108
- > _
109
- ```
110
-
111
- - Or add desired commands in your **npm script** in `package.json`:
112
-
113
- ```javascript
114
- {
115
- ...,
116
- "scripts": {
117
- // starts project injecting "dev" environment variables and debug log level
118
- "start:dev": "env -e dev -m debug : node dist/main.js : --log debug",
119
- // starts project injecting "prod" environment variables
120
- "start:prod": "env -e prod -m debug : node dist/main.js",
121
- ...,
122
- // builds project injecting "prod" environment variables
123
- "build:prod": "env -e prod -m build : tsc",
124
- ...,
125
- "env:schema": "env schema -e dev --ci",
126
- // uploads environment "dev" variables
127
- "env:push:dev": "env push -e dev",
128
- // downloads environment "dev" variables
129
- "env:pull:dev": "env pull -e dev"
130
- },
131
- ...
132
- }
133
- ```
134
-
135
- - Execs your command:
136
-
137
- **file**: _dist/main.js_
138
-
139
- ```javascript
140
- console.log(`My environment loaded is: ${process.env.ENV}`);
141
- ```
142
-
143
- ```bash
144
- > npm run start:dev
145
-
146
- 13:31:59.865 INFO loading dev environment in debug mode
147
- 13:31:59.911 DEBUG using package-json provider
148
- 13:31:59.912 DEBUG using app-settings provider
149
- 13:31:59.914 DEBUG using secrets provider
150
- 13:32:00.109 DEBUG environment loaded:
151
- {
152
- NODE_ENV: 'development',
153
- ENV: 'dev',
154
- VERSION: '1.0.0',
155
- NAME: '@my-app',
156
- VAR1: true,
157
- VAR2: true,
158
- GROUP1__VAR1: 'G1V2',
159
- ARR1: '1,val,true',
160
- SECRET: '***'
161
- }
162
- 13:32:00.116 INFO executing command > node dist/main.js
163
- My environment loaded is: dev
164
- 13:32:00.232 INFO process finished successfully
165
-
166
- > _
167
- ```
168
-
169
- <p align="right">(<a href="#top">back to top</a>)</p>
170
-
171
- ## โ›ฉ **Structure**
172
-
173
- ```bash
174
- โ”œโ”€โ”€ src/
175
- โ”‚ย ย  โ”œโ”€โ”€ commands/ # lib commands handlers
176
- โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ env.command.ts
177
- โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ export.command.ts
178
- โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ pull.command.ts
179
- โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ push.command.ts
180
- โ”‚ย ย  โ”‚ย ย  โ””โ”€โ”€ schema.command.ts
181
- โ”‚ย ย  โ”œโ”€โ”€ interfaces/ # provider interfaces
182
- โ”‚ย ย  โ”œโ”€โ”€ providers/ # integrated providers
183
- โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ package-json.provider.ts
184
- โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ app-settings.provider.ts
185
- โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ secrets.provider.ts
186
- โ”‚ย ย  โ”‚ย ย  โ””โ”€โ”€ local.provider.ts
187
- โ”‚ย ย  โ”œโ”€โ”€ utils/
188
- โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ command.util.ts
189
- โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ interpolate.util.ts
190
- โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ json.util.ts
191
- โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ normalize.util.ts
192
- โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ schema.util.ts
193
- โ”‚ย ย  โ”‚ย ย  โ””โ”€โ”€ logger.ts
194
- โ”‚ย ย  โ”œโ”€โ”€ arguments.ts # global arguments
195
- โ”‚ย ย  โ”œโ”€โ”€ exec.ts # initialization logic (load config, commands, etc.)
196
- โ”‚ย ย  โ””โ”€โ”€ main.ts
197
- โ”œโ”€โ”€ tests/ # integration tests
198
- โ”œโ”€โ”€ .eslintrc.json
199
- โ”œโ”€โ”€ jest.config.json
200
- โ”œโ”€โ”€ tsconfig.build.json
201
- โ””โ”€โ”€ tsconfig.json
202
- ```
203
-
204
- <p align="right">(<a href="#top">back to top</a>)</p>
205
-
206
- <!-- COMMANDS AND OPTIONS -->
207
-
208
- ## โš™๏ธ **Commands & Options**
209
-
210
- Options handling has the ability of **replace arguments itself**, using `[[` and `]]` as delimiters.
211
- So, in example for define your config file path, you must use your _root_ argument,
212
- supposing root has the value of "config", this definition _`[[root]]/any-config-file.json`_ will be
213
- _`config/any-config-file.json`_, or if your _env_ argument is "dev", this definition
214
- _`[[root]]/config-file.[[env]].json`_ will be _`config/config-file.dev.json`_.
215
-
216
- <div align="center">
217
- <span style="font-size:20px;font-weight:bold" align="center">Options</span>
218
- </div>
219
-
220
- ### Global options
221
-
222
- | Option | Description | Type | Default | Required? |
223
- | ---------------------------------- | ----------------------------------------------- | ---------- | ------- | --------- |
224
- | `--help` | Shows help | `boolean` | | No |
225
- | `--e, --env` | Environment for load | `string` | | Yes |
226
- | `-m, --modes` | Execution modes | `string[]` | `[]` | No |
227
- | `--nd, --nestingDelimiter` | Nesting level delimiter for flatten | `string` | `__` | No |
228
- | `--arrDesc, --arrayDescomposition` | Whether serialize or break down arrays | `boolean` | `false` | No |
229
- | `-x, --expand` | Interpolates environment variables using itself | `boolean` | `false` | No |
230
- | `-ci` | Continuous Integration mode | `boolean` | `false` | No |
231
-
232
- </br>
233
-
234
- ### Workspace options
235
-
236
- | Option | Description | Type | Default | Required? |
237
- | ------------------ | --------------------------------- | -------- | --------------------------------- | --------- |
238
- | `--root` | Default environment folder path | `string` | `env` | No |
239
- | `-c, --configFile` | Config JSON file path | `string` | `[[root]]/settings/settings.json` | No |
240
- | `-s, --schemaFile` | Environment Schema JSON file path | `string` | `[[root]]/settings/schema.json` | No |
241
-
242
- ### JSON Schema options
243
-
244
- | Option | Description | Type | Default | Required? |
245
- | ---------------------- | ---------------------------------------------------------- | ----------------- | ------- | --------- |
246
- | `-r, --resolve` | Whether merges new schema or override | `merge, override` | `merge` | No |
247
- | `--null, --nullable` | Whether variables are nullable by default | `boolean` | `true` | No |
248
- | `--df, --detectFormat` | Whether format of strings variables are included in schema | `boolean` | `true` | No |
249
-
250
- ### Logger options
251
-
252
- | Option | Description | Type | Default | Required? |
253
- | ------------------- | ----------- | ---------------------------------------- | ------- | --------- |
254
- | `--log, --logLevel` | Log level | `silly, trace, debug, info, warn, error` | `info` | No |
255
-
256
- <div align="center">
257
- <span style="font-size:20px;font-weight:bold" align="center">Commands</span>
258
- </div>
259
-
260
- - ## **`env`**
261
-
262
- Inject your environment variables into `process.env` and executes a command.
263
-
264
- ```bash
265
- env -e [env] [options..] [: subcmd [:]] [options..]
266
- ```
267
-
268
- Examples:
269
-
270
- ```bash
271
- > env -e dev -m test unit : npm test
272
- ```
273
-
274
- ```bash
275
- > env -e dev -m debug : npm start : -c [[root]]/[[env]].settings.json
276
- ```
277
-
278
- ```bash
279
- > env -e prod -m build optimize : npm build
280
- ```
281
-
282
- - ## **`pull`**
283
-
284
- Pulls environment variables from providers stores.
285
-
286
- ```bash
287
- env pull -e [env] [options..]
288
- ```
289
-
290
- | Option | Description | Type | Default | Required? |
291
- | ----------------- | ------------------------- | --------- | ------- | --------- |
292
- | `-o, --overwrite` | Overwrite local variables | `boolean` | `false` | No |
293
-
294
- Examples:
295
-
296
- ```bash
297
- > env pull -e dev
298
- ```
299
-
300
- - ## **`push`**
301
-
302
- Pushes environment variables to providers stores.
303
-
304
- ```bash
305
- env push -e [env] [options..]
306
- ```
307
-
308
- | Option | Description | Type | Default | Required? |
309
- | ------------- | ------------------------------------ | --------- | ------- | --------- |
310
- | `-f, --force` | Force push for secrets (replace all) | `boolean` | `false` | No |
311
-
312
- Examples:
313
-
314
- ```bash
315
- > env push -e dev
316
- ```
317
-
318
- - ## **`schema`**
319
-
320
- Generates validation schema from providers output variables.
321
-
322
- ```bash
323
- env schema -e [env] -m [modes] [options..]
324
- ```
325
-
326
- Examples:
327
-
328
- ```bash
329
- > env schema -e dev -m build
330
- ```
331
-
332
- - ## **`export`**
333
-
334
- Export unified environment variables to a file from providers.
335
-
336
- ```bash
337
- env export -e [env] -m [modes] [options..]
338
- ```
339
-
340
- | Option | Description | Type | Default | Required? |
341
- | --------------- | ---------------------------------- | -------- | -------- | --------- |
342
- | `-u, -p, --uri` | Uri for export file with variables | `string` | `.env` | No |
343
- | `-f, --format` | Format for export variables | `string` | `dotenv` | No |
344
-
345
- Examples:
346
-
347
- ```bash
348
- > env export -e dev -m build -f json --uri [[env]].env.json
349
- ```
350
-
351
- <p align="right">(<a href="#top">back to top</a>)</p>
352
-
353
- <!-- PROVIDERS -->
354
-
355
- ## ๐Ÿ“ก **Providers**
356
-
357
- 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 3 integrated providers:
359
-
360
- - ## **`package-json`**
361
-
362
- Load some info from your project `package.json`.
363
-
364
- Info read is:
365
-
366
- ```json
367
- {
368
- "version": "1.0.0",
369
- "project": "project-name",
370
- "name": "@package-name",
371
- "title": "app-name",
372
- "description": "any description"
373
- }
374
- ```
375
-
376
- | Option | Description | Type | Default | Required? |
377
- | ------------------- | --------------------------- | -------- | ------- | --------- |
378
- | `--vp, --varPrefix` | Prefix for loaded variables | `string` | `""` | No |
379
-
380
- Examples:
381
-
382
- ```bash
383
- > env -e dev -m build : react-script build : --vp REACT_APP_
384
- ```
385
-
386
- </br>
387
-
388
- - ## **`app-settings`**
389
-
390
- Non secrets loader for `appsettings.json`.
391
-
392
- `appsettings.json` file has the format below:
393
-
394
- ```json
395
- {
396
- "|DEFAULT|": {},
397
- "|MODE|": {},
398
- "|ENV|": {}
399
- }
400
- ```
401
-
402
- In example:
403
-
404
- ```json
405
- {
406
- "|DEFAULT|": {
407
- "VAR1": "v1_default"
408
- },
409
- "|MODE|": {
410
- "build": {
411
- "NODE_ENV": "production"
412
- },
413
- "debug": {
414
- "NODE_ENV": "development"
415
- },
416
- "test": {
417
- "NODE_ENV": "test"
418
- }
419
- },
420
- "|ENV|": {
421
- "dev": {
422
- "C1": "V1",
423
- "C2": "V2",
424
- "C3": 3,
425
- "GROUP1": {
426
- "VAR1": null,
427
- "VAR2": "G1V2",
428
- "VAR3": true,
429
- "GROUP2": {
430
- "VAR1": "G1G2V1"
431
- }
432
- },
433
- "C4": "23"
434
- }
435
- }
436
- }
437
- ```
438
-
439
- | Option | Description | Type | Default | Required? |
440
- | ----------------------- | ------------------------------------ | -------- | --------------------------- | --------- |
441
- | `--ef, --envFile` | Environment variables file path | `string` | `[[root]]/appsettings.json` | No |
442
- | `--sp, --sectionPrefix` | Prefix for env and modes in env file | `string` | `` | No |
443
-
444
- </br>
445
-
446
- - ## **`secrets`**
447
-
448
- Secrets loader for `env/[[env]].env.json`.
449
-
450
- | Option | Description | Type | Default | Required? |
451
- | --------------------- | -------------------------- | -------- | --------------------------- | --------- |
452
- | `--sf, --secretsFile` | Secret variables file path | `string` | `[[root]]/[[env]].env.json` | No |
453
-
454
- - ## **`local`**
455
-
456
- Local variables loader for `env/[[env]].local.env.json`.
457
-
458
- | Option | Description | Type | Default | Required? |
459
- | ------------------- | ------------------------- | -------- | --------------------------------- | --------- |
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
- ```
487
-
488
- <p align="right">(<a href="#top">back to top</a>)</p>
489
-
490
- <!-- PROVIDERS -->
491
-
492
- ## โœ’ **Creating Custom Providers**
493
-
494
- You can create your custom providers, in two ways:
495
-
496
- - **Local Script**: you must create a JavaScript file (.js), exporting by default your "provider" following standard interface exported by this lib.
497
- - **NPM Package**: you must create your custom NPM library and export by default your "provider" using standard interface exported by this lib.
498
-
499
- How to load your provider is shown in Config Section.
500
-
501
- In example, a provider exported by your NPM package written in TypeScript should be like:
502
-
503
- ```typescript
504
- import { CommandArguments, EnvProvider } from '@calvear/env';
505
- import { logger, readJson, writeJson } from '@calvear/env/utils';
506
-
507
- const KEY = 'my-unique-provider-key';
508
-
509
- interface MyProviderCommandArguments extends CommandArguments {
510
- anyExtraOption: boolean;
511
- }
512
-
513
- export const MyProvider: EnvProvider<MyProviderCommandArguments> = {
514
- // unique identifier for provider
515
- key: KEY,
516
-
517
- // (optional) allows to provider adds new arguments/options
518
- // to commands using yargs for builder
519
- builder: (builder) => {
520
- builder.options({
521
- anyExtraOption: {
522
- group: KEY,
523
- alias: ['a', 'aeo'],
524
- type: 'boolean',
525
- default: false,
526
- describe: 'Any option description',
527
- },
528
- });
529
- },
530
-
531
- // call on environment variables loading,
532
- // may be a Promise
533
- load: ({ env, modes, ...options }) => {
534
- if (env === 'dev')
535
- return {
536
- NODE_ENV: 'development',
537
- };
538
-
539
- // you can return a list of JSON environment variables for merge
540
- return [
541
- {
542
- NODE_ENV: 'production',
543
- ANY_VAR: 'ABC', // will be replaced by value below
544
- },
545
- {
546
- ANY_VAR: 'ANY_VALUE',
547
- ANY_GROUP: {
548
- INNER_VAR: 12,
549
- },
550
- },
551
- ];
552
- },
553
-
554
- // (optional) call on pulling variables from provider store,
555
- // config may pass in your config file
556
- pull: ({ env, modes, ...options }, config) => {
557
- // anyway you want for pulling variables to cache
558
- },
559
-
560
- // (optional) call on pushing/updating variables to provider store,
561
- // config may pass in your config file
562
- push: ({ env, modes, ...options }, config) => {
563
- // anyway you should do for pushing or updating your variables
564
- },
565
- };
566
- ```
567
-
568
- <p align="right">(<a href="#top">back to top</a>)</p>
569
-
570
- <!-- CONFIG -->
571
-
572
- ## ๐Ÿ“ฅ **Config**
573
-
574
- You can configure any config argument inside you config file, but commonly providers are designed for this purpose.
575
-
576
- ```javascript
577
- {
578
- "log": "silly",
579
- // will hide values of keys SECRET and MY_API_KEY in logging
580
- "logMaskValuesOfKeys": ["SECRET", "MY_API_KEY"],
581
- // integrated providers and custom providers together
582
- "providers": [
583
- {
584
- "path": "package-json",
585
- "type": "integrated"
586
- },
587
- {
588
- "path": "app-settings",
589
- "type": "integrated"
590
- },
591
- {
592
- "path": "secrets",
593
- "type": "integrated"
594
- },
595
- {
596
- "path": "local",
597
- "type": "integrated"
598
- },
599
- {
600
- // custom NPM package
601
- "path": "@npm-package",
602
- "type": "module",
603
- "config": {
604
- "any-config": "any value"
605
- }
606
- },
607
- {
608
- // custom script inside project
609
- "path": "scripts/custom-loader.js",
610
- "type": "script"
611
- }
612
- ]
613
- }
614
- ```
615
-
616
- <!-- ROADMAP -->
617
-
618
- ## ๐Ÿ“‘ Roadmap
619
-
620
- - [x] Environment injection handling
621
- - [x] Customizable variables store providers
622
- - [x] Commands
623
- - [x] `push` executes a pushing action over every providers
624
- - [x] `pull` executes a pulling action over every providers
625
- - [x] `schema` regenerates JSON schema using providers output
626
- - [x] `export` exports environment variables in json or dotenv format
627
- - [ ] `prepare` prepares environment (creates folder and files required)
628
- - [ ] Improve documentation
629
- - [ ] Providers pull history
630
- - [ ] Providers pull and push difference calc and prompts
631
- - [ ] Providers dependsOn option
632
- - [ ] Programatic module
633
-
634
- <p align="right">(<a href="#top">back to top</a>)</p>
635
-
636
- ## ๐Ÿงฟ **Linting**
637
-
638
- Project uses ESLint, for code formatting and code styling normalizing.
639
-
640
- - **eslint**: linter integrated with TypeScript.
641
-
642
- 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
-
644
- <p align="right">(<a href="#top">back to top</a>)</p>
645
-
646
- <!-- CHANGELOG -->
647
-
648
- ## ๐Ÿ“‹ Changelog
649
-
650
- For last changes see [CHANGELOG.md](CHANGELOG.md) file for details.
651
-
652
- <p align="right">(<a href="#top">back to top</a>)</p>
653
-
654
- <!-- BUILT WITH -->
655
-
656
- ## ๐Ÿ› ๏ธ Built with
657
-
658
- - [yargs](http://yargs.js.org/)
659
- - [tslog](https://tslog.js.org/#/)
660
- - [subslate](https://github.com/josh-hemphill/subslate)
661
- - [merge-deep](https://github.com/jonschlinkert/merge-deep)
662
- - [ajv](https://ajv.js.org/)
663
- - [to-json-schema](https://www.npmjs.com/package/to-json-schema)
664
-
665
- <p align="right">(<a href="#top">back to top</a>)</p>
666
-
667
- <!-- LICENSE -->
668
-
669
- ## ๐Ÿ“„ License
670
-
671
- This project is licensed under the MIT License - see [LICENSE.md](LICENSE.md) file for details.
672
-
673
- <p align="right">(<a href="#top">back to top</a>)</p>
674
-
675
- ---
676
-
677
- โŒจ by [Alvear Candia, Cristopher Alejandro](https://github.com/calvear93)
1
+ <div id="top" align="center">
2
+ <img alt="@calvear/env logo" src="assets/logo.svg" width="150" />
3
+
4
+ <h1 align="center"><b>env</b></h1>
5
+ <h4 align="center">Environment variables made easy โ€” load, validate, inject.</h4>
6
+
7
+ <p align="center">
8
+ <img src="https://img.shields.io/npm/v/@calvear/env?style=flat-square&color=2563eb&label=version" alt="version" />
9
+ &nbsp;
10
+ <img src="https://img.shields.io/badge/module-ESM-f59e0b?style=flat-square" alt="esm" />
11
+ &nbsp;
12
+ <img src="https://img.shields.io/badge/TypeScript-007ACC?style=flat-square&logo=typescript&logoColor=white" alt="typescript" />
13
+ &nbsp;
14
+ <img src="https://img.shields.io/badge/node->=20-339933?style=flat-square&logo=node.js&logoColor=white" alt="node engine" />
15
+ &nbsp;
16
+ <img src="https://img.shields.io/badge/coverage-100%25-22c55e?style=flat-square" alt="coverage" />
17
+ &nbsp;
18
+ <img src="https://img.shields.io/npm/l/@calvear/env?style=flat-square&color=eab308" alt="license" />
19
+ </p>
20
+ </div>
21
+
22
+ <br />
23
+
24
+ <!-- ABOUT -->
25
+
26
+ ## ๐Ÿ“– About
27
+
28
+ `@calvear/env` eases **environment variable handling** for NodeJS apps โ€” like
29
+ [env-cmd](https://www.npmjs.com/package/env-cmd) or
30
+ [dotenv](https://www.npmjs.com/package/dotenv), but with **powerful, extensible
31
+ features**: pluggable **providers** to `load`, `pull` and `push` variables from
32
+ different stores, **JSON Schema validation**, value **interpolation**, secret
33
+ **masking** and nested/shared keys.
34
+
35
+ ### โœจ Features
36
+
37
+ - ๐Ÿงฉ **Provider plugins** โ€” bundled `package-json`, `app-settings`, `secrets`
38
+ and `local` providers, plus your own (NPM package or local script).
39
+ - ๐Ÿ’‰ **Injection** โ€” load variables into `process.env` and run any command.
40
+ - โœ… **JSON Schema** โ€” auto-generate and validate variables before injecting.
41
+ - ๐Ÿช† **Nested & shared keys** โ€” `GROUP__VAR` flattening and `$`-prefixed shared
42
+ keys.
43
+ - ๐Ÿงต **Interpolation** โ€” reference other args/vars with `[[ ]]` delimiters.
44
+ - ๐Ÿ™ˆ **Masking** โ€” hide secret values in logs.
45
+ - ๐Ÿ“ค **Export** โ€” write the unified environment to a `.env` or JSON file.
46
+
47
+ <p align="right">(<a href="#top">back to top</a>)</p>
48
+
49
+ <!-- REQUIREMENTS -->
50
+
51
+ ## ๐Ÿ“Œ Requirements
52
+
53
+ [NodeJS](https://nodejs.org/) **20 or higher**.
54
+
55
+ ```bash
56
+ > node -v
57
+ v20.0.0
58
+ ```
59
+
60
+ <p align="right">(<a href="#top">back to top</a>)</p>
61
+
62
+ <!-- ESM -->
63
+
64
+ ## ๐Ÿ“ฆ ESM only
65
+
66
+ Since **v3** this package is **ESM-only** (`"type": "module"`). Consumers must
67
+ use ESM `import` syntax, and custom providers must be ESM modules that `export`
68
+ their provider object.
69
+
70
+ ```javascript
71
+ // โœ… ESM
72
+ import { EnvProvider } from '@calvear/env';
73
+
74
+ // โŒ CommonJS require is not supported
75
+ // const { EnvProvider } = require('@calvear/env');
76
+ ```
77
+
78
+ <p align="right">(<a href="#top">back to top</a>)</p>
79
+
80
+ <!-- QUICK START -->
81
+
82
+ ## โšก๏ธ Quick start
83
+
84
+ Install the package:
85
+
86
+ ```bash
87
+ > npm install @calvear/env
88
+ ```
89
+
90
+ Run the binary directly:
91
+
92
+ ```bash
93
+ > npx env --help
94
+
95
+ Usage: env [command] [options..] [: subcmd [:]] [options..]
96
+
97
+ Commands:
98
+ env [options..] [: <subcmd> :]
99
+ env pull [options..]
100
+ env push [options..]
101
+ env schema [options..]
102
+ env export [options..]
103
+ ```
104
+
105
+ Or wire it into your **npm scripts**:
106
+
107
+ ```jsonc
108
+ {
109
+ "scripts": {
110
+ // inject "dev" variables (debug mode) and start the app
111
+ "start:dev": "env -e dev -m debug : node dist/main.js",
112
+ // inject "prod" variables for the build
113
+ "build:prod": "env -e prod -m build : tsc",
114
+ // regenerate the validation schema
115
+ "env:schema": "env schema -e dev",
116
+ },
117
+ }
118
+ ```
119
+
120
+ Run it:
121
+
122
+ ```bash
123
+ > npm run start:dev
124
+
125
+ โšก env v3.0.0 ยท ๐ŸŒŽ dev ยท ๐Ÿงฉ debug
126
+
127
+ ๐Ÿ“ฆ package-json 6 vars
128
+ ๐Ÿ—‚๏ธ app-settings 5 vars
129
+ ๐Ÿ” secrets 1 secrets
130
+ ๐Ÿ“‚ local 1 vars
131
+
132
+ environment (12 variables)
133
+ ENV = dev
134
+ NODE_ENV = development
135
+ SECRET = ***
136
+ VERSION = 3.0.0
137
+ ...
138
+
139
+ โœ“ 12 variables loaded in 142ms
140
+
141
+ โ–ถ node dist/main.js
142
+ My environment loaded is: dev
143
+ โœ“ finished in 168ms
144
+ ```
145
+
146
+ <p align="right">(<a href="#top">back to top</a>)</p>
147
+
148
+ <!-- COMMANDS AND OPTIONS -->
149
+
150
+ ## โš™๏ธ Commands & Options
151
+
152
+ > **Interpolation** โ€” any option value can reference other arguments using `[[`
153
+ > and `]]` delimiters. With `root: "config"`, the value `[[root]]/file.json`
154
+ > resolves to `config/file.json`; with `env: "dev"`,
155
+ > `[[root]]/config.[[env]].json` resolves to `config/config.dev.json`.
156
+
157
+ ### Global options
158
+
159
+ | Option | Description | Type | Default |
160
+ | ---------------------------------- | ------------------------------------------------- | ---------- | ------- |
161
+ | `--help` | Show help | `boolean` | |
162
+ | `-e, --env` | Environment to load (i.e. `dev`, `prod`) | `string` | |
163
+ | `-m, --modes` | Execution modes (i.e. `debug`, `test`) | `string[]` | `[]` |
164
+ | `--nd, --nestingDelimiter` | Nesting-level delimiter for flatten | `string` | `__` |
165
+ | `--arrDesc, --arrayDescomposition` | Serialize (`false`) or break down (`true`) arrays | `boolean` | `false` |
166
+ | `-x, --expand` | Interpolate environment variables using itself | `boolean` | `false` |
167
+ | `--ci` | Continuous Integration mode (skips local files) | `boolean` | auto |
168
+
169
+ ### Workspace options
170
+
171
+ | Option | Description | Type | Default |
172
+ | ---------------------- | --------------------------------- | -------- | --------------------------------- |
173
+ | `--root` | Base environment folder path | `string` | `env` |
174
+ | `-c, --configFile` | Config JSON file path | `string` | `[[root]]/settings/settings.json` |
175
+ | `-s, --schemaFile` | Environment schema JSON file path | `string` | `[[root]]/settings/schema.json` |
176
+ | `--pkg, --packageJson` | `package.json` path | `string` | _cwd_ |
177
+
178
+ ### JSON Schema options
179
+
180
+ | Option | Description | Type | Default |
181
+ | ---------------------- | ---------------------------------------------- | ------------------ | ------- |
182
+ | `-r, --resolve` | Merge new schema or override it | `merge`/`override` | `merge` |
183
+ | `--null, --nullable` | Whether variables are nullable by default | `boolean` | `true` |
184
+ | `--df, --detectFormat` | Include string formats in the generated schema | `boolean` | `false` |
185
+
186
+ ### Logger options
187
+
188
+ | Option | Description | Type | Default |
189
+ | ------------------------------ | -------------------------------------- | --------------------------------------------- | ------- |
190
+ | `--log, --logLevel` | Log level | `silly`/`trace`/`debug`/`info`/`warn`/`error` | `info` |
191
+ | `--mvk, --logMaskValuesOfKeys` | Mask values of the given keys in logs | `string[]` | `[]` |
192
+ | `--mrx, --logMaskAnyRegEx` | Mask values matching the given regexes | `string[]` | `[]` |
193
+
194
+ ---
195
+
196
+ ### `env`
197
+
198
+ Inject environment variables into `process.env` and execute a command (the
199
+ command goes after `:`).
200
+
201
+ ```bash
202
+ env -e <env> [options..] [: <subcmd> :] [options..]
203
+ ```
204
+
205
+ ```bash
206
+ > env -e dev -m test unit : npm test
207
+ > env -e dev -m debug : npm start : -c [[root]]/[[env]].env.json
208
+ > env -e prod -m build optimize : npm run build
209
+ ```
210
+
211
+ | Option | Description | Type | Default |
212
+ | ------------------------------ | ------------------------------------------ | --------- | ------- |
213
+ | `--validate, --schemaValidate` | Validate variables against the JSON schema | `boolean` | `true` |
214
+
215
+ ### `pull`
216
+
217
+ Pull environment variables from the providers' stores (for providers that
218
+ implement `pull`, i.e. custom remote providers).
219
+
220
+ ```bash
221
+ env pull -e <env> [options..]
222
+ ```
223
+
224
+ | Option | Description | Type | Default |
225
+ | ----------------- | ------------------------- | --------- | ------- |
226
+ | `-o, --overwrite` | Overwrite local variables | `boolean` | `false` |
227
+
228
+ ### `push`
229
+
230
+ Push environment variables to the providers' stores (for providers that
231
+ implement `push`).
232
+
233
+ ```bash
234
+ env push -e <env> [options..]
235
+ ```
236
+
237
+ | Option | Description | Type | Default |
238
+ | ------------- | ---------------------- | --------- | ------- |
239
+ | `-f, --force` | Force push for secrets | `boolean` | `false` |
240
+
241
+ ### `schema`
242
+
243
+ Generate (or update) the validation schema from the providers' output.
244
+
245
+ ```bash
246
+ > env schema -e dev -m build
247
+ ```
248
+
249
+ ### `export`
250
+
251
+ Export the unified environment to a file.
252
+
253
+ ```bash
254
+ env export -e <env> -m <modes> [options..]
255
+ ```
256
+
257
+ | Option | Description | Type | Default |
258
+ | --------------- | --------------------- | --------------- | -------- |
259
+ | `-u, -p, --uri` | Output file path | `string` | `.env` |
260
+ | `-f, --format` | Output format | `dotenv`/`json` | `dotenv` |
261
+ | `-q, --quotes` | Wrap values in quotes | `boolean` | `false` |
262
+
263
+ ```bash
264
+ > env export -e dev -m build -f json --uri [[env]].env.json
265
+ ```
266
+
267
+ <p align="right">(<a href="#top">back to top</a>)</p>
268
+
269
+ <!-- PROVIDERS -->
270
+
271
+ ## ๐Ÿ“ก Providers
272
+
273
+ Providers are the core of this library. It ships with **four integrated
274
+ providers**, and you can add your own.
275
+
276
+ ### `package-json`
277
+
278
+ Loads project info from your `package.json` (`version`, `project`, `name`,
279
+ `title`, `description`) into `ENV`, `VERSION`, `PROJECT`, `NAME`, `TITLE`,
280
+ `DESCRIPTION`.
281
+
282
+ | Option | Description | Type | Default |
283
+ | ------------------- | ------------------------------- | -------- | ------- |
284
+ | `--vp, --varPrefix` | Prefix for the loaded variables | `string` | `""` |
285
+
286
+ ```bash
287
+ # i.e. expose them as REACT_APP_* for CRA
288
+ > env -e dev -m build : react-scripts build : --vp REACT_APP_
289
+ ```
290
+
291
+ ### `app-settings`
292
+
293
+ Non-secret loader for `appsettings.json`, organized by sections:
294
+
295
+ ```jsonc
296
+ {
297
+ "|DEFAULT|": { "VAR1": "v1_default" },
298
+ "|MODE|": {
299
+ "build": { "NODE_ENV": "production" },
300
+ "debug": { "NODE_ENV": "development" },
301
+ },
302
+ "|ENV|": {
303
+ "dev": {
304
+ "C1": "V1",
305
+ "GROUP1": { "VAR2": "G1V2", "GROUP2": { "VAR1": "G1G2V1" } },
306
+ },
307
+ },
308
+ "|LOCAL|": { "dev": { "LOCAL_VAR": "only-local" } },
309
+ }
310
+ ```
311
+
312
+ | Option | Description | Type | Default |
313
+ | ----------------- | ----------------------------- | -------- | --------------------------- |
314
+ | `--ef, --envFile` | Non-secret settings file path | `string` | `[[root]]/appsettings.json` |
315
+
316
+ ### `secrets`
317
+
318
+ Loads secret variables from a per-environment JSON file
319
+ (`[[root]]/[[env]].env.json`). Keep this file out of version control.
320
+
321
+ | Option | Description | Type | Default |
322
+ | --------------------- | -------------------------- | -------- | --------------------------- |
323
+ | `--sf, --secretsFile` | Secret variables file path | `string` | `[[root]]/[[env]].env.json` |
324
+
325
+ ### `local`
326
+
327
+ Loads local-only variables (never loaded in `--ci`). The file is auto-created
328
+ if missing.
329
+
330
+ | Option | Description | Type | Default |
331
+ | ------------------- | ------------------------- | -------- | --------------------------------- |
332
+ | `--lf, --localFile` | Local variables file path | `string` | `[[root]]/[[env]].local.env.json` |
333
+
334
+ <p align="right">(<a href="#top">back to top</a>)</p>
335
+
336
+ <!-- CUSTOM PROVIDERS -->
337
+
338
+ ## โœ’๏ธ Creating custom providers
339
+
340
+ Create a provider in two ways:
341
+
342
+ - **Local script** โ€” a `.js` file that `export default`s your provider.
343
+ - **NPM package** โ€” a published module that `export default`s your provider.
344
+
345
+ Both are wired in the [config file](#-config) via the `providers` list. A custom
346
+ provider can also implement `pull`/`push` to fetch and publish variables from a
347
+ remote store (i.e. a vault, a secrets manager or an API).
348
+
349
+ ```typescript
350
+ import type { CommandArguments, EnvProvider } from '@calvear/env';
351
+ import { logger, readJson, writeJson } from '@calvear/env/utils';
352
+
353
+ const KEY = 'my-unique-provider-key';
354
+
355
+ interface MyProviderArguments extends CommandArguments {
356
+ anyExtraOption: boolean;
357
+ }
358
+
359
+ const MyProvider: EnvProvider<MyProviderArguments> = {
360
+ // unique identifier
361
+ key: KEY,
362
+
363
+ // (optional) add custom options to the CLI via yargs
364
+ builder: (builder) => {
365
+ builder.options({
366
+ anyExtraOption: {
367
+ group: KEY,
368
+ alias: ['a', 'aeo'],
369
+ type: 'boolean',
370
+ default: false,
371
+ describe: 'Any option description',
372
+ },
373
+ });
374
+ },
375
+
376
+ // called on load โ€” may be sync or async, and may return a list to merge
377
+ load: ({ env }) => {
378
+ if (env === 'dev') return { NODE_ENV: 'development' };
379
+
380
+ return [{ NODE_ENV: 'production' }, { ANY_GROUP: { INNER_VAR: 12 } }];
381
+ },
382
+
383
+ // (optional) called on `env pull`
384
+ pull: (argv, config) => {
385
+ /* fetch variables into your local cache */
386
+ },
387
+
388
+ // (optional) called on `env push`
389
+ push: (argv, config) => {
390
+ /* publish/update your variables */
391
+ },
392
+ };
393
+
394
+ export default MyProvider;
395
+ ```
396
+
397
+ <p align="right">(<a href="#top">back to top</a>)</p>
398
+
399
+ <!-- CONFIG -->
400
+
401
+ ## ๐Ÿ“ฅ Config
402
+
403
+ Any CLI argument can be set in your config file
404
+ (`[[root]]/settings/settings.json` by default), but it is mainly used to declare
405
+ **providers**:
406
+
407
+ ```jsonc
408
+ {
409
+ "log": "silly",
410
+ // hide values of these keys in the logs
411
+ "logMaskValuesOfKeys": ["SECRET", "MY_API_KEY"],
412
+ "providers": [
413
+ { "path": "package-json" },
414
+ { "path": "app-settings" },
415
+ { "path": "secrets" },
416
+ { "path": "local" },
417
+ // custom NPM package
418
+ { "path": "@my-scope/my-provider", "type": "module", "config": {} },
419
+ // custom local script
420
+ { "path": "scripts/custom-loader.js", "type": "script" },
421
+ ],
422
+ }
423
+ ```
424
+
425
+ > **Provider order matters** โ€” providers are merged in declaration order, so
426
+ > later providers override earlier ones (`package-json` is the base, `local`
427
+ > wins).
428
+
429
+ <p align="right">(<a href="#top">back to top</a>)</p>
430
+
431
+ <!-- SHARED / NESTED -->
432
+
433
+ ## ๐Ÿช† Shared & nested keys
434
+
435
+ Organize keys in nested objects. Declare **shared** keys (skipping group
436
+ separation) by prefixing them with `$`:
437
+
438
+ ```jsonc
439
+ {
440
+ "$SHARED": "sharedValue",
441
+ "GROUP1": {
442
+ "$SHARED": "sharedValue2",
443
+ "VAR": "anyValue1",
444
+ },
445
+ "GROUP2": { "SUBGROUP1": { "VAR": "anyValue1" } },
446
+ "VAR3": "anyValue3",
447
+ }
448
+ ```
449
+
450
+ Consumed in your app as flattened keys (`__` separator by default):
451
+
452
+ ```javascript
453
+ process.env.GROUP1__VAR; // "anyValue1"
454
+ process.env.GROUP2__SUBGROUP1__VAR; // "anyValue1"
455
+ process.env.VAR3; // "anyValue3"
456
+ // shared keys drop the `$` and the group prefix
457
+ process.env.SHARED; // "sharedValue"
458
+ process.env.GROUP1__SHARED; // "sharedValue2"
459
+ ```
460
+
461
+ ### Priority (lowest โ†’ highest)
462
+
463
+ 1. `package-json` info
464
+ 2. `appsettings.json` (`app-settings`)
465
+ 3. `<env>.env.json` (`secrets`)
466
+ 4. `<env>.local.env.json` (`local`, skipped in `--ci`)
467
+
468
+ <p align="right">(<a href="#top">back to top</a>)</p>
469
+
470
+ <!-- SCRIPTS -->
471
+
472
+ ## ๐Ÿงฐ Development scripts
473
+
474
+ | Script | Description |
475
+ | -------------------- | ------------------------------------------------- |
476
+ | `pnpm build` | Build the library (Vite, ESM) into `dist/` |
477
+ | `pnpm test` | Run unit tests (Vitest) |
478
+ | `pnpm test:cov` | Run unit tests with coverage (100% threshold) |
479
+ | `pnpm test:int` | Run integration tests against the built binary |
480
+ | `pnpm typecheck` | Type-check with `tsc --noEmit` |
481
+ | `pnpm lint` | Lint with ESLint (flat config) |
482
+ | `pnpm format` | Format with Prettier |
483
+ | `pnpm run pub` | Gate + build + publish to npm (`latest`) |
484
+ | `pnpm run pub:alpha` | Gate + build + publish a prerelease (`alpha` tag) |
485
+
486
+ <p align="right">(<a href="#top">back to top</a>)</p>
487
+
488
+ <!-- BUILT WITH -->
489
+
490
+ ## ๐Ÿ› ๏ธ Built with
491
+
492
+ - [yargs](http://yargs.js.org/) โ€” CLI argument parsing
493
+ - [ajv](https://ajv.js.org/) + [to-json-schema](https://www.npmjs.com/package/to-json-schema) โ€” JSON Schema
494
+ - [tslog](https://tslog.js.org/#/) โ€” logging
495
+ - [picocolors](https://github.com/alexeyraspopov/picocolors) โ€” terminal colors
496
+ - [subslate](https://github.com/josh-hemphill/subslate) โ€” interpolation
497
+ - [merge-deep](https://github.com/jonschlinkert/merge-deep) โ€” deep merge
498
+ - [Vite](https://vite.dev/) โ€” build ยท [Vitest](https://vitest.dev/) โ€” testing
499
+
500
+ <p align="right">(<a href="#top">back to top</a>)</p>
501
+
502
+ <!-- LICENSE -->
503
+
504
+ ## ๐Ÿ“„ License
505
+
506
+ This project is licensed under the **MIT License** โ€” see [LICENSE.md](LICENSE.md)
507
+ for details.
508
+
509
+ <p align="right">(<a href="#top">back to top</a>)</p>
510
+
511
+ ---
512
+
513
+ <p align="center">
514
+ โŒจ with โค๏ธ by <a href="https://github.com/calvear93">Alvear Candia, Cristopher Alejandro</a>
515
+ </p>