@dsmrt/axiom-config 1.2.7 → 1.2.8
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 +37 -14
- package/dist/index.mjs +37 -14
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @dsmrt/axiom-config
|
|
2
2
|
|
|
3
|
+
## 1.2.8
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- e9ce7e2: fix: prod env uses no-suffix config file, falls back to .axiom.prod.\*
|
|
8
|
+
|
|
9
|
+
When the active env equals `prodEnvName` (default `"prod"`), `loadConfig` now
|
|
10
|
+
treats the bare config file (`.axiom.js` / `.axiom.json` / `.axiom.ts`) as the
|
|
11
|
+
complete prod config and no longer also tries to load `.axiom.prod.*` on top of
|
|
12
|
+
it. `.axiom.prod.*` is only consulted as a fallback when no no-suffix file
|
|
13
|
+
exists. `ENV=prod` and `--env prod` no longer throw when only a bare config
|
|
14
|
+
file is present.
|
|
15
|
+
|
|
3
16
|
## 1.2.7
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
package/dist/index.js
CHANGED
|
@@ -112,22 +112,45 @@ var loadConfig = async (input) => {
|
|
|
112
112
|
})
|
|
113
113
|
);
|
|
114
114
|
debug(`Looking for base config file...`);
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
env: void 0
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
debug(`Base config loaded: ${baseConfig.name} (env: ${baseConfig.env})`);
|
|
115
|
+
let baseConfigFile;
|
|
116
|
+
try {
|
|
117
|
+
baseConfigFile = configPath({ ...input, env: void 0 });
|
|
118
|
+
} catch {
|
|
119
|
+
}
|
|
120
|
+
let baseConfig;
|
|
122
121
|
let overrides = input?.overrides || {};
|
|
123
122
|
if (env) {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
123
|
+
const tempBase = baseConfigFile ? await importConfigFromPath(baseConfigFile) : null;
|
|
124
|
+
if (tempBase) {
|
|
125
|
+
debug(`Base config loaded: ${tempBase.name} (env: ${tempBase.env})`);
|
|
126
|
+
}
|
|
127
|
+
const prodEnvName = tempBase?.prodEnvName ?? "prod";
|
|
128
|
+
if (env === prodEnvName) {
|
|
129
|
+
if (tempBase) {
|
|
130
|
+
debug(`Using base config as prod config`);
|
|
131
|
+
baseConfig = tempBase;
|
|
132
|
+
} else {
|
|
133
|
+
const prodConfigFile = configPath({ ...input, env });
|
|
134
|
+
debug(`Loading prod config from: ${prodConfigFile}`);
|
|
135
|
+
baseConfig = await importConfigFromPath(prodConfigFile);
|
|
136
|
+
debug(`Prod config loaded: ${baseConfig.name} (env: ${baseConfig.env})`);
|
|
137
|
+
}
|
|
138
|
+
} else {
|
|
139
|
+
const file = baseConfigFile ?? configPath({ ...input, env: void 0 });
|
|
140
|
+
baseConfig = tempBase ?? await importConfigFromPath(file);
|
|
141
|
+
debug(`Looking for environment-specific config for: ${env}`);
|
|
142
|
+
const envConfigPath = configPath({ ...input, env });
|
|
143
|
+
debug(`Loading env config from: ${envConfigPath}`);
|
|
144
|
+
const envConfig = await importConfigFromPath(envConfigPath);
|
|
145
|
+
debug(`Env config loaded: ${envConfig.name} (env: ${envConfig.env})`);
|
|
146
|
+
overrides = mergeDeep(envConfig, overrides);
|
|
147
|
+
debug(`Merged env config with overrides`);
|
|
148
|
+
}
|
|
149
|
+
} else {
|
|
150
|
+
const file = baseConfigFile ?? configPath({ ...input, env: void 0 });
|
|
151
|
+
debug(`Loading base config from: ${file}`);
|
|
152
|
+
baseConfig = await importConfigFromPath(file);
|
|
153
|
+
debug(`Base config loaded: ${baseConfig.name} (env: ${baseConfig.env})`);
|
|
131
154
|
}
|
|
132
155
|
const configObject = mergeDeep(baseConfig, overrides);
|
|
133
156
|
debug(
|
package/dist/index.mjs
CHANGED
|
@@ -89,22 +89,45 @@ var loadConfig = async (input) => {
|
|
|
89
89
|
})
|
|
90
90
|
);
|
|
91
91
|
debug(`Looking for base config file...`);
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
env: void 0
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
debug(`Base config loaded: ${baseConfig.name} (env: ${baseConfig.env})`);
|
|
92
|
+
let baseConfigFile;
|
|
93
|
+
try {
|
|
94
|
+
baseConfigFile = configPath({ ...input, env: void 0 });
|
|
95
|
+
} catch {
|
|
96
|
+
}
|
|
97
|
+
let baseConfig;
|
|
99
98
|
let overrides = input?.overrides || {};
|
|
100
99
|
if (env) {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
100
|
+
const tempBase = baseConfigFile ? await importConfigFromPath(baseConfigFile) : null;
|
|
101
|
+
if (tempBase) {
|
|
102
|
+
debug(`Base config loaded: ${tempBase.name} (env: ${tempBase.env})`);
|
|
103
|
+
}
|
|
104
|
+
const prodEnvName = tempBase?.prodEnvName ?? "prod";
|
|
105
|
+
if (env === prodEnvName) {
|
|
106
|
+
if (tempBase) {
|
|
107
|
+
debug(`Using base config as prod config`);
|
|
108
|
+
baseConfig = tempBase;
|
|
109
|
+
} else {
|
|
110
|
+
const prodConfigFile = configPath({ ...input, env });
|
|
111
|
+
debug(`Loading prod config from: ${prodConfigFile}`);
|
|
112
|
+
baseConfig = await importConfigFromPath(prodConfigFile);
|
|
113
|
+
debug(`Prod config loaded: ${baseConfig.name} (env: ${baseConfig.env})`);
|
|
114
|
+
}
|
|
115
|
+
} else {
|
|
116
|
+
const file = baseConfigFile ?? configPath({ ...input, env: void 0 });
|
|
117
|
+
baseConfig = tempBase ?? await importConfigFromPath(file);
|
|
118
|
+
debug(`Looking for environment-specific config for: ${env}`);
|
|
119
|
+
const envConfigPath = configPath({ ...input, env });
|
|
120
|
+
debug(`Loading env config from: ${envConfigPath}`);
|
|
121
|
+
const envConfig = await importConfigFromPath(envConfigPath);
|
|
122
|
+
debug(`Env config loaded: ${envConfig.name} (env: ${envConfig.env})`);
|
|
123
|
+
overrides = mergeDeep(envConfig, overrides);
|
|
124
|
+
debug(`Merged env config with overrides`);
|
|
125
|
+
}
|
|
126
|
+
} else {
|
|
127
|
+
const file = baseConfigFile ?? configPath({ ...input, env: void 0 });
|
|
128
|
+
debug(`Loading base config from: ${file}`);
|
|
129
|
+
baseConfig = await importConfigFromPath(file);
|
|
130
|
+
debug(`Base config loaded: ${baseConfig.name} (env: ${baseConfig.env})`);
|
|
108
131
|
}
|
|
109
132
|
const configObject = mergeDeep(baseConfig, overrides);
|
|
110
133
|
debug(
|