@dsmrt/axiom-config 1.2.1 → 1.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 +19 -0
- package/dist/index.js +5 -4
- package/dist/index.mjs +7 -6
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @dsmrt/axiom-config
|
|
2
2
|
|
|
3
|
+
## 1.2.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 31ae74a: fix(ci): move --provenance into changeset-publish script to avoid pnpm arg-passthrough bug
|
|
8
|
+
|
|
9
|
+
## 1.2.2
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 5549ab3: fix: upgrade release CI to Node 22 with frozen lockfile
|
|
14
|
+
- 6ac6d26: fix: support `ENV` environment variable for selecting config
|
|
15
|
+
|
|
16
|
+
`ENV=dev axiom params get` now loads `.axiom.dev.js` (equivalent to `--env dev`).
|
|
17
|
+
|
|
18
|
+
**`@dsmrt/axiom-config`**: `loadConfig` falls back to `process.env.ENV` when no `env` is passed, so library consumers also benefit.
|
|
19
|
+
|
|
20
|
+
**`@dsmrt/axiom-cli`**: middleware maps `ENV` → `argv.env` at parse time so all subcommands see the resolved value. Priority order: `--env` flag > `AXIOM_ENV` > `ENV`.
|
|
21
|
+
|
|
3
22
|
## 1.2.1
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
package/dist/index.js
CHANGED
|
@@ -102,10 +102,11 @@ var loadConfigByEnv = async (env, options) => {
|
|
|
102
102
|
return await loadConfig({ env, ...options });
|
|
103
103
|
};
|
|
104
104
|
var loadConfig = async (input) => {
|
|
105
|
+
const env = input?.env || process.env.ENV;
|
|
105
106
|
debug(
|
|
106
107
|
`Loading config with options:`,
|
|
107
108
|
JSON.stringify({
|
|
108
|
-
env
|
|
109
|
+
env,
|
|
109
110
|
cwd: input?.cwd,
|
|
110
111
|
hasOverrides: !!input?.overrides
|
|
111
112
|
})
|
|
@@ -119,9 +120,9 @@ var loadConfig = async (input) => {
|
|
|
119
120
|
const baseConfig = await importConfigFromPath(baseConfigFile);
|
|
120
121
|
debug(`Base config loaded: ${baseConfig.name} (env: ${baseConfig.env})`);
|
|
121
122
|
let overrides = input?.overrides || {};
|
|
122
|
-
if (
|
|
123
|
-
debug(`Looking for environment-specific config for: ${
|
|
124
|
-
const envConfigPath = configPath(input);
|
|
123
|
+
if (env) {
|
|
124
|
+
debug(`Looking for environment-specific config for: ${env}`);
|
|
125
|
+
const envConfigPath = configPath({ ...input, env });
|
|
125
126
|
debug(`Loading env config from: ${envConfigPath}`);
|
|
126
127
|
const devConfig = await importConfigFromPath(envConfigPath);
|
|
127
128
|
debug(`Env config loaded: ${devConfig.name} (env: ${devConfig.env})`);
|
package/dist/index.mjs
CHANGED
|
@@ -6,7 +6,7 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
|
|
|
6
6
|
});
|
|
7
7
|
|
|
8
8
|
// src/index.ts
|
|
9
|
-
import { readFileSync } from "fs";
|
|
9
|
+
import { readFileSync } from "node:fs";
|
|
10
10
|
import { globSync } from "glob";
|
|
11
11
|
var isDebugEnabled = () => process.env.AXIOM_DEBUG === "true" || process.env.AXIOM_DEBUG === "1";
|
|
12
12
|
var debug = (message, ...args) => {
|
|
@@ -79,10 +79,11 @@ var loadConfigByEnv = async (env, options) => {
|
|
|
79
79
|
return await loadConfig({ env, ...options });
|
|
80
80
|
};
|
|
81
81
|
var loadConfig = async (input) => {
|
|
82
|
+
const env = input?.env || process.env.ENV;
|
|
82
83
|
debug(
|
|
83
84
|
`Loading config with options:`,
|
|
84
85
|
JSON.stringify({
|
|
85
|
-
env
|
|
86
|
+
env,
|
|
86
87
|
cwd: input?.cwd,
|
|
87
88
|
hasOverrides: !!input?.overrides
|
|
88
89
|
})
|
|
@@ -96,9 +97,9 @@ var loadConfig = async (input) => {
|
|
|
96
97
|
const baseConfig = await importConfigFromPath(baseConfigFile);
|
|
97
98
|
debug(`Base config loaded: ${baseConfig.name} (env: ${baseConfig.env})`);
|
|
98
99
|
let overrides = input?.overrides || {};
|
|
99
|
-
if (
|
|
100
|
-
debug(`Looking for environment-specific config for: ${
|
|
101
|
-
const envConfigPath = configPath(input);
|
|
100
|
+
if (env) {
|
|
101
|
+
debug(`Looking for environment-specific config for: ${env}`);
|
|
102
|
+
const envConfigPath = configPath({ ...input, env });
|
|
102
103
|
debug(`Loading env config from: ${envConfigPath}`);
|
|
103
104
|
const devConfig = await importConfigFromPath(envConfigPath);
|
|
104
105
|
debug(`Env config loaded: ${devConfig.name} (env: ${devConfig.env})`);
|
|
@@ -150,7 +151,7 @@ var configPath = (input) => {
|
|
|
150
151
|
found = matches[0];
|
|
151
152
|
break;
|
|
152
153
|
}
|
|
153
|
-
const parent = __require("path").dirname(currentDir);
|
|
154
|
+
const parent = __require("node:path").dirname(currentDir);
|
|
154
155
|
if (parent === currentDir) {
|
|
155
156
|
break;
|
|
156
157
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dsmrt/axiom-config",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.3",
|
|
4
4
|
"description": "Config library for axiom cli",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"ts-node": "^10.9.2",
|
|
33
33
|
"tsup": "^8.3.5",
|
|
34
34
|
"typescript": "^5.7.2",
|
|
35
|
-
"vitest": "^4.
|
|
35
|
+
"vitest": "^4.1.0"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"glob": "^10.5.0",
|