@storm-software/config-tools 1.176.14 → 1.176.15

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/README.md CHANGED
@@ -21,7 +21,7 @@ This package is part of the <b>⚡Storm-Ops</b> monorepo. The Storm-Ops packages
21
21
 
22
22
  <h3 align="center">💻 Visit <a href="https://stormsoftware.com" target="_blank">stormsoftware.com</a> to stay up to date with this developer</h3><br />
23
23
 
24
- [![Version](https://img.shields.io/badge/version-1.176.12-1fb2a6.svg?style=for-the-badge&color=1fb2a6)](https://prettier.io/)&nbsp;[![Nx](https://img.shields.io/badge/Nx-17.0.2-lightgrey?style=for-the-badge&logo=nx&logoWidth=20&&color=1fb2a6)](http://nx.dev/)&nbsp;[![NextJs](https://img.shields.io/badge/Next.js-14.0.2-lightgrey?style=for-the-badge&logo=nextdotjs&logoWidth=20&color=1fb2a6)](https://nextjs.org/)&nbsp;[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=for-the-badge&logo=commitlint&color=1fb2a6)](http://commitizen.github.io/cz-cli/)&nbsp;![Semantic-Release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=for-the-badge&color=1fb2a6)&nbsp;[![documented with Fumadocs](https://img.shields.io/badge/documented_with-fumadocs-success.svg?style=for-the-badge&logo=readthedocs&color=1fb2a6)](https://fumadocs.vercel.app/)&nbsp;![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/storm-software/storm-ops/cr.yml?style=for-the-badge&logo=github-actions&color=1fb2a6)
24
+ [![Version](https://img.shields.io/badge/version-1.176.13-1fb2a6.svg?style=for-the-badge&color=1fb2a6)](https://prettier.io/)&nbsp;[![Nx](https://img.shields.io/badge/Nx-17.0.2-lightgrey?style=for-the-badge&logo=nx&logoWidth=20&&color=1fb2a6)](http://nx.dev/)&nbsp;[![NextJs](https://img.shields.io/badge/Next.js-14.0.2-lightgrey?style=for-the-badge&logo=nextdotjs&logoWidth=20&color=1fb2a6)](https://nextjs.org/)&nbsp;[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=for-the-badge&logo=commitlint&color=1fb2a6)](http://commitizen.github.io/cz-cli/)&nbsp;![Semantic-Release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=for-the-badge&color=1fb2a6)&nbsp;[![documented with Fumadocs](https://img.shields.io/badge/documented_with-fumadocs-success.svg?style=for-the-badge&logo=readthedocs&color=1fb2a6)](https://fumadocs.vercel.app/)&nbsp;![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/storm-software/storm-ops/cr.yml?style=for-the-badge&logo=github-actions&color=1fb2a6)
25
25
 
26
26
  <!-- prettier-ignore-start -->
27
27
  <!-- markdownlint-disable -->
@@ -40,6 +40,7 @@ This package is part of the <b>⚡Storm-Ops</b> monorepo. The Storm-Ops packages
40
40
 
41
41
  <!-- START doctoc -->
42
42
  <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
43
+
43
44
  ## Table of Contents
44
45
 
45
46
  - [Storm Configuration Tools](#storm-configuration-tools)
@@ -0,0 +1,47 @@
1
+ import {
2
+ writeError
3
+ } from "./chunk-PQFFXKJC.js";
4
+
5
+ // src/utilities/toml.ts
6
+ import TOML from "@ltd/j-toml";
7
+ function parseCargoTomlWithTree(tree, projectRoot, projectName) {
8
+ const cargoTomlString = tree.read(`${projectRoot}/Cargo.toml`)?.toString();
9
+ if (!cargoTomlString) {
10
+ writeError(`Cannot find a Cargo.toml file in the ${projectName}`);
11
+ throw new Error();
12
+ }
13
+ return parseCargoToml(cargoTomlString);
14
+ }
15
+ function parseCargoToml(cargoString) {
16
+ if (!cargoString) {
17
+ throw new Error("Cargo.toml is empty");
18
+ }
19
+ return TOML.parse(cargoString, {
20
+ x: { comment: true }
21
+ });
22
+ }
23
+ function stringifyCargoToml(cargoToml) {
24
+ const tomlString = TOML.stringify(cargoToml, {
25
+ newlineAround: "section"
26
+ });
27
+ if (Array.isArray(tomlString)) {
28
+ return tomlString.join("\n");
29
+ }
30
+ return tomlString;
31
+ }
32
+ function modifyCargoTable(toml, section, key, value) {
33
+ toml[section] ??= TOML.Section({});
34
+ toml[section][key] = typeof value === "object" && !Array.isArray(value) ? TOML.inline(value) : typeof value === "function" ? value() : value;
35
+ }
36
+ function modifyCargoNestedTable(toml, section, key, value) {
37
+ toml[section] ??= {};
38
+ toml[section][key] = TOML.Section(value);
39
+ }
40
+
41
+ export {
42
+ parseCargoTomlWithTree,
43
+ parseCargoToml,
44
+ stringifyCargoToml,
45
+ modifyCargoTable,
46
+ modifyCargoNestedTable
47
+ };
@@ -0,0 +1,131 @@
1
+ import {
2
+ findWorkspaceRoot
3
+ } from "./chunk-6RRYSEZX.js";
4
+ import {
5
+ joinPaths
6
+ } from "./chunk-7IMLZPZF.js";
7
+
8
+ // src/utilities/get-default-config.ts
9
+ import {
10
+ STORM_DEFAULT_ERROR_CODES_FILE,
11
+ STORM_DEFAULT_LICENSE
12
+ } from "@storm-software/config";
13
+ import { existsSync } from "node:fs";
14
+ import { readFile } from "node:fs/promises";
15
+ import { join } from "node:path";
16
+ var DEFAULT_COLOR_CONFIG = {
17
+ light: {
18
+ background: "#fafafa",
19
+ foreground: "#1d1e22",
20
+ brand: "#1fb2a6",
21
+ alternate: "#db2777",
22
+ help: "#5C4EE5",
23
+ success: "#087f5b",
24
+ info: "#0550ae",
25
+ warning: "#e3b341",
26
+ danger: "#D8314A",
27
+ positive: "#22c55e",
28
+ negative: "#dc2626"
29
+ },
30
+ dark: {
31
+ background: "#1d1e22",
32
+ foreground: "#cbd5e1",
33
+ brand: "#2dd4bf",
34
+ alternate: "#db2777",
35
+ help: "#818cf8",
36
+ success: "#10b981",
37
+ info: "#58a6ff",
38
+ warning: "#f3d371",
39
+ danger: "#D8314A",
40
+ positive: "#22c55e",
41
+ negative: "#dc2626"
42
+ }
43
+ };
44
+ async function getPackageJsonConfig(root) {
45
+ let license = STORM_DEFAULT_LICENSE;
46
+ let homepage = void 0;
47
+ let support = void 0;
48
+ let name = void 0;
49
+ let namespace = void 0;
50
+ let repository = void 0;
51
+ const workspaceRoot = findWorkspaceRoot(root);
52
+ if (existsSync(join(workspaceRoot, "package.json"))) {
53
+ const file = await readFile(
54
+ joinPaths(workspaceRoot, "package.json"),
55
+ "utf8"
56
+ );
57
+ if (file) {
58
+ const packageJson = JSON.parse(file);
59
+ if (packageJson.name) {
60
+ name = packageJson.name;
61
+ }
62
+ if (packageJson.namespace) {
63
+ namespace = packageJson.namespace;
64
+ }
65
+ if (packageJson.repository) {
66
+ if (typeof packageJson.repository === "string") {
67
+ repository = packageJson.repository;
68
+ } else if (packageJson.repository.url) {
69
+ repository = packageJson.repository.url;
70
+ }
71
+ }
72
+ if (packageJson.license) {
73
+ license = packageJson.license;
74
+ }
75
+ if (packageJson.homepage) {
76
+ homepage = packageJson.homepage;
77
+ }
78
+ if (packageJson.bugs) {
79
+ if (typeof packageJson.bugs === "string") {
80
+ support = packageJson.bugs;
81
+ } else if (packageJson.bugs.url) {
82
+ support = packageJson.bugs.url;
83
+ }
84
+ }
85
+ }
86
+ }
87
+ return {
88
+ workspaceRoot,
89
+ name,
90
+ namespace,
91
+ repository,
92
+ license,
93
+ homepage,
94
+ support
95
+ };
96
+ }
97
+ function applyDefaultConfig(config) {
98
+ if (!config.support && config.contact) {
99
+ config.support = config.contact;
100
+ }
101
+ if (!config.contact && config.support) {
102
+ config.contact = config.support;
103
+ }
104
+ if (config.homepage) {
105
+ if (!config.docs) {
106
+ config.docs = `${config.homepage}/docs`;
107
+ }
108
+ if (!config.license) {
109
+ config.license = `${config.homepage}/license`;
110
+ }
111
+ if (!config.support) {
112
+ config.support = `${config.homepage}/support`;
113
+ }
114
+ if (!config.contact) {
115
+ config.contact = `${config.homepage}/contact`;
116
+ }
117
+ if (!config.error?.codesFile || !config?.error?.url) {
118
+ config.error ??= { codesFile: STORM_DEFAULT_ERROR_CODES_FILE };
119
+ if (config.homepage) {
120
+ config.error.url ??= `${config.homepage}/errors`;
121
+ }
122
+ }
123
+ }
124
+ return config;
125
+ }
126
+
127
+ export {
128
+ DEFAULT_COLOR_CONFIG,
129
+ getPackageJsonConfig,
130
+ applyDefaultConfig
131
+ };
@@ -0,0 +1,82 @@
1
+ import {
2
+ correctPaths
3
+ } from "./chunk-7IMLZPZF.js";
4
+ import {
5
+ findFolderUp
6
+ } from "./chunk-6JBGUE4A.js";
7
+
8
+ // src/utilities/find-workspace-root.ts
9
+ var rootFiles = [
10
+ "storm-workspace.json",
11
+ "storm-workspace.json",
12
+ "storm-workspace.yaml",
13
+ "storm-workspace.yml",
14
+ "storm-workspace.js",
15
+ "storm-workspace.ts",
16
+ ".storm-workspace.json",
17
+ ".storm-workspace.yaml",
18
+ ".storm-workspace.yml",
19
+ ".storm-workspace.js",
20
+ ".storm-workspace.ts",
21
+ "lerna.json",
22
+ "nx.json",
23
+ "turbo.json",
24
+ "npm-workspace.json",
25
+ "yarn-workspace.json",
26
+ "pnpm-workspace.json",
27
+ "npm-workspace.yaml",
28
+ "yarn-workspace.yaml",
29
+ "pnpm-workspace.yaml",
30
+ "npm-workspace.yml",
31
+ "yarn-workspace.yml",
32
+ "pnpm-workspace.yml",
33
+ "npm-lock.json",
34
+ "yarn-lock.json",
35
+ "pnpm-lock.json",
36
+ "npm-lock.yaml",
37
+ "yarn-lock.yaml",
38
+ "pnpm-lock.yaml",
39
+ "npm-lock.yml",
40
+ "yarn-lock.yml",
41
+ "pnpm-lock.yml",
42
+ "bun.lockb"
43
+ ];
44
+ var rootDirectories = [
45
+ ".storm-workspace",
46
+ ".nx",
47
+ ".github",
48
+ ".vscode",
49
+ ".verdaccio"
50
+ ];
51
+ function findWorkspaceRootSafe(pathInsideMonorepo) {
52
+ if (process.env.STORM_WORKSPACE_ROOT || process.env.NX_WORKSPACE_ROOT_PATH) {
53
+ return correctPaths(
54
+ process.env.STORM_WORKSPACE_ROOT ?? process.env.NX_WORKSPACE_ROOT_PATH
55
+ );
56
+ }
57
+ return correctPaths(
58
+ findFolderUp(
59
+ pathInsideMonorepo ?? process.cwd(),
60
+ rootFiles,
61
+ rootDirectories
62
+ )
63
+ );
64
+ }
65
+ function findWorkspaceRoot(pathInsideMonorepo) {
66
+ const result = findWorkspaceRootSafe(pathInsideMonorepo);
67
+ if (!result) {
68
+ throw new Error(
69
+ `Cannot find workspace root upwards from known path. Files search list includes:
70
+ ${rootFiles.join(
71
+ "\n"
72
+ )}
73
+ Path: ${pathInsideMonorepo ? pathInsideMonorepo : process.cwd()}`
74
+ );
75
+ }
76
+ return result;
77
+ }
78
+
79
+ export {
80
+ findWorkspaceRootSafe,
81
+ findWorkspaceRoot
82
+ };
@@ -0,0 +1,358 @@
1
+ import {
2
+ getLogLevel
3
+ } from "./chunk-K4CDYUQR.js";
4
+ import {
5
+ LogLevel
6
+ } from "./chunk-POXTJ6GF.js";
7
+ import {
8
+ correctPaths
9
+ } from "./chunk-7IMLZPZF.js";
10
+
11
+ // src/env/set-env.ts
12
+ var setExtensionEnv = (extensionName, extension) => {
13
+ for (const key of Object.keys(extension ?? {})) {
14
+ if (extension[key]) {
15
+ const result = key?.replace(
16
+ /([A-Z])+/g,
17
+ (input) => input ? input[0]?.toUpperCase() + input.slice(1) : ""
18
+ ).split(/(?=[A-Z])|[.\-\s_]/).map((x) => x.toLowerCase()) ?? [];
19
+ let extensionKey;
20
+ if (result.length === 0) {
21
+ return;
22
+ }
23
+ if (result.length === 1) {
24
+ extensionKey = result[0]?.toUpperCase() ?? "";
25
+ } else {
26
+ extensionKey = result.reduce((ret, part) => {
27
+ return `${ret}_${part.toLowerCase()}`;
28
+ });
29
+ }
30
+ process.env[`STORM_EXTENSION_${extensionName.toUpperCase()}_${extensionKey.toUpperCase()}`] = extension[key];
31
+ }
32
+ }
33
+ };
34
+ var setConfigEnv = (config) => {
35
+ const prefix = "STORM_";
36
+ if (config.extends) {
37
+ process.env[`${prefix}EXTENDS`] = Array.isArray(config.extends) ? JSON.stringify(config.extends) : config.extends;
38
+ }
39
+ if (config.name) {
40
+ process.env[`${prefix}NAME`] = config.name;
41
+ }
42
+ if (config.namespace) {
43
+ process.env[`${prefix}NAMESPACE`] = config.namespace;
44
+ }
45
+ if (config.owner) {
46
+ process.env[`${prefix}OWNER`] = config.owner;
47
+ }
48
+ if (config.bot) {
49
+ process.env[`${prefix}BOT_NAME`] = config.bot.name;
50
+ process.env[`${prefix}BOT_EMAIL`] = config.bot.email;
51
+ }
52
+ if (config.error) {
53
+ process.env[`${prefix}ERROR_CODES_FILE`] = config.error.codesFile;
54
+ process.env[`${prefix}ERROR_URL`] = config.error.url;
55
+ }
56
+ if (config.release) {
57
+ process.env[`${prefix}RELEASE_BANNER`] = config.release.banner;
58
+ process.env[`${prefix}RELEASE_HEADER`] = config.release.header;
59
+ process.env[`${prefix}RELEASE_FOOTER`] = config.release.footer;
60
+ }
61
+ if (config.socials) {
62
+ if (config.socials.twitter) {
63
+ process.env[`${prefix}SOCIAL_TWITTER`] = config.socials.twitter;
64
+ }
65
+ if (config.socials.discord) {
66
+ process.env[`${prefix}SOCIAL_DISCORD`] = config.socials.discord;
67
+ }
68
+ if (config.socials.telegram) {
69
+ process.env[`${prefix}SOCIAL_TELEGRAM`] = config.socials.telegram;
70
+ }
71
+ if (config.socials.slack) {
72
+ process.env[`${prefix}SOCIAL_SLACK`] = config.socials.slack;
73
+ }
74
+ if (config.socials.medium) {
75
+ process.env[`${prefix}SOCIAL_MEDIUM`] = config.socials.medium;
76
+ }
77
+ if (config.socials.github) {
78
+ process.env[`${prefix}SOCIAL_GITHUB`] = config.socials.github;
79
+ }
80
+ }
81
+ if (config.organization) {
82
+ if (typeof config.organization === "string") {
83
+ process.env[`${prefix}ORG`] = config.organization;
84
+ process.env[`${prefix}ORG_NAME`] = config.organization;
85
+ process.env[`${prefix}ORGANIZATION`] = config.organization;
86
+ process.env[`${prefix}ORGANIZATION_NAME`] = config.organization;
87
+ } else {
88
+ process.env[`${prefix}ORG`] = config.organization.name;
89
+ process.env[`${prefix}ORG_NAME`] = config.organization.name;
90
+ process.env[`${prefix}ORGANIZATION`] = config.organization.name;
91
+ process.env[`${prefix}ORGANIZATION_NAME`] = config.organization.name;
92
+ if (config.organization.url) {
93
+ process.env[`${prefix}ORG_URL`] = config.organization.url;
94
+ process.env[`${prefix}ORGANIZATION_URL`] = config.organization.url;
95
+ }
96
+ if (config.organization.description) {
97
+ process.env[`${prefix}ORG_DESCRIPTION`] = config.organization.description;
98
+ process.env[`${prefix}ORGANIZATION_DESCRIPTION`] = config.organization.description;
99
+ }
100
+ if (config.organization.logo) {
101
+ process.env[`${prefix}ORG_LOGO`] = config.organization.logo;
102
+ process.env[`${prefix}ORGANIZATION_LOGO`] = config.organization.logo;
103
+ }
104
+ if (config.organization.icon) {
105
+ process.env[`${prefix}ORG_ICON`] = config.organization.icon;
106
+ process.env[`${prefix}ORGANIZATION_ICON`] = config.organization.icon;
107
+ }
108
+ }
109
+ }
110
+ if (config.packageManager) {
111
+ process.env[`${prefix}PACKAGE_MANAGER`] = config.packageManager;
112
+ }
113
+ if (config.license) {
114
+ process.env[`${prefix}LICENSE`] = config.license;
115
+ }
116
+ if (config.homepage) {
117
+ process.env[`${prefix}HOMEPAGE`] = config.homepage;
118
+ }
119
+ if (config.docs) {
120
+ process.env[`${prefix}DOCS`] = config.docs;
121
+ }
122
+ if (config.portal) {
123
+ process.env[`${prefix}PORTAL`] = config.portal;
124
+ }
125
+ if (config.licensing) {
126
+ process.env[`${prefix}LICENSING`] = config.licensing;
127
+ }
128
+ if (config.contact) {
129
+ process.env[`${prefix}CONTACT`] = config.contact;
130
+ }
131
+ if (config.support) {
132
+ process.env[`${prefix}SUPPORT`] = config.support;
133
+ }
134
+ if (config.timezone) {
135
+ process.env[`${prefix}TIMEZONE`] = config.timezone;
136
+ process.env.TZ = config.timezone;
137
+ process.env.DEFAULT_TIMEZONE = config.timezone;
138
+ }
139
+ if (config.locale) {
140
+ process.env[`${prefix}LOCALE`] = config.locale;
141
+ process.env.LOCALE = config.locale;
142
+ process.env.DEFAULT_LOCALE = config.locale;
143
+ process.env.LANG = config.locale ? `${config.locale.replaceAll("-", "_")}.UTF-8` : "en_US.UTF-8";
144
+ }
145
+ if (config.configFile) {
146
+ process.env[`${prefix}CONFIG_FILE`] = correctPaths(config.configFile);
147
+ }
148
+ if (config.workspaceRoot) {
149
+ process.env[`${prefix}WORKSPACE_ROOT`] = correctPaths(config.workspaceRoot);
150
+ process.env.NX_WORKSPACE_ROOT = correctPaths(config.workspaceRoot);
151
+ process.env.NX_WORKSPACE_ROOT_PATH = correctPaths(config.workspaceRoot);
152
+ }
153
+ if (config.directories) {
154
+ if (!config.skipCache && config.directories.cache) {
155
+ process.env[`${prefix}CACHE_DIR`] = correctPaths(
156
+ config.directories.cache
157
+ );
158
+ process.env[`${prefix}CACHE_DIRECTORY`] = process.env[`${prefix}CACHE_DIR`];
159
+ }
160
+ if (config.directories.data) {
161
+ process.env[`${prefix}DATA_DIR`] = correctPaths(config.directories.data);
162
+ process.env[`${prefix}DATA_DIRECTORY`] = process.env[`${prefix}DATA_DIR`];
163
+ }
164
+ if (config.directories.config) {
165
+ process.env[`${prefix}CONFIG_DIR`] = correctPaths(
166
+ config.directories.config
167
+ );
168
+ process.env[`${prefix}CONFIG_DIRECTORY`] = process.env[`${prefix}CONFIG_DIR`];
169
+ }
170
+ if (config.directories.temp) {
171
+ process.env[`${prefix}TEMP_DIR`] = correctPaths(config.directories.temp);
172
+ process.env[`${prefix}TEMP_DIRECTORY`] = process.env[`${prefix}TEMP_DIR`];
173
+ }
174
+ if (config.directories.log) {
175
+ process.env[`${prefix}LOG_DIR`] = correctPaths(config.directories.log);
176
+ process.env[`${prefix}LOG_DIRECTORY`] = process.env[`${prefix}LOG_DIR`];
177
+ }
178
+ if (config.directories.build) {
179
+ process.env[`${prefix}BUILD_DIR`] = correctPaths(
180
+ config.directories.build
181
+ );
182
+ process.env[`${prefix}BUILD_DIRECTORY`] = process.env[`${prefix}BUILD_DIR`];
183
+ }
184
+ }
185
+ if (config.skipCache !== void 0) {
186
+ process.env[`${prefix}SKIP_CACHE`] = String(config.skipCache);
187
+ if (config.skipCache) {
188
+ process.env.NX_SKIP_NX_CACHE ??= String(config.skipCache);
189
+ process.env.NX_CACHE_PROJECT_GRAPH ??= String(config.skipCache);
190
+ }
191
+ }
192
+ if (config.mode) {
193
+ process.env[`${prefix}MODE`] = config.mode;
194
+ process.env.NODE_ENV = config.mode;
195
+ process.env.ENVIRONMENT = config.mode;
196
+ }
197
+ if (config.colors?.base?.light || config.colors?.base?.dark) {
198
+ for (const key of Object.keys(config.colors)) {
199
+ setThemeColorConfigEnv(`${prefix}COLOR_${key}_`, config.colors[key]);
200
+ }
201
+ } else {
202
+ setThemeColorConfigEnv(
203
+ `${prefix}COLOR_`,
204
+ config.colors
205
+ );
206
+ }
207
+ if (config.repository) {
208
+ process.env[`${prefix}REPOSITORY`] = config.repository;
209
+ }
210
+ if (config.branch) {
211
+ process.env[`${prefix}BRANCH`] = config.branch;
212
+ }
213
+ if (config.preid) {
214
+ process.env[`${prefix}PRE_ID`] = String(config.preid);
215
+ }
216
+ if (config.registry) {
217
+ if (config.registry.github) {
218
+ process.env[`${prefix}REGISTRY_GITHUB`] = String(config.registry.github);
219
+ }
220
+ if (config.registry.npm) {
221
+ process.env[`${prefix}REGISTRY_NPM`] = String(config.registry.npm);
222
+ }
223
+ if (config.registry.cargo) {
224
+ process.env[`${prefix}REGISTRY_CARGO`] = String(config.registry.cargo);
225
+ }
226
+ if (config.registry.cyclone) {
227
+ process.env[`${prefix}REGISTRY_CYCLONE`] = String(
228
+ config.registry.cyclone
229
+ );
230
+ }
231
+ if (config.registry.container) {
232
+ process.env[`${prefix}REGISTRY_CONTAINER`] = String(
233
+ config.registry.container
234
+ );
235
+ }
236
+ }
237
+ if (config.logLevel) {
238
+ process.env[`${prefix}LOG_LEVEL`] = String(config.logLevel);
239
+ process.env.LOG_LEVEL = String(config.logLevel);
240
+ process.env.NX_VERBOSE_LOGGING = String(
241
+ getLogLevel(config.logLevel) >= LogLevel.DEBUG ? true : false
242
+ );
243
+ process.env.RUST_BACKTRACE = getLogLevel(config.logLevel) >= LogLevel.DEBUG ? "full" : "none";
244
+ }
245
+ if (config.skipConfigLogging !== void 0) {
246
+ process.env[`${prefix}SKIP_CONFIG_LOGGING`] = String(
247
+ config.skipConfigLogging
248
+ );
249
+ }
250
+ process.env[`${prefix}CONFIG`] = JSON.stringify(config);
251
+ for (const key of Object.keys(config.extensions ?? {})) {
252
+ if (config.extensions[key] && Object.keys(config.extensions[key])) {
253
+ setExtensionEnv(key, config.extensions[key]);
254
+ }
255
+ }
256
+ };
257
+ var setThemeColorConfigEnv = (prefix, config) => {
258
+ return config?.light?.brand || config?.dark?.brand ? setMultiThemeColorConfigEnv(prefix, config) : setSingleThemeColorConfigEnv(prefix, config);
259
+ };
260
+ var setSingleThemeColorConfigEnv = (prefix, config) => {
261
+ if (config.dark) {
262
+ process.env[`${prefix}DARK`] = config.dark;
263
+ }
264
+ if (config.light) {
265
+ process.env[`${prefix}LIGHT`] = config.light;
266
+ }
267
+ if (config.brand) {
268
+ process.env[`${prefix}BRAND`] = config.brand;
269
+ }
270
+ if (config.alternate) {
271
+ process.env[`${prefix}ALTERNATE`] = config.alternate;
272
+ }
273
+ if (config.accent) {
274
+ process.env[`${prefix}ACCENT`] = config.accent;
275
+ }
276
+ if (config.link) {
277
+ process.env[`${prefix}LINK`] = config.link;
278
+ }
279
+ if (config.help) {
280
+ process.env[`${prefix}HELP`] = config.help;
281
+ }
282
+ if (config.success) {
283
+ process.env[`${prefix}SUCCESS`] = config.success;
284
+ }
285
+ if (config.info) {
286
+ process.env[`${prefix}INFO`] = config.info;
287
+ }
288
+ if (config.warning) {
289
+ process.env[`${prefix}WARNING`] = config.warning;
290
+ }
291
+ if (config.danger) {
292
+ process.env[`${prefix}DANGER`] = config.danger;
293
+ }
294
+ if (config.fatal) {
295
+ process.env[`${prefix}FATAL`] = config.fatal;
296
+ }
297
+ if (config.positive) {
298
+ process.env[`${prefix}POSITIVE`] = config.positive;
299
+ }
300
+ if (config.negative) {
301
+ process.env[`${prefix}NEGATIVE`] = config.negative;
302
+ }
303
+ };
304
+ var setMultiThemeColorConfigEnv = (prefix, config) => {
305
+ return {
306
+ light: setBaseThemeColorConfigEnv(`${prefix}LIGHT_`, config.light),
307
+ dark: setBaseThemeColorConfigEnv(`${prefix}DARK_`, config.dark)
308
+ };
309
+ };
310
+ var setBaseThemeColorConfigEnv = (prefix, config) => {
311
+ if (config.foreground) {
312
+ process.env[`${prefix}FOREGROUND`] = config.foreground;
313
+ }
314
+ if (config.background) {
315
+ process.env[`${prefix}BACKGROUND`] = config.background;
316
+ }
317
+ if (config.brand) {
318
+ process.env[`${prefix}BRAND`] = config.brand;
319
+ }
320
+ if (config.alternate) {
321
+ process.env[`${prefix}ALTERNATE`] = config.alternate;
322
+ }
323
+ if (config.accent) {
324
+ process.env[`${prefix}ACCENT`] = config.accent;
325
+ }
326
+ if (config.link) {
327
+ process.env[`${prefix}LINK`] = config.link;
328
+ }
329
+ if (config.help) {
330
+ process.env[`${prefix}HELP`] = config.help;
331
+ }
332
+ if (config.success) {
333
+ process.env[`${prefix}SUCCESS`] = config.success;
334
+ }
335
+ if (config.info) {
336
+ process.env[`${prefix}INFO`] = config.info;
337
+ }
338
+ if (config.warning) {
339
+ process.env[`${prefix}WARNING`] = config.warning;
340
+ }
341
+ if (config.danger) {
342
+ process.env[`${prefix}DANGER`] = config.danger;
343
+ }
344
+ if (config.fatal) {
345
+ process.env[`${prefix}FATAL`] = config.fatal;
346
+ }
347
+ if (config.positive) {
348
+ process.env[`${prefix}POSITIVE`] = config.positive;
349
+ }
350
+ if (config.negative) {
351
+ process.env[`${prefix}NEGATIVE`] = config.negative;
352
+ }
353
+ };
354
+
355
+ export {
356
+ setExtensionEnv,
357
+ setConfigEnv
358
+ };