@nitra/check-env 3.0.0 → 3.1.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/package.json +4 -2
- package/src/index.js +18 -1
- package/types/index.d.ts +17 -0
package/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nitra/check-env",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"description": "Check that the critical environment variables are set",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.js",
|
|
7
|
+
"types": "./types/index.d.ts",
|
|
7
8
|
"exports": {
|
|
8
9
|
".": "./src/index.js"
|
|
9
10
|
},
|
|
@@ -36,6 +37,7 @@
|
|
|
36
37
|
],
|
|
37
38
|
"prettier": "@nitra/prettier-config",
|
|
38
39
|
"files": [
|
|
39
|
-
"src"
|
|
40
|
+
"src",
|
|
41
|
+
"types"
|
|
40
42
|
]
|
|
41
43
|
}
|
package/src/index.js
CHANGED
|
@@ -6,6 +6,12 @@ const displayMissing = name => {
|
|
|
6
6
|
console.error(`❌ Missing required environment variable ${name}`)
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
+
/**
|
|
10
|
+
* MissingEnvironmentVariableError
|
|
11
|
+
*
|
|
12
|
+
* @class
|
|
13
|
+
* @extends Error
|
|
14
|
+
*/
|
|
9
15
|
export class MissingEnvironmentVariableError extends Error {
|
|
10
16
|
constructor(envs) {
|
|
11
17
|
const joined = envs.join(', ')
|
|
@@ -14,6 +20,13 @@ export class MissingEnvironmentVariableError extends Error {
|
|
|
14
20
|
}
|
|
15
21
|
|
|
16
22
|
const checked = new Set()
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Перевірка наявності змінних середовища
|
|
26
|
+
*
|
|
27
|
+
* @function
|
|
28
|
+
* @param {Array.<String>} required
|
|
29
|
+
*/
|
|
17
30
|
export const checkEnv = required => {
|
|
18
31
|
const missingReq = []
|
|
19
32
|
|
|
@@ -32,7 +45,11 @@ export const checkEnv = required => {
|
|
|
32
45
|
}
|
|
33
46
|
}
|
|
34
47
|
|
|
35
|
-
|
|
48
|
+
/**
|
|
49
|
+
* Для сумісності з попередніми версіями
|
|
50
|
+
*
|
|
51
|
+
* @param {Array.<String>} required to capture
|
|
52
|
+
*/
|
|
36
53
|
export default checkEnv
|
|
37
54
|
|
|
38
55
|
const envProxyHandler = {
|
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MissingEnvironmentVariableError
|
|
3
|
+
*
|
|
4
|
+
* @class
|
|
5
|
+
* @extends Error
|
|
6
|
+
*/
|
|
7
|
+
export class MissingEnvironmentVariableError extends Error {
|
|
8
|
+
constructor(envs: any);
|
|
9
|
+
}
|
|
10
|
+
export function checkEnv(required: Array<string>): void;
|
|
11
|
+
export default checkEnv;
|
|
12
|
+
/**
|
|
13
|
+
* @type {Object.<string, string>}
|
|
14
|
+
*/
|
|
15
|
+
export const env: {
|
|
16
|
+
[x: string]: string;
|
|
17
|
+
};
|