@nitra/check-env 3.0.0 → 3.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,16 +1,13 @@
1
1
  {
2
2
  "name": "@nitra/check-env",
3
- "version": "3.0.0",
3
+ "version": "3.2.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
  },
10
- "scripts": {
11
- "fix": "npx eslint --fix --ext .js . && npx prettier --write '**/*.js'",
12
- "test": "NODE_OPTIONS=--experimental-vm-modules npx jest"
13
- },
14
11
  "repository": {
15
12
  "type": "git",
16
13
  "url": "git+https://github.com/nitra/checkenv.git"
@@ -20,11 +17,6 @@
20
17
  "email": "contact@francoisbest.com",
21
18
  "url": "https://francoisbest.com"
22
19
  },
23
- "eslintConfig": {
24
- "extends": [
25
- "@nitra"
26
- ]
27
- },
28
20
  "license": "MIT",
29
21
  "bugs": {
30
22
  "url": "https://github.com/nitra/checkenv/issues"
@@ -36,6 +28,7 @@
36
28
  ],
37
29
  "prettier": "@nitra/prettier-config",
38
30
  "files": [
39
- "src"
31
+ "src",
32
+ "types"
40
33
  ]
41
34
  }
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 = {
@@ -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
+ };