@dsmrt/axiom-config 0.2.2 → 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 +6 -0
- package/dist/index.js +5 -8
- package/dist/index.mjs +3 -7
- package/package.json +15 -15
- package/vitest.config.mts +14 -0
package/CHANGELOG.md
CHANGED
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 {
|
|
@@ -68,7 +68,6 @@ var loadConfig = (input) => {
|
|
|
68
68
|
const baseConfig = importConfigFromPath(baseConfigFile);
|
|
69
69
|
let overrides = input?.overrides || {};
|
|
70
70
|
if (input?.env) {
|
|
71
|
-
console.log("INPUT", input);
|
|
72
71
|
const devConfig = importConfigFromPath(configPath(input));
|
|
73
72
|
overrides = mergeDeep(devConfig, overrides);
|
|
74
73
|
}
|
|
@@ -79,14 +78,12 @@ function isObject(item) {
|
|
|
79
78
|
return item && typeof item === "object" && !Array.isArray(item);
|
|
80
79
|
}
|
|
81
80
|
function mergeDeep(target, ...sources) {
|
|
82
|
-
if (!sources.length)
|
|
83
|
-
return target;
|
|
81
|
+
if (!sources.length) return target;
|
|
84
82
|
const source = sources.shift();
|
|
85
83
|
if (isObject(target) && isObject(source)) {
|
|
86
84
|
for (const key in source) {
|
|
87
85
|
if (isObject(source[key])) {
|
|
88
|
-
if (!target[key])
|
|
89
|
-
Object.assign(target, { [key]: {} });
|
|
86
|
+
if (!target[key]) Object.assign(target, { [key]: {} });
|
|
90
87
|
mergeDeep(target[key], source[key]);
|
|
91
88
|
} else {
|
|
92
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
|
|
|
@@ -47,7 +46,6 @@ var loadConfig = (input) => {
|
|
|
47
46
|
const baseConfig = importConfigFromPath(baseConfigFile);
|
|
48
47
|
let overrides = input?.overrides || {};
|
|
49
48
|
if (input?.env) {
|
|
50
|
-
console.log("INPUT", input);
|
|
51
49
|
const devConfig = importConfigFromPath(configPath(input));
|
|
52
50
|
overrides = mergeDeep(devConfig, overrides);
|
|
53
51
|
}
|
|
@@ -58,14 +56,12 @@ function isObject(item) {
|
|
|
58
56
|
return item && typeof item === "object" && !Array.isArray(item);
|
|
59
57
|
}
|
|
60
58
|
function mergeDeep(target, ...sources) {
|
|
61
|
-
if (!sources.length)
|
|
62
|
-
return target;
|
|
59
|
+
if (!sources.length) return target;
|
|
63
60
|
const source = sources.shift();
|
|
64
61
|
if (isObject(target) && isObject(source)) {
|
|
65
62
|
for (const key in source) {
|
|
66
63
|
if (isObject(source[key])) {
|
|
67
|
-
if (!target[key])
|
|
68
|
-
Object.assign(target, { [key]: {} });
|
|
64
|
+
if (!target[key]) Object.assign(target, { [key]: {} });
|
|
69
65
|
mergeDeep(target[key], source[key]);
|
|
70
66
|
} else {
|
|
71
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
|
+
});
|