@storm-software/config-tools 1.36.1 → 1.36.2
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 +12 -0
- package/package.json +1 -1
- package/src/env/get-env.ts +24 -9
- package/src/env/set-env.ts +21 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
## 1.36.2 (2024-04-13)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### 🩹 Fixes
|
|
5
|
+
|
|
6
|
+
- **config:** Update config to use `outputDirectory` value ([42604faf](https://github.com/storm-software/storm-ops/commit/42604faf))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### ❤️ Thank You
|
|
10
|
+
|
|
11
|
+
- Patrick Sullivan
|
|
12
|
+
|
|
1
13
|
## 1.36.1 (2024-04-13)
|
|
2
14
|
|
|
3
15
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storm-software/config-tools",
|
|
3
|
-
"version": "1.36.
|
|
3
|
+
"version": "1.36.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "⚡The Storm-Ops monorepo contains utility applications, tools, and various libraries to create modern and scalable web applications.",
|
|
6
6
|
"repository": {
|
package/src/env/get-env.ts
CHANGED
|
@@ -10,17 +10,23 @@ import { correctPaths } from "../utilities/correct-paths";
|
|
|
10
10
|
* @param extensionName - The name of the extension module
|
|
11
11
|
* @returns The config for the specified Storm extension module. If the module does not exist, `undefined` is returned.
|
|
12
12
|
*/
|
|
13
|
-
export const getExtensionEnv = <
|
|
13
|
+
export const getExtensionEnv = <
|
|
14
|
+
TConfig extends Record<string, any> = Record<string, any>
|
|
15
|
+
>(
|
|
14
16
|
extensionName: string
|
|
15
17
|
): TConfig | undefined => {
|
|
16
18
|
const prefix = `STORM_EXTENSION_${extensionName.toUpperCase()}_`;
|
|
17
19
|
return Object.keys(process.env)
|
|
18
|
-
.filter(
|
|
20
|
+
.filter(key => key.startsWith(prefix))
|
|
19
21
|
.reduce((ret: Record<string, any>, key: string) => {
|
|
20
22
|
const name = key
|
|
21
23
|
.replace(prefix, "")
|
|
22
24
|
.split("_")
|
|
23
|
-
.map(
|
|
25
|
+
.map(i =>
|
|
26
|
+
i.length > 0
|
|
27
|
+
? i.trim().charAt(0).toUpperCase() + i.trim().slice(1)
|
|
28
|
+
: ""
|
|
29
|
+
)
|
|
24
30
|
.join("");
|
|
25
31
|
if (name) {
|
|
26
32
|
ret[name] = process.env[key];
|
|
@@ -45,7 +51,9 @@ export const getConfigEnv = (): DeepPartial<StormConfig> => {
|
|
|
45
51
|
owner: process.env[`${prefix}OWNER`],
|
|
46
52
|
worker: process.env[`${prefix}WORKER`],
|
|
47
53
|
organization: process.env[`${prefix}ORGANIZATION`],
|
|
48
|
-
packageManager: process.env[
|
|
54
|
+
packageManager: process.env[
|
|
55
|
+
`${prefix}PACKAGE_MANAGER`
|
|
56
|
+
] as StormConfig["packageManager"],
|
|
49
57
|
license: process.env[`${prefix}LICENSE`],
|
|
50
58
|
homepage: process.env[`${prefix}HOMEPAGE`],
|
|
51
59
|
timezone: process.env[`${prefix}TIMEZONE`] ?? process.env.TZ,
|
|
@@ -60,14 +68,16 @@ export const getConfigEnv = (): DeepPartial<StormConfig> => {
|
|
|
60
68
|
: undefined,
|
|
61
69
|
cacheDirectory: correctPaths(process.env[`${prefix}CACHE_DIRECTORY`]),
|
|
62
70
|
runtimeVersion: process.env[`${prefix}RUNTIME_VERSION`],
|
|
63
|
-
|
|
71
|
+
outputDirectory: correctPaths(process.env[`${prefix}OUTPUT_DIRECTORY`]),
|
|
64
72
|
env: (process.env[`${prefix}ENV`] ??
|
|
65
73
|
process.env.NODE_ENV ??
|
|
66
74
|
process.env.ENVIRONMENT) as StormConfig["env"],
|
|
67
75
|
ci:
|
|
68
76
|
process.env[`${prefix}CI`] !== undefined
|
|
69
77
|
? Boolean(
|
|
70
|
-
process.env[`${prefix}CI`] ??
|
|
78
|
+
process.env[`${prefix}CI`] ??
|
|
79
|
+
process.env.CI ??
|
|
80
|
+
process.env.CONTINUOUS_INTEGRATION
|
|
71
81
|
)
|
|
72
82
|
: undefined,
|
|
73
83
|
colors: {
|
|
@@ -86,10 +96,15 @@ export const getConfigEnv = (): DeepPartial<StormConfig> => {
|
|
|
86
96
|
? JSON.parse(process.env[`${prefix}EXTERNAL_PACKAGE_PATTERNS`] as string)
|
|
87
97
|
: [],
|
|
88
98
|
logLevel:
|
|
89
|
-
process.env[`${prefix}LOG_LEVEL`] !== null &&
|
|
99
|
+
process.env[`${prefix}LOG_LEVEL`] !== null &&
|
|
100
|
+
process.env[`${prefix}LOG_LEVEL`] !== undefined
|
|
90
101
|
? process.env[`${prefix}LOG_LEVEL`] &&
|
|
91
|
-
Number.isSafeInteger(
|
|
92
|
-
|
|
102
|
+
Number.isSafeInteger(
|
|
103
|
+
Number.parseInt(process.env[`${prefix}LOG_LEVEL`] as string)
|
|
104
|
+
)
|
|
105
|
+
? getLogLevelLabel(
|
|
106
|
+
Number.parseInt(process.env[`${prefix}LOG_LEVEL`] as string)
|
|
107
|
+
)
|
|
93
108
|
: (process.env[`${prefix}LOG_LEVEL`] as LogLevelLabel)
|
|
94
109
|
: undefined
|
|
95
110
|
};
|
package/src/env/set-env.ts
CHANGED
|
@@ -9,7 +9,9 @@ import { correctPaths } from "../utilities/correct-paths";
|
|
|
9
9
|
* @param extensionName - The name of the extension module
|
|
10
10
|
* @returns The config for the specified Storm extension module. If the module does not exist, `undefined` is returned.
|
|
11
11
|
*/
|
|
12
|
-
export const setExtensionEnv = <
|
|
12
|
+
export const setExtensionEnv = <
|
|
13
|
+
TConfig extends Record<string, any> = Record<string, any>
|
|
14
|
+
>(
|
|
13
15
|
extensionName: string,
|
|
14
16
|
extension: TConfig
|
|
15
17
|
) => {
|
|
@@ -35,8 +37,9 @@ export const setExtensionEnv = <TConfig extends Record<string, any> = Record<str
|
|
|
35
37
|
});
|
|
36
38
|
}
|
|
37
39
|
|
|
38
|
-
process.env[
|
|
39
|
-
|
|
40
|
+
process.env[
|
|
41
|
+
`STORM_EXTENSION_${extensionName.toUpperCase()}_${extensionKey.toUpperCase()}`
|
|
42
|
+
] = extension[key];
|
|
40
43
|
}
|
|
41
44
|
}
|
|
42
45
|
};
|
|
@@ -98,10 +101,14 @@ export const setConfigEnv = (config: StormConfig) => {
|
|
|
98
101
|
process.env.NX_WORKSPACE_ROOT_PATH = correctPaths(config.workspaceRoot);
|
|
99
102
|
}
|
|
100
103
|
if (config.packageDirectory) {
|
|
101
|
-
process.env[`${prefix}PACKAGE_DIRECTORY`] = correctPaths(
|
|
104
|
+
process.env[`${prefix}PACKAGE_DIRECTORY`] = correctPaths(
|
|
105
|
+
config.packageDirectory
|
|
106
|
+
);
|
|
102
107
|
}
|
|
103
108
|
if (config.buildDirectory) {
|
|
104
|
-
process.env[`${prefix}BUILD_DIRECTORY`] = correctPaths(
|
|
109
|
+
process.env[`${prefix}BUILD_DIRECTORY`] = correctPaths(
|
|
110
|
+
config.buildDirectory
|
|
111
|
+
);
|
|
105
112
|
}
|
|
106
113
|
if (config.skipCache !== undefined) {
|
|
107
114
|
process.env[`${prefix}SKIP_CACHE`] = String(config.skipCache);
|
|
@@ -111,7 +118,9 @@ export const setConfigEnv = (config: StormConfig) => {
|
|
|
111
118
|
}
|
|
112
119
|
}
|
|
113
120
|
if (!config.skipCache && config.cacheDirectory) {
|
|
114
|
-
process.env[`${prefix}CACHE_DIRECTORY`] = correctPaths(
|
|
121
|
+
process.env[`${prefix}CACHE_DIRECTORY`] = correctPaths(
|
|
122
|
+
config.cacheDirectory
|
|
123
|
+
);
|
|
115
124
|
// if (config.cacheDirectory.includes("/storm") || config.cacheDirectory.includes("\\storm")) {
|
|
116
125
|
// const nxCacheDirectory = join(
|
|
117
126
|
// config.cacheDirectory.includes("/storm")
|
|
@@ -126,8 +135,10 @@ export const setConfigEnv = (config: StormConfig) => {
|
|
|
126
135
|
if (config.runtimeVersion) {
|
|
127
136
|
process.env[`${prefix}RUNTIME_VERSION`] = config.runtimeVersion;
|
|
128
137
|
}
|
|
129
|
-
if (config.
|
|
130
|
-
process.env[`${prefix}
|
|
138
|
+
if (config.outputDirectory) {
|
|
139
|
+
process.env[`${prefix}OUTPUT_DIRECTORY`] = correctPaths(
|
|
140
|
+
config.outputDirectory
|
|
141
|
+
);
|
|
131
142
|
}
|
|
132
143
|
if (config.env) {
|
|
133
144
|
process.env[`${prefix}ENV`] = config.env;
|
|
@@ -180,7 +191,8 @@ export const setConfigEnv = (config: StormConfig) => {
|
|
|
180
191
|
process.env.NX_VERBOSE_LOGGING = String(
|
|
181
192
|
getLogLevel(config.logLevel) >= LogLevel.DEBUG ? true : false
|
|
182
193
|
);
|
|
183
|
-
process.env.RUST_BACKTRACE =
|
|
194
|
+
process.env.RUST_BACKTRACE =
|
|
195
|
+
getLogLevel(config.logLevel) >= LogLevel.DEBUG ? "full" : "none";
|
|
184
196
|
}
|
|
185
197
|
process.env[`${prefix}CONFIG`] = JSON.stringify(config);
|
|
186
198
|
|