@storm-software/config-tools 1.36.1 → 1.37.0
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 +24 -0
- package/declarations.d.ts +1 -1
- package/package.json +1 -1
- package/src/env/get-env.ts +26 -10
- package/src/env/set-env.ts +26 -11
- package/src/utilities/get-default-config.ts +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,27 @@
|
|
|
1
|
+
## 1.37.0 (2024-04-13)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### 🚀 Features
|
|
5
|
+
|
|
6
|
+
- **config:** Add `light` and `dark` colors to configuration ([654cd1d0](https://github.com/storm-software/storm-ops/commit/654cd1d0))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### ❤️ Thank You
|
|
10
|
+
|
|
11
|
+
- Patrick Sullivan
|
|
12
|
+
|
|
13
|
+
## 1.36.2 (2024-04-13)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### 🩹 Fixes
|
|
17
|
+
|
|
18
|
+
- **config:** Update config to use `outputDirectory` value ([42604faf](https://github.com/storm-software/storm-ops/commit/42604faf))
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### ❤️ Thank You
|
|
22
|
+
|
|
23
|
+
- Patrick Sullivan
|
|
24
|
+
|
|
1
25
|
## 1.36.1 (2024-04-13)
|
|
2
26
|
|
|
3
27
|
|
package/declarations.d.ts
CHANGED
|
@@ -55,7 +55,7 @@ export { getConfigFile };
|
|
|
55
55
|
/**
|
|
56
56
|
* Load the config file values for the current Storm workspace into environment variables
|
|
57
57
|
*/
|
|
58
|
-
declare function loadStormConfig(workspaceRoot?: string): Promise<
|
|
58
|
+
declare function loadStormConfig(workspaceRoot?: string): Promise<StormConfig>;
|
|
59
59
|
export { loadStormConfig };
|
|
60
60
|
|
|
61
61
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storm-software/config-tools",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.37.0",
|
|
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,19 +68,22 @@ 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: {
|
|
74
84
|
primary: process.env[`${prefix}COLOR_PRIMARY`],
|
|
75
|
-
|
|
85
|
+
dark: process.env[`${prefix}COLOR_DARK`],
|
|
86
|
+
light: process.env[`${prefix}COLOR_LIGHT`],
|
|
76
87
|
success: process.env[`${prefix}COLOR_SUCCESS`],
|
|
77
88
|
info: process.env[`${prefix}COLOR_INFO`],
|
|
78
89
|
warning: process.env[`${prefix}COLOR_WARNING`],
|
|
@@ -86,10 +97,15 @@ export const getConfigEnv = (): DeepPartial<StormConfig> => {
|
|
|
86
97
|
? JSON.parse(process.env[`${prefix}EXTERNAL_PACKAGE_PATTERNS`] as string)
|
|
87
98
|
: [],
|
|
88
99
|
logLevel:
|
|
89
|
-
process.env[`${prefix}LOG_LEVEL`] !== null &&
|
|
100
|
+
process.env[`${prefix}LOG_LEVEL`] !== null &&
|
|
101
|
+
process.env[`${prefix}LOG_LEVEL`] !== undefined
|
|
90
102
|
? process.env[`${prefix}LOG_LEVEL`] &&
|
|
91
|
-
Number.isSafeInteger(
|
|
92
|
-
|
|
103
|
+
Number.isSafeInteger(
|
|
104
|
+
Number.parseInt(process.env[`${prefix}LOG_LEVEL`] as string)
|
|
105
|
+
)
|
|
106
|
+
? getLogLevelLabel(
|
|
107
|
+
Number.parseInt(process.env[`${prefix}LOG_LEVEL`] as string)
|
|
108
|
+
)
|
|
93
109
|
: (process.env[`${prefix}LOG_LEVEL`] as LogLevelLabel)
|
|
94
110
|
: undefined
|
|
95
111
|
};
|
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;
|
|
@@ -142,8 +153,11 @@ export const setConfigEnv = (config: StormConfig) => {
|
|
|
142
153
|
if (config.colors.primary) {
|
|
143
154
|
process.env[`${prefix}COLOR_PRIMARY`] = config.colors.primary;
|
|
144
155
|
}
|
|
145
|
-
if (config.colors.
|
|
146
|
-
process.env[`${prefix}
|
|
156
|
+
if (config.colors.dark) {
|
|
157
|
+
process.env[`${prefix}COLOR_DARK`] = config.colors.dark;
|
|
158
|
+
}
|
|
159
|
+
if (config.colors.light) {
|
|
160
|
+
process.env[`${prefix}COLOR_LIGHT`] = config.colors.light;
|
|
147
161
|
}
|
|
148
162
|
if (config.colors.success) {
|
|
149
163
|
process.env[`${prefix}COLOR_SUCCESS`] = config.colors.success;
|
|
@@ -180,7 +194,8 @@ export const setConfigEnv = (config: StormConfig) => {
|
|
|
180
194
|
process.env.NX_VERBOSE_LOGGING = String(
|
|
181
195
|
getLogLevel(config.logLevel) >= LogLevel.DEBUG ? true : false
|
|
182
196
|
);
|
|
183
|
-
process.env.RUST_BACKTRACE =
|
|
197
|
+
process.env.RUST_BACKTRACE =
|
|
198
|
+
getLogLevel(config.logLevel) >= LogLevel.DEBUG ? "full" : "none";
|
|
184
199
|
}
|
|
185
200
|
process.env[`${prefix}CONFIG`] = JSON.stringify(config);
|
|
186
201
|
|
|
@@ -12,7 +12,8 @@ import { findWorkspaceRoot } from "./find-workspace-root";
|
|
|
12
12
|
*/
|
|
13
13
|
export const DEFAULT_COLOR_CONFIG: ColorConfig = {
|
|
14
14
|
primary: "#1fb2a6",
|
|
15
|
-
|
|
15
|
+
dark: "#1d232a",
|
|
16
|
+
light: "#f4f4f5",
|
|
16
17
|
success: "#087f5b",
|
|
17
18
|
info: "#0ea5e9",
|
|
18
19
|
warning: "#fcc419",
|