@hardkas/config 0.4.0-alpha → 0.5.1-alpha
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.js +16 -2
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -81,11 +81,25 @@ async function loadConfigFile(filePath, cwd) {
|
|
|
81
81
|
try {
|
|
82
82
|
const jiti = createJiti(import.meta.url);
|
|
83
83
|
const module = await jiti.import(filePath);
|
|
84
|
-
const
|
|
84
|
+
const userConfig = module.default || module.config || module;
|
|
85
|
+
const mergedConfig = {
|
|
86
|
+
...DEFAULT_HARDKAS_CONFIG,
|
|
87
|
+
...userConfig,
|
|
88
|
+
// Merge networks: built-ins + user custom networks
|
|
89
|
+
networks: {
|
|
90
|
+
...DEFAULT_HARDKAS_CONFIG.networks,
|
|
91
|
+
...userConfig.networks && typeof userConfig.networks === "object" ? userConfig.networks : {}
|
|
92
|
+
},
|
|
93
|
+
// Merge accounts: only if user provides an object (not a number)
|
|
94
|
+
accounts: {
|
|
95
|
+
...DEFAULT_HARDKAS_CONFIG.accounts,
|
|
96
|
+
...userConfig.accounts && typeof userConfig.accounts === "object" && !Array.isArray(userConfig.accounts) ? userConfig.accounts : {}
|
|
97
|
+
}
|
|
98
|
+
};
|
|
85
99
|
return {
|
|
86
100
|
path: filePath,
|
|
87
101
|
cwd,
|
|
88
|
-
config
|
|
102
|
+
config: mergedConfig
|
|
89
103
|
};
|
|
90
104
|
} catch (error) {
|
|
91
105
|
throw new Error(`Failed to load HardKAS config at ${filePath}: ${error instanceof Error ? error.message : String(error)}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hardkas/config",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.1-alpha",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
],
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"jiti": "^2.4.2",
|
|
20
|
-
"@hardkas/core": "0.
|
|
20
|
+
"@hardkas/core": "0.5.1-alpha"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"tsup": "^8.3.5",
|