@dsmrt/axiom-config 0.2.1 → 0.2.3
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 +13 -0
- package/dist/index.js +9 -8
- package/dist/index.mjs +7 -7
- package/package.json +15 -15
- package/vitest.config.mts +14 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @dsmrt/axiom-config
|
|
2
2
|
|
|
3
|
+
## 0.2.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- f4c9e19: fix: remove debug and fix testing
|
|
8
|
+
|
|
9
|
+
## 0.2.2
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- f23a8f2: fixing inheretance
|
|
14
|
+
- f23a8f2: fix load config return with custom interfaces
|
|
15
|
+
|
|
3
16
|
## 0.2.1
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
package/dist/index.js
CHANGED
|
@@ -18,8 +18,8 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
|
|
20
20
|
// src/index.ts
|
|
21
|
-
var
|
|
22
|
-
__export(
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
23
|
ConfigContainer: () => ConfigContainer,
|
|
24
24
|
configPath: () => configPath,
|
|
25
25
|
importConfigFromPath: () => importConfigFromPath,
|
|
@@ -27,7 +27,7 @@ __export(src_exports, {
|
|
|
27
27
|
loadConfig: () => loadConfig,
|
|
28
28
|
mergeDeep: () => mergeDeep
|
|
29
29
|
});
|
|
30
|
-
module.exports = __toCommonJS(
|
|
30
|
+
module.exports = __toCommonJS(index_exports);
|
|
31
31
|
var import_fs = require("fs");
|
|
32
32
|
var import_find_up = require("find-up");
|
|
33
33
|
var ConfigContainer = class {
|
|
@@ -61,7 +61,10 @@ var importConfigFromPath = (path) => {
|
|
|
61
61
|
throw new Error(`Path not found: {path}`);
|
|
62
62
|
};
|
|
63
63
|
var loadConfig = (input) => {
|
|
64
|
-
const baseConfigFile = configPath(
|
|
64
|
+
const baseConfigFile = configPath({
|
|
65
|
+
...input,
|
|
66
|
+
env: void 0
|
|
67
|
+
});
|
|
65
68
|
const baseConfig = importConfigFromPath(baseConfigFile);
|
|
66
69
|
let overrides = input?.overrides || {};
|
|
67
70
|
if (input?.env) {
|
|
@@ -75,14 +78,12 @@ function isObject(item) {
|
|
|
75
78
|
return item && typeof item === "object" && !Array.isArray(item);
|
|
76
79
|
}
|
|
77
80
|
function mergeDeep(target, ...sources) {
|
|
78
|
-
if (!sources.length)
|
|
79
|
-
return target;
|
|
81
|
+
if (!sources.length) return target;
|
|
80
82
|
const source = sources.shift();
|
|
81
83
|
if (isObject(target) && isObject(source)) {
|
|
82
84
|
for (const key in source) {
|
|
83
85
|
if (isObject(source[key])) {
|
|
84
|
-
if (!target[key])
|
|
85
|
-
Object.assign(target, { [key]: {} });
|
|
86
|
+
if (!target[key]) Object.assign(target, { [key]: {} });
|
|
86
87
|
mergeDeep(target[key], source[key]);
|
|
87
88
|
} else {
|
|
88
89
|
Object.assign(target, { [key]: source[key] });
|
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
2
2
|
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
3
3
|
}) : x)(function(x) {
|
|
4
|
-
if (typeof require !== "undefined")
|
|
5
|
-
return require.apply(this, arguments);
|
|
4
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
6
5
|
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
7
6
|
});
|
|
8
7
|
|
|
@@ -40,7 +39,10 @@ var importConfigFromPath = (path) => {
|
|
|
40
39
|
throw new Error(`Path not found: {path}`);
|
|
41
40
|
};
|
|
42
41
|
var loadConfig = (input) => {
|
|
43
|
-
const baseConfigFile = configPath(
|
|
42
|
+
const baseConfigFile = configPath({
|
|
43
|
+
...input,
|
|
44
|
+
env: void 0
|
|
45
|
+
});
|
|
44
46
|
const baseConfig = importConfigFromPath(baseConfigFile);
|
|
45
47
|
let overrides = input?.overrides || {};
|
|
46
48
|
if (input?.env) {
|
|
@@ -54,14 +56,12 @@ function isObject(item) {
|
|
|
54
56
|
return item && typeof item === "object" && !Array.isArray(item);
|
|
55
57
|
}
|
|
56
58
|
function mergeDeep(target, ...sources) {
|
|
57
|
-
if (!sources.length)
|
|
58
|
-
return target;
|
|
59
|
+
if (!sources.length) return target;
|
|
59
60
|
const source = sources.shift();
|
|
60
61
|
if (isObject(target) && isObject(source)) {
|
|
61
62
|
for (const key in source) {
|
|
62
63
|
if (isObject(source[key])) {
|
|
63
|
-
if (!target[key])
|
|
64
|
-
Object.assign(target, { [key]: {} });
|
|
64
|
+
if (!target[key]) Object.assign(target, { [key]: {} });
|
|
65
65
|
mergeDeep(target[key], source[key]);
|
|
66
66
|
} else {
|
|
67
67
|
Object.assign(target, { [key]: source[key] });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dsmrt/axiom-config",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"description": "Config library for axiom cli",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -24,18 +24,18 @@
|
|
|
24
24
|
},
|
|
25
25
|
"license": "MIT",
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@changesets/cli": "^2.27.
|
|
28
|
-
"@types/node": "^20.
|
|
29
|
-
"@types/yargs": "^17.0.
|
|
30
|
-
"@typescript-eslint/eslint-plugin": "^6.
|
|
31
|
-
"@typescript-eslint/parser": "^6.
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"vitest": "^1.
|
|
27
|
+
"@changesets/cli": "^2.27.11",
|
|
28
|
+
"@types/node": "^20.17.10",
|
|
29
|
+
"@types/yargs": "^17.0.33",
|
|
30
|
+
"@typescript-eslint/eslint-plugin": "^6.21.0",
|
|
31
|
+
"@typescript-eslint/parser": "^6.21.0",
|
|
32
|
+
"@vitest/coverage-v8": "^1.6.0",
|
|
33
|
+
"eslint": "^8.57.1",
|
|
34
|
+
"prettier": "^3.4.2",
|
|
35
|
+
"ts-node": "^10.9.2",
|
|
36
|
+
"tsup": "^8.3.5",
|
|
37
|
+
"typescript": "^5.7.2",
|
|
38
|
+
"vitest": "^1.6.0"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"find-up": "^5.0.0",
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
"scripts": {
|
|
45
45
|
"lint": "eslint ./src/ --ext .ts",
|
|
46
46
|
"lint:fix": "eslint ./src/ --ext .ts --fix",
|
|
47
|
-
"test": "vitest run --coverage
|
|
48
|
-
"watch": "vitest watch --coverage
|
|
47
|
+
"test": "vitest run --coverage",
|
|
48
|
+
"watch": "vitest watch --coverage",
|
|
49
49
|
"build": "tsup --entry ./src/bin/axiom.ts --entry ./src/index.ts --format cjs,esm --dts --clean",
|
|
50
50
|
"release": "pnpm run build && pnpm changeset publish"
|
|
51
51
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// vitest.config.ts
|
|
2
|
+
import { defineConfig } from "vitest/config";
|
|
3
|
+
|
|
4
|
+
export default defineConfig({
|
|
5
|
+
test: {
|
|
6
|
+
include: ["src/**/*.test.ts"],
|
|
7
|
+
coverage: {
|
|
8
|
+
provider: "v8",
|
|
9
|
+
all: true,
|
|
10
|
+
exclude: ["lib/**/*", "src/__mocks__/**/*"],
|
|
11
|
+
reporter: ["text-summary", "json-summary"],
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
});
|