@dsmrt/axiom-config 1.2.6 → 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 CHANGED
@@ -1,5 +1,25 @@
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
+
16
+ ## 1.2.7
17
+
18
+ ### Patch Changes
19
+
20
+ - fc17744: chore: upgrade to Node 24 and add mise config for local dev
21
+ - fc17744: chore: test npm Trusted Publishers OIDC publish on Node 24
22
+
3
23
  ## 1.2.6
4
24
 
5
25
  ### 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
- const baseConfigFile = configPath({
116
- ...input,
117
- env: void 0
118
- });
119
- debug(`Loading base config from: ${baseConfigFile}`);
120
- const baseConfig = await importConfigFromPath(baseConfigFile);
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
- debug(`Looking for environment-specific config for: ${env}`);
125
- const envConfigPath = configPath({ ...input, env });
126
- debug(`Loading env config from: ${envConfigPath}`);
127
- const devConfig = await importConfigFromPath(envConfigPath);
128
- debug(`Env config loaded: ${devConfig.name} (env: ${devConfig.env})`);
129
- overrides = mergeDeep(devConfig, overrides);
130
- debug(`Merged env config with overrides`);
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
- const baseConfigFile = configPath({
93
- ...input,
94
- env: void 0
95
- });
96
- debug(`Loading base config from: ${baseConfigFile}`);
97
- const baseConfig = await importConfigFromPath(baseConfigFile);
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
- debug(`Looking for environment-specific config for: ${env}`);
102
- const envConfigPath = configPath({ ...input, env });
103
- debug(`Loading env config from: ${envConfigPath}`);
104
- const devConfig = await importConfigFromPath(envConfigPath);
105
- debug(`Env config loaded: ${devConfig.name} (env: ${devConfig.env})`);
106
- overrides = mergeDeep(devConfig, overrides);
107
- debug(`Merged env config with overrides`);
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(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dsmrt/axiom-config",
3
- "version": "1.2.6",
3
+ "version": "1.2.8",
4
4
  "description": "Config library for axiom cli",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",