@pitininja/envious 3.2.0 → 3.3.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.
- package/dist/index.d.ts +1 -1
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/package.json +12 -26
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -5,25 +5,25 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.envious = void 0;
|
|
7
7
|
require("dotenv/config");
|
|
8
|
+
const node_os_1 = __importDefault(require("node:os"));
|
|
8
9
|
const value_1 = require("@sinclair/typebox/value");
|
|
9
|
-
const os_1 = __importDefault(require("os"));
|
|
10
10
|
const envious = (schema) => {
|
|
11
11
|
const parsed = value_1.Value.Parse(schema, process.env);
|
|
12
12
|
const errors = [...value_1.Value.Errors(schema, parsed)];
|
|
13
13
|
if (errors.length) {
|
|
14
14
|
const computedErrorMessages = {};
|
|
15
|
-
|
|
15
|
+
for (const { path, message } of errors) {
|
|
16
16
|
const envVarName = path.replace(/^\//, '');
|
|
17
17
|
if (!computedErrorMessages[envVarName]) {
|
|
18
18
|
computedErrorMessages[envVarName] = [];
|
|
19
19
|
}
|
|
20
20
|
computedErrorMessages[envVarName].push(message);
|
|
21
|
-
}
|
|
21
|
+
}
|
|
22
22
|
const errorTextParts = [
|
|
23
23
|
'Invalid environment variables',
|
|
24
24
|
...Object.entries(computedErrorMessages).map(([varName, messages]) => ` ${varName} : ${messages.join(', ')}`)
|
|
25
25
|
];
|
|
26
|
-
throw new Error(errorTextParts.join(
|
|
26
|
+
throw new Error(errorTextParts.join(node_os_1.default.EOL));
|
|
27
27
|
}
|
|
28
28
|
return value_1.Value.Cast({
|
|
29
29
|
...schema,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"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AAoB,EAAE,KAAK;KAC9B,EACD,MAAM,CACT,CAAC;AACN,CAAC,CAAC;AA3BW,QAAA,OAAO,WA2BlB"}
|
package/package.json
CHANGED
|
@@ -1,47 +1,33 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pitininja/envious",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.1",
|
|
4
4
|
"license": "AGPL-3.0-or-later",
|
|
5
5
|
"homepage": "https://github.com/pitininja/envious",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
8
|
"url": "https://github.com/pitininja/envious"
|
|
9
9
|
},
|
|
10
|
-
"files": [
|
|
11
|
-
"./dist",
|
|
12
|
-
"./LICENSE",
|
|
13
|
-
"./package.json",
|
|
14
|
-
"./README.md"
|
|
15
|
-
],
|
|
10
|
+
"files": ["./dist", "./LICENSE", "./package.json", "./README.md"],
|
|
16
11
|
"main": "./dist/index.js",
|
|
17
12
|
"types": "./dist/index.d.ts",
|
|
18
13
|
"scripts": {
|
|
19
14
|
"prepare": "[ -d '.husky' ] && husky || true",
|
|
20
15
|
"build": "tsc --build --clean tsconfig.build.json && tsc -b ./tsconfig.build.json",
|
|
21
|
-
"
|
|
22
|
-
"lint": "npx
|
|
23
|
-
"format": "npx
|
|
24
|
-
"test": "vitest --run"
|
|
16
|
+
"test": "vitest --run",
|
|
17
|
+
"lint": "npx @biomejs/biome check --error-on-warnings && npx tsc --noEmit",
|
|
18
|
+
"format": "npx @biomejs/biome check --write --error-on-warnings && npx tsc --noEmit"
|
|
25
19
|
},
|
|
26
20
|
"dependencies": {
|
|
27
|
-
"@sinclair/typebox": "^0.33.
|
|
21
|
+
"@sinclair/typebox": "^0.33.12",
|
|
28
22
|
"dotenv": "^16.4.5"
|
|
29
23
|
},
|
|
30
24
|
"devDependencies": {
|
|
25
|
+
"@biomejs/biome": "^1.9.2",
|
|
31
26
|
"@tsconfig/recommended": "^1.0.7",
|
|
32
|
-
"@types/node": "^22.
|
|
33
|
-
"@
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"eslint-config-airbnb-base": "^15.0.0",
|
|
38
|
-
"eslint-config-airbnb-typescript": "^18.0.0",
|
|
39
|
-
"eslint-config-prettier": "^9.1.0",
|
|
40
|
-
"eslint-plugin-import": "^2.29.1",
|
|
41
|
-
"husky": "^9.1.4",
|
|
42
|
-
"prettier": "^3.3.3",
|
|
43
|
-
"tsup": "^8.2.4",
|
|
44
|
-
"typescript": "^5.5.4",
|
|
45
|
-
"vitest": "^2.0.5"
|
|
27
|
+
"@types/node": "^22.5.5",
|
|
28
|
+
"@vitest/coverage-istanbul": "^2.1.1",
|
|
29
|
+
"husky": "^9.1.6",
|
|
30
|
+
"typescript": "^5.6.2",
|
|
31
|
+
"vitest": "^2.1.1"
|
|
46
32
|
}
|
|
47
33
|
}
|