@storm-software/config-tools 1.190.119 → 1.190.121

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.
Files changed (211) hide show
  1. package/README.md +1 -1
  2. package/bin/config.cjs +1213 -1558
  3. package/bin/config.mjs +1271 -0
  4. package/dist/_virtual/_rolldown/runtime.cjs +23 -0
  5. package/dist/config-file/get-config-file.cjs +67 -28
  6. package/dist/config-file/get-config-file.d.cts +5 -5
  7. package/dist/config-file/{get-config-file.d.ts → get-config-file.d.mts} +7 -5
  8. package/dist/config-file/get-config-file.mjs +66 -0
  9. package/dist/config-file/index.cjs +4 -29
  10. package/dist/config-file/index.d.cts +2 -3
  11. package/dist/config-file/index.d.mts +4 -0
  12. package/dist/config-file/index.mjs +5 -0
  13. package/dist/create-storm-config.cjs +115 -34
  14. package/dist/create-storm-config.d.cts +5 -5
  15. package/dist/{create-storm-config.d.ts → create-storm-config.d.mts} +7 -5
  16. package/dist/create-storm-config.mjs +113 -0
  17. package/dist/env/get-env.cjs +202 -11
  18. package/dist/env/get-env.d.cts +5 -5
  19. package/dist/env/{get-env.d.ts → get-env.d.mts} +7 -5
  20. package/dist/env/get-env.mjs +203 -0
  21. package/dist/env/index.cjs +7 -18
  22. package/dist/env/index.d.cts +3 -4
  23. package/dist/env/index.d.mts +5 -0
  24. package/dist/env/index.mjs +6 -0
  25. package/dist/env/set-env.cjs +230 -11
  26. package/dist/env/set-env.d.cts +8 -8
  27. package/dist/env/{set-env.d.ts → set-env.d.mts} +10 -8
  28. package/dist/env/set-env.mjs +231 -0
  29. package/dist/get-config.cjs +46 -34
  30. package/dist/get-config.d.cts +18 -18
  31. package/dist/{get-config.d.ts → get-config.d.mts} +20 -18
  32. package/dist/get-config.mjs +46 -0
  33. package/dist/index.cjs +98 -201
  34. package/dist/index.d.cts +27 -28
  35. package/dist/index.d.mts +29 -0
  36. package/dist/index.mjs +26 -0
  37. package/dist/logger/chalk.cjs +43 -6
  38. package/dist/logger/chalk.d.cts +18 -17
  39. package/dist/logger/chalk.d.mts +37 -0
  40. package/dist/logger/chalk.mjs +43 -0
  41. package/dist/logger/console-icons.cjs +18 -8
  42. package/dist/logger/console-icons.d.cts +5 -8
  43. package/dist/logger/console-icons.d.mts +7 -0
  44. package/dist/logger/console-icons.mjs +20 -0
  45. package/dist/logger/console.cjs +195 -37
  46. package/dist/logger/console.d.cts +25 -25
  47. package/dist/logger/{console.d.ts → console.d.mts} +27 -25
  48. package/dist/logger/console.mjs +185 -0
  49. package/dist/logger/create-logger.cjs +34 -14
  50. package/dist/logger/create-logger.d.cts +5 -6
  51. package/dist/logger/{create-logger.d.ts → create-logger.d.mts} +7 -6
  52. package/dist/logger/create-logger.mjs +34 -0
  53. package/dist/logger/format-timestamp.cjs +14 -6
  54. package/dist/logger/format-timestamp.d.cts +3 -2
  55. package/dist/logger/{format-timestamp.d.ts → format-timestamp.d.mts} +5 -2
  56. package/dist/logger/format-timestamp.mjs +16 -0
  57. package/dist/logger/get-log-level.cjs +54 -11
  58. package/dist/logger/get-log-level.d.cts +4 -5
  59. package/dist/logger/{get-log-level.d.ts → get-log-level.d.mts} +6 -5
  60. package/dist/logger/get-log-level.mjs +54 -0
  61. package/dist/logger/index.cjs +29 -61
  62. package/dist/logger/index.d.cts +8 -10
  63. package/dist/logger/index.d.mts +10 -0
  64. package/dist/logger/index.mjs +11 -0
  65. package/dist/logger/is-unicode-supported.cjs +8 -6
  66. package/dist/logger/is-unicode-supported.d.cts +3 -2
  67. package/dist/logger/is-unicode-supported.d.mts +6 -0
  68. package/dist/logger/is-unicode-supported.mjs +10 -0
  69. package/dist/types.cjs +29 -8
  70. package/dist/types.d.cts +39 -41
  71. package/dist/types.d.mts +53 -0
  72. package/dist/types.mjs +30 -0
  73. package/dist/utilities/apply-workspace-tokens.cjs +37 -13
  74. package/dist/utilities/apply-workspace-tokens.d.cts +4 -5
  75. package/dist/utilities/{apply-workspace-tokens.d.ts → apply-workspace-tokens.d.mts} +6 -5
  76. package/dist/utilities/apply-workspace-tokens.mjs +37 -0
  77. package/dist/utilities/colors.cjs +98 -12
  78. package/dist/utilities/colors.d.cts +4 -4
  79. package/dist/utilities/{colors.d.ts → colors.d.mts} +6 -4
  80. package/dist/utilities/colors.mjs +97 -0
  81. package/dist/utilities/correct-paths.cjs +201 -32
  82. package/dist/utilities/correct-paths.d.cts +4 -4
  83. package/dist/utilities/{correct-paths.d.ts → correct-paths.d.mts} +6 -4
  84. package/dist/utilities/correct-paths.mjs +190 -0
  85. package/dist/utilities/file-path-utils.cjs +48 -11
  86. package/dist/utilities/file-path-utils.d.cts +15 -14
  87. package/dist/utilities/{file-path-utils.d.ts → file-path-utils.d.mts} +17 -14
  88. package/dist/utilities/file-path-utils.mjs +48 -0
  89. package/dist/utilities/find-up.cjs +17 -6
  90. package/dist/utilities/find-up.d.cts +3 -2
  91. package/dist/utilities/{find-up.d.ts → find-up.d.mts} +5 -2
  92. package/dist/utilities/find-up.mjs +19 -0
  93. package/dist/utilities/find-workspace-root.cjs +72 -10
  94. package/dist/utilities/find-workspace-root.d.cts +3 -2
  95. package/dist/utilities/{find-workspace-root.d.ts → find-workspace-root.d.mts} +5 -2
  96. package/dist/utilities/find-workspace-root.mjs +73 -0
  97. package/dist/utilities/get-default-config.cjs +73 -11
  98. package/dist/utilities/get-default-config.d.cts +4 -4
  99. package/dist/utilities/{get-default-config.d.ts → get-default-config.d.mts} +6 -4
  100. package/dist/utilities/get-default-config.mjs +74 -0
  101. package/dist/utilities/index.cjs +49 -109
  102. package/dist/utilities/index.d.cts +10 -14
  103. package/dist/utilities/index.d.mts +12 -0
  104. package/dist/utilities/index.mjs +13 -0
  105. package/dist/utilities/process-handler.cjs +38 -18
  106. package/dist/utilities/process-handler.d.cts +4 -4
  107. package/dist/utilities/process-handler.d.mts +9 -0
  108. package/dist/utilities/process-handler.mjs +38 -0
  109. package/dist/utilities/run.cjs +64 -10
  110. package/dist/utilities/run.d.cts +5 -6
  111. package/dist/utilities/{run.d.ts → run.d.mts} +7 -6
  112. package/dist/utilities/run.mjs +64 -0
  113. package/dist/utilities/toml.cjs +37 -24
  114. package/dist/utilities/toml.d.cts +148 -147
  115. package/dist/utilities/toml.d.mts +192 -0
  116. package/dist/utilities/toml.mjs +33 -0
  117. package/package.json +106 -158
  118. package/bin/config.js +0 -1616
  119. package/dist/chunk-24B36RDB.cjs +0 -81
  120. package/dist/chunk-27N3QEX5.js +0 -40
  121. package/dist/chunk-2AVLCXLT.js +0 -0
  122. package/dist/chunk-2RLMTBVZ.js +0 -233
  123. package/dist/chunk-2WBD2G3E.cjs +0 -38
  124. package/dist/chunk-3COHMHPU.cjs +0 -1
  125. package/dist/chunk-4Q45WJYQ.js +0 -165
  126. package/dist/chunk-5C7PIENF.js +0 -92
  127. package/dist/chunk-5J2SS4QU.js +0 -83
  128. package/dist/chunk-65SWKEHV.cjs +0 -1
  129. package/dist/chunk-6Y623TCS.cjs +0 -40
  130. package/dist/chunk-7PV6L7I7.cjs +0 -1
  131. package/dist/chunk-7QBTVNMR.cjs +0 -30
  132. package/dist/chunk-BDATZ3UB.cjs +0 -233
  133. package/dist/chunk-BZRTSWH4.cjs +0 -395
  134. package/dist/chunk-D3FRXXDE.js +0 -947
  135. package/dist/chunk-DTGT4OI3.cjs +0 -14
  136. package/dist/chunk-EC2KPWRG.cjs +0 -24
  137. package/dist/chunk-EENQN6N2.js +0 -40
  138. package/dist/chunk-ENI4UUSK.cjs +0 -35
  139. package/dist/chunk-FJNXECWU.js +0 -395
  140. package/dist/chunk-FMDVBSP6.cjs +0 -83
  141. package/dist/chunk-G2MK47WL.js +0 -14
  142. package/dist/chunk-HFS7WJVW.js +0 -81
  143. package/dist/chunk-HVVJHTFS.js +0 -36
  144. package/dist/chunk-IWD6YQKX.cjs +0 -1
  145. package/dist/chunk-IWQRXQ4N.cjs +0 -84
  146. package/dist/chunk-JK4TT5IV.js +0 -35
  147. package/dist/chunk-JWLDCEBZ.cjs +0 -70
  148. package/dist/chunk-JZAYHDV3.js +0 -8
  149. package/dist/chunk-KSMN3HSC.js +0 -38
  150. package/dist/chunk-L6UNTUC4.js +0 -0
  151. package/dist/chunk-LOY6ICHZ.cjs +0 -36
  152. package/dist/chunk-MBG2FTBL.cjs +0 -47
  153. package/dist/chunk-MQG74XF7.js +0 -102
  154. package/dist/chunk-MSAQEGBK.cjs +0 -92
  155. package/dist/chunk-NJFLUTGH.cjs +0 -25
  156. package/dist/chunk-PCYB64MB.cjs +0 -40
  157. package/dist/chunk-RALMUN5C.js +0 -30
  158. package/dist/chunk-RRKB32OH.js +0 -0
  159. package/dist/chunk-RUKM6FCF.js +0 -25
  160. package/dist/chunk-SIW7AXUG.js +0 -56
  161. package/dist/chunk-SLICWTO2.cjs +0 -165
  162. package/dist/chunk-SO3FWVXC.js +0 -84
  163. package/dist/chunk-SXPH7ILL.js +0 -70
  164. package/dist/chunk-T7YISGRS.cjs +0 -102
  165. package/dist/chunk-TZZRLM5J.cjs +0 -947
  166. package/dist/chunk-UJ77IBHD.cjs +0 -233
  167. package/dist/chunk-UKGRDKIH.js +0 -0
  168. package/dist/chunk-V3GMJ4TX.js +0 -233
  169. package/dist/chunk-WQJYIPSL.cjs +0 -8
  170. package/dist/chunk-YBVOKYAM.cjs +0 -56
  171. package/dist/chunk-YX4736HU.js +0 -47
  172. package/dist/chunk-ZFNAUMQS.js +0 -24
  173. package/dist/config-file/get-config-file.js +0 -28
  174. package/dist/config-file/index.d.ts +0 -3
  175. package/dist/config-file/index.js +0 -29
  176. package/dist/create-storm-config.js +0 -35
  177. package/dist/env/get-env.js +0 -11
  178. package/dist/env/index.d.ts +0 -4
  179. package/dist/env/index.js +0 -18
  180. package/dist/env/set-env.js +0 -11
  181. package/dist/get-config.js +0 -34
  182. package/dist/index.d.ts +0 -28
  183. package/dist/index.js +0 -201
  184. package/dist/logger/chalk.d.ts +0 -34
  185. package/dist/logger/chalk.js +0 -6
  186. package/dist/logger/console-icons.d.ts +0 -8
  187. package/dist/logger/console-icons.js +0 -8
  188. package/dist/logger/console.js +0 -37
  189. package/dist/logger/create-logger.js +0 -14
  190. package/dist/logger/format-timestamp.js +0 -6
  191. package/dist/logger/get-log-level.js +0 -11
  192. package/dist/logger/index.d.ts +0 -10
  193. package/dist/logger/index.js +0 -61
  194. package/dist/logger/is-unicode-supported.d.ts +0 -3
  195. package/dist/logger/is-unicode-supported.js +0 -6
  196. package/dist/types.d.ts +0 -53
  197. package/dist/types.js +0 -8
  198. package/dist/utilities/apply-workspace-tokens.js +0 -13
  199. package/dist/utilities/colors.js +0 -12
  200. package/dist/utilities/correct-paths.js +0 -32
  201. package/dist/utilities/file-path-utils.js +0 -11
  202. package/dist/utilities/find-up.js +0 -6
  203. package/dist/utilities/find-workspace-root.js +0 -10
  204. package/dist/utilities/get-default-config.js +0 -11
  205. package/dist/utilities/index.d.ts +0 -14
  206. package/dist/utilities/index.js +0 -109
  207. package/dist/utilities/process-handler.d.ts +0 -7
  208. package/dist/utilities/process-handler.js +0 -18
  209. package/dist/utilities/run.js +0 -10
  210. package/dist/utilities/toml.d.ts +0 -189
  211. package/dist/utilities/toml.js +0 -24
package/bin/config.cjs CHANGED
@@ -1,1642 +1,1297 @@
1
1
  #!/usr/bin/env node
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ //#region \0rolldown/runtime.js
2
4
  var __create = Object.create;
3
5
  var __defProp = Object.defineProperty;
4
6
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
7
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
8
  var __getProtoOf = Object.getPrototypeOf;
7
9
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
10
  var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
11
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
12
+ key = keys[i];
13
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
14
+ get: ((k) => from[k]).bind(null, key),
15
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
+ });
17
+ }
18
+ return to;
19
19
  };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
-
30
- // bin/config.ts
31
- var config_exports = {};
32
- __export(config_exports, {
33
- createProgram: () => createProgram,
34
- viewAction: () => viewAction
35
- });
36
- module.exports = __toCommonJS(config_exports);
37
- var import_chalk3 = __toESM(require("chalk"), 1);
38
- var import_commander = require("commander");
39
-
40
- // src/create-storm-config.ts
41
- var import_schema = require("@storm-software/config/schema");
42
- var import_defu2 = __toESM(require("defu"), 1);
43
- var import_node_fs3 = require("fs");
44
-
45
- // src/config-file/get-config-file.ts
46
- var import_c12 = require("c12");
47
- var import_defu = __toESM(require("defu"), 1);
48
-
49
- // src/types.ts
50
- var LogLevel = {
51
- SILENT: 0,
52
- FATAL: 10,
53
- ERROR: 20,
54
- WARN: 30,
55
- SUCCESS: 35,
56
- INFO: 40,
57
- PERFORMANCE: 50,
58
- DEBUG: 60,
59
- TRACE: 70,
60
- ALL: 100
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
21
+ value: mod,
22
+ enumerable: true
23
+ }) : target, mod));
24
+ //#endregion
25
+ let chalk = require("chalk");
26
+ chalk = __toESM(chalk, 1);
27
+ let commander = require("commander");
28
+ let _storm_software_config_schema = require("@storm-software/config/schema");
29
+ let defu = require("defu");
30
+ defu = __toESM(defu, 1);
31
+ let node_fs = require("node:fs");
32
+ let c12 = require("c12");
33
+ require("date-fns/formatDistanceToNow");
34
+ let node_path = require("node:path");
35
+ let _storm_software_config = require("@storm-software/config");
36
+ let node_fs_promises = require("node:fs/promises");
37
+ //#region src/types.ts
38
+ const LogLevel = {
39
+ SILENT: 0,
40
+ FATAL: 10,
41
+ ERROR: 20,
42
+ WARN: 30,
43
+ SUCCESS: 35,
44
+ INFO: 40,
45
+ PERFORMANCE: 50,
46
+ DEBUG: 60,
47
+ TRACE: 70,
48
+ ALL: 100
61
49
  };
62
- var LogLevelLabel = {
63
- SILENT: "silent",
64
- FATAL: "fatal",
65
- ERROR: "error",
66
- WARN: "warn",
67
- SUCCESS: "success",
68
- INFO: "info",
69
- PERFORMANCE: "performance",
70
- DEBUG: "debug",
71
- TRACE: "trace",
72
- ALL: "all"
50
+ const LogLevelLabel = {
51
+ SILENT: "silent",
52
+ FATAL: "fatal",
53
+ ERROR: "error",
54
+ WARN: "warn",
55
+ SUCCESS: "success",
56
+ INFO: "info",
57
+ PERFORMANCE: "performance",
58
+ DEBUG: "debug",
59
+ TRACE: "trace",
60
+ ALL: "all"
73
61
  };
74
-
75
- // src/utilities/colors.ts
76
- var DEFAULT_COLOR_CONFIG = {
77
- light: {
78
- background: "#fafafa",
79
- foreground: "#1d1e22",
80
- brand: "#1fb2a6",
81
- alternate: "#db2777",
82
- discovery: "#5C4EE5",
83
- success: "#087f5b",
84
- info: "#0550ae",
85
- debug: "#8afafc",
86
- warning: "#e3b341",
87
- danger: "#D8314A",
88
- fatal: "#51070f",
89
- performance: "#13c302",
90
- link: "#3fa6ff",
91
- positive: "#22c55e",
92
- negative: "#dc2626",
93
- gradient: ["#1fb2a6", "#db2777", "#5C4EE5"]
94
- },
95
- dark: {
96
- background: "#1e2124",
97
- foreground: "#cbd5e1",
98
- brand: "#2dd4bf",
99
- alternate: "#db2777",
100
- discovery: "#818cf8",
101
- success: "#10b981",
102
- info: "#58a6ff",
103
- debug: "#8afafc",
104
- warning: "#f3d371",
105
- danger: "#D8314A",
106
- fatal: "#a40e26",
107
- performance: "#80fd74",
108
- link: "#3fa6ff",
109
- positive: "#22c55e",
110
- negative: "#dc2626",
111
- gradient: ["#1fb2a6", "#db2777", "#818cf8"]
112
- }
62
+ //#endregion
63
+ //#region src/utilities/colors.ts
64
+ /**
65
+ * Storm theme config values used for styling various workspace elements
66
+ */
67
+ const DEFAULT_COLOR_CONFIG = {
68
+ light: {
69
+ background: "#fafafa",
70
+ foreground: "#1d1e22",
71
+ brand: "#1fb2a6",
72
+ alternate: "#db2777",
73
+ discovery: "#5C4EE5",
74
+ success: "#087f5b",
75
+ info: "#0550ae",
76
+ debug: "#8afafc",
77
+ warning: "#e3b341",
78
+ danger: "#D8314A",
79
+ fatal: "#51070f",
80
+ performance: "#13c302",
81
+ link: "#3fa6ff",
82
+ positive: "#22c55e",
83
+ negative: "#dc2626",
84
+ gradient: [
85
+ "#1fb2a6",
86
+ "#db2777",
87
+ "#5C4EE5"
88
+ ]
89
+ },
90
+ dark: {
91
+ background: "#1e2124",
92
+ foreground: "#cbd5e1",
93
+ brand: "#2dd4bf",
94
+ alternate: "#db2777",
95
+ discovery: "#818cf8",
96
+ success: "#10b981",
97
+ info: "#58a6ff",
98
+ debug: "#8afafc",
99
+ warning: "#f3d371",
100
+ danger: "#D8314A",
101
+ fatal: "#a40e26",
102
+ performance: "#80fd74",
103
+ link: "#3fa6ff",
104
+ positive: "#22c55e",
105
+ negative: "#dc2626",
106
+ gradient: [
107
+ "#1fb2a6",
108
+ "#db2777",
109
+ "#818cf8"
110
+ ]
111
+ }
113
112
  };
113
+ /**
114
+ * Get the color configuration from the Storm workspace configuration.
115
+ *
116
+ * @param config - An optional, partial color configuration for the Storm workspace.
117
+ * @returns The color configuration, or the default color configuration if not defined.
118
+ */
114
119
  function getColors(config) {
115
- if (!config?.colors || typeof config.colors !== "object" || !config.colors["dark"] && (!config.colors["base"] || typeof config.colors !== "object" || !config.colors["base"]?.["dark"])) {
116
- return DEFAULT_COLOR_CONFIG;
117
- }
118
- if (config.colors["base"]) {
119
- if (typeof config.colors["base"]["dark"] === "object") {
120
- return config.colors["base"]["dark"];
121
- } else if (config.colors["base"]["dark"] === "string") {
122
- return config.colors["base"];
123
- }
124
- }
125
- if (typeof config.colors["dark"] === "object") {
126
- return config.colors["dark"];
127
- }
128
- return config.colors ?? DEFAULT_COLOR_CONFIG;
120
+ if (!config?.colors || typeof config.colors !== "object" || !config.colors["dark"] && (!config.colors["base"] || typeof config.colors !== "object" || !config.colors["base"]?.["dark"])) return DEFAULT_COLOR_CONFIG;
121
+ if (config.colors["base"]) {
122
+ if (typeof config.colors["base"]["dark"] === "object") return config.colors["base"]["dark"];
123
+ else if (config.colors["base"]["dark"] === "string") return config.colors["base"];
124
+ }
125
+ if (typeof config.colors["dark"] === "object") return config.colors["dark"];
126
+ return config.colors ?? DEFAULT_COLOR_CONFIG;
129
127
  }
128
+ /**
129
+ * Get a specific color from the Storm workspace configuration.
130
+ *
131
+ * @param key - The key of the color to retrieve.
132
+ * @param config - An optional, partial color configuration for the Storm workspace.
133
+ * @returns The color value for the specified key, or a default value if not defined.
134
+ */
130
135
  function getColor(key, config) {
131
- const colors = getColors(config);
132
- const result = (typeof colors["dark"] === "object" ? colors["dark"][key] : colors[key]) || DEFAULT_COLOR_CONFIG["dark"][key] || DEFAULT_COLOR_CONFIG[key];
133
- if (result) {
134
- return result;
135
- }
136
- if (key === "link" || key === "debug") {
137
- return getColor("info", config);
138
- } else if (key === "fatal") {
139
- return getColor("danger", config);
140
- }
141
- return getColor("brand", config);
136
+ const colors = getColors(config);
137
+ const result = (typeof colors["dark"] === "object" ? colors["dark"][key] : colors[key]) || DEFAULT_COLOR_CONFIG["dark"][key] || DEFAULT_COLOR_CONFIG[key];
138
+ if (result) return result;
139
+ if (key === "link" || key === "debug") return getColor("info", config);
140
+ else if (key === "fatal") return getColor("danger", config);
141
+ return getColor("brand", config);
142
142
  }
143
-
144
- // src/logger/chalk.ts
145
- var import_chalk = __toESM(require("chalk"), 1);
146
- var chalkDefault = {
147
- hex: (_) => (message) => message,
148
- bgHex: (_) => ({
149
- whiteBright: (message) => message,
150
- white: (message) => message
151
- }),
152
- white: (message) => message,
153
- whiteBright: (message) => message,
154
- gray: (message) => message,
155
- bold: {
156
- hex: (_) => (message) => message,
157
- bgHex: (_) => ({
158
- whiteBright: (message) => message,
159
- white: (message) => message
160
- }),
161
- whiteBright: (message) => message,
162
- white: (message) => message
163
- },
164
- dim: {
165
- hex: (_) => (message) => message,
166
- gray: (message) => message
167
- }
143
+ //#endregion
144
+ //#region src/logger/chalk.ts
145
+ const chalkDefault = {
146
+ hex: (_) => (message) => message,
147
+ bgHex: (_) => ({
148
+ whiteBright: (message) => message,
149
+ white: (message) => message
150
+ }),
151
+ white: (message) => message,
152
+ whiteBright: (message) => message,
153
+ gray: (message) => message,
154
+ bold: {
155
+ hex: (_) => (message) => message,
156
+ bgHex: (_) => ({
157
+ whiteBright: (message) => message,
158
+ white: (message) => message
159
+ }),
160
+ whiteBright: (message) => message,
161
+ white: (message) => message
162
+ },
163
+ dim: {
164
+ hex: (_) => (message) => message,
165
+ gray: (message) => message
166
+ }
168
167
  };
169
- var getChalk = () => {
170
- let _chalk = import_chalk.default;
171
- if (!_chalk?.hex || !_chalk?.bold?.hex || !_chalk?.bgHex || !_chalk?.whiteBright || !_chalk?.white) {
172
- _chalk = chalkDefault;
173
- }
174
- return _chalk;
168
+ /**
169
+ * Get the chalk instance
170
+ *
171
+ * @remarks
172
+ * Annoying polyfill to temporarily fix the issue with the `chalk` import
173
+ *
174
+ * @returns The chalk instance
175
+ */
176
+ const getChalk = () => {
177
+ let _chalk = chalk.default;
178
+ if (!_chalk?.hex || !_chalk?.bold?.hex || !_chalk?.bgHex || !_chalk?.whiteBright || !_chalk?.white) _chalk = chalkDefault;
179
+ return _chalk;
175
180
  };
176
-
177
- // src/logger/is-unicode-supported.ts
181
+ //#endregion
182
+ //#region src/logger/is-unicode-supported.ts
178
183
  function isUnicodeSupported() {
179
- if (process.platform !== "win32") {
180
- return process.env.TERM !== "linux";
181
- }
182
- return Boolean(process.env.WT_SESSION) || // Windows Terminal
183
- Boolean(process.env.TERMINUS_SUBLIME) || // Terminus (<0.2.27)
184
- process.env.ConEmuTask === "{cmd::Cmder}" || // ConEmu and cmder
185
- process.env.TERM_PROGRAM === "Terminus-Sublime" || process.env.TERM_PROGRAM === "vscode" || process.env.TERM === "xterm-256color" || process.env.TERM === "alacritty" || process.env.TERM === "rxvt-unicode" || process.env.TERM === "rxvt-unicode-256color" || process.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
184
+ if (process.platform !== "win32") return process.env.TERM !== "linux";
185
+ return Boolean(process.env.WT_SESSION) || Boolean(process.env.TERMINUS_SUBLIME) || process.env.ConEmuTask === "{cmd::Cmder}" || process.env.TERM_PROGRAM === "Terminus-Sublime" || process.env.TERM_PROGRAM === "vscode" || process.env.TERM === "xterm-256color" || process.env.TERM === "alacritty" || process.env.TERM === "rxvt-unicode" || process.env.TERM === "rxvt-unicode-256color" || process.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
186
186
  }
187
-
188
- // src/logger/console-icons.ts
189
- var useIcon = (c, fallback) => isUnicodeSupported() ? c : fallback;
190
- var CONSOLE_ICONS = {
191
- [LogLevelLabel.ERROR]: useIcon("\u2718", "\xD7"),
192
- [LogLevelLabel.FATAL]: useIcon("\u{1F571}", "\xD7"),
193
- [LogLevelLabel.WARN]: useIcon("\u26A0", "\u203C"),
194
- [LogLevelLabel.INFO]: useIcon("\u2139", "i"),
195
- [LogLevelLabel.PERFORMANCE]: useIcon("\u23F1", "\u23F1"),
196
- [LogLevelLabel.SUCCESS]: useIcon("\u2714", "\u221A"),
197
- [LogLevelLabel.DEBUG]: useIcon("\u{1F6E0}", "D"),
198
- [LogLevelLabel.TRACE]: useIcon("\u2699", "T"),
199
- [LogLevelLabel.ALL]: useIcon("\u2709", "\u2192")
187
+ //#endregion
188
+ //#region src/logger/console-icons.ts
189
+ const useIcon = (c, fallback) => isUnicodeSupported() ? c : fallback;
190
+ const CONSOLE_ICONS = {
191
+ [LogLevelLabel.ERROR]: useIcon("✘", "×"),
192
+ [LogLevelLabel.FATAL]: useIcon("🕱", "×"),
193
+ [LogLevelLabel.WARN]: useIcon("⚠", "‼"),
194
+ [LogLevelLabel.INFO]: useIcon("ℹ", "i"),
195
+ [LogLevelLabel.PERFORMANCE]: useIcon("⏱", "⏱"),
196
+ [LogLevelLabel.SUCCESS]: useIcon("✔", "√"),
197
+ [LogLevelLabel.DEBUG]: useIcon("🛠", "D"),
198
+ [LogLevelLabel.TRACE]: useIcon("⚙", "T"),
199
+ [LogLevelLabel.ALL]: useIcon("✉", "→")
200
200
  };
201
-
202
- // src/logger/format-timestamp.ts
203
- var formatTimestamp = (fullDateTime = false, date = /* @__PURE__ */ new Date()) => {
204
- return fullDateTime ? `${date.toLocaleDateString()} ${date.toLocaleTimeString()}` : `${date.toLocaleTimeString()}`;
201
+ //#endregion
202
+ //#region src/logger/format-timestamp.ts
203
+ /**
204
+ * Format a timestamp to a human-readable string.
205
+ *
206
+ * @param fullDateTime Whether to include the full date and time in the formatted string (defaults to `false`, which only includes the time)
207
+ * @param date The date to format.
208
+ * @returns The formatted timestamp.
209
+ */
210
+ const formatTimestamp = (fullDateTime = false, date = /* @__PURE__ */ new Date()) => {
211
+ return fullDateTime ? `${date.toLocaleDateString()} ${date.toLocaleTimeString()}` : `${date.toLocaleTimeString()}`;
205
212
  };
206
-
207
- // src/logger/get-log-level.ts
208
- var getLogLevel = (label) => {
209
- switch (label) {
210
- case "all":
211
- return LogLevel.ALL;
212
- case "trace":
213
- return LogLevel.TRACE;
214
- case "debug":
215
- return LogLevel.DEBUG;
216
- case "performance":
217
- return LogLevel.PERFORMANCE;
218
- case "info":
219
- return LogLevel.INFO;
220
- case "warn":
221
- return LogLevel.WARN;
222
- case "error":
223
- return LogLevel.ERROR;
224
- case "fatal":
225
- return LogLevel.FATAL;
226
- case "silent":
227
- return LogLevel.SILENT;
228
- default:
229
- return LogLevel.INFO;
230
- }
213
+ //#endregion
214
+ //#region src/logger/get-log-level.ts
215
+ /**
216
+ * Convert the log level label to a log level
217
+ *
218
+ * @param label - The log level label to convert
219
+ * @returns The log level
220
+ */
221
+ const getLogLevel = (label) => {
222
+ switch (label) {
223
+ case "all": return LogLevel.ALL;
224
+ case "trace": return LogLevel.TRACE;
225
+ case "debug": return LogLevel.DEBUG;
226
+ case "performance": return LogLevel.PERFORMANCE;
227
+ case "info": return LogLevel.INFO;
228
+ case "warn": return LogLevel.WARN;
229
+ case "error": return LogLevel.ERROR;
230
+ case "fatal": return LogLevel.FATAL;
231
+ case "silent": return LogLevel.SILENT;
232
+ default: return LogLevel.INFO;
233
+ }
231
234
  };
232
- var getLogLevelLabel = (logLevel = LogLevel.INFO) => {
233
- if (logLevel >= LogLevel.ALL) {
234
- return LogLevelLabel.ALL;
235
- }
236
- if (logLevel >= LogLevel.TRACE) {
237
- return LogLevelLabel.TRACE;
238
- }
239
- if (logLevel >= LogLevel.DEBUG) {
240
- return LogLevelLabel.DEBUG;
241
- }
242
- if (logLevel >= LogLevel.PERFORMANCE) {
243
- return LogLevelLabel.PERFORMANCE;
244
- }
245
- if (logLevel >= LogLevel.INFO) {
246
- return LogLevelLabel.INFO;
247
- }
248
- if (logLevel >= LogLevel.WARN) {
249
- return LogLevelLabel.WARN;
250
- }
251
- if (logLevel >= LogLevel.ERROR) {
252
- return LogLevelLabel.ERROR;
253
- }
254
- if (logLevel >= LogLevel.FATAL) {
255
- return LogLevelLabel.FATAL;
256
- }
257
- if (logLevel <= LogLevel.SILENT) {
258
- return LogLevelLabel.SILENT;
259
- }
260
- return LogLevelLabel.INFO;
235
+ /**
236
+ * Convert the log level to a log level label
237
+ *
238
+ * @param logLevel - The log level to convert
239
+ * @returns The log level label
240
+ */
241
+ const getLogLevelLabel = (logLevel = LogLevel.INFO) => {
242
+ if (logLevel >= LogLevel.ALL) return LogLevelLabel.ALL;
243
+ if (logLevel >= LogLevel.TRACE) return LogLevelLabel.TRACE;
244
+ if (logLevel >= LogLevel.DEBUG) return LogLevelLabel.DEBUG;
245
+ if (logLevel >= LogLevel.PERFORMANCE) return LogLevelLabel.PERFORMANCE;
246
+ if (logLevel >= LogLevel.INFO) return LogLevelLabel.INFO;
247
+ if (logLevel >= LogLevel.WARN) return LogLevelLabel.WARN;
248
+ if (logLevel >= LogLevel.ERROR) return LogLevelLabel.ERROR;
249
+ if (logLevel >= LogLevel.FATAL) return LogLevelLabel.FATAL;
250
+ if (logLevel <= LogLevel.SILENT) return LogLevelLabel.SILENT;
251
+ return LogLevelLabel.INFO;
261
252
  };
262
-
263
- // src/logger/console.ts
264
- var getLogFn = (logLevel = LogLevel.INFO, config = {}, options = {}) => {
265
- const {
266
- chalk: _chalk = getChalk(),
267
- fullDateTime = false,
268
- hideDateTime = false
269
- } = options;
270
- const colors = !config.colors?.dark && !config.colors?.["base"] && !config.colors?.["base"]?.dark ? DEFAULT_COLOR_CONFIG : config.colors?.dark && typeof config.colors.dark === "string" ? config.colors : config.colors?.["base"]?.dark && typeof config.colors["base"].dark === "string" ? config.colors["base"].dark : config.colors?.["base"] ? config.colors?.["base"] : DEFAULT_COLOR_CONFIG;
271
- const configLogLevel = config.logLevel || process.env.STORM_LOG_LEVEL || LogLevelLabel.INFO;
272
- if (logLevel > getLogLevel(configLogLevel) || logLevel <= LogLevel.SILENT || getLogLevel(configLogLevel) <= LogLevel.SILENT) {
273
- return (_) => {
274
- };
275
- }
276
- if (typeof logLevel === "number" && LogLevel.FATAL >= logLevel) {
277
- return (message) => {
278
- console.error(
279
- `
280
- ${hideDateTime ? "" : `${_chalk.gray(formatTimestamp(fullDateTime))} `}${_chalk.hex(colors.fatal ?? DEFAULT_COLOR_CONFIG.dark.fatal)(
281
- `[${CONSOLE_ICONS[LogLevelLabel.FATAL]} Fatal] `
282
- )}${_chalk.bold.whiteBright(formatLogMessage(message))}
283
- `
284
- );
285
- };
286
- }
287
- if (typeof logLevel === "number" && LogLevel.ERROR >= logLevel) {
288
- return (message) => {
289
- console.error(
290
- `
291
- ${hideDateTime ? "" : `${_chalk.gray(formatTimestamp(fullDateTime))} `}${_chalk.hex(colors.danger ?? DEFAULT_COLOR_CONFIG.dark.danger)(
292
- `[${CONSOLE_ICONS[LogLevelLabel.ERROR]} Error] `
293
- )}${_chalk.bold.whiteBright(formatLogMessage(message))}
294
- `
295
- );
296
- };
297
- }
298
- if (typeof logLevel === "number" && LogLevel.WARN >= logLevel) {
299
- return (message) => {
300
- console.warn(
301
- `
302
- ${hideDateTime ? "" : `${_chalk.gray(formatTimestamp(fullDateTime))} `}${_chalk.hex(colors.warning ?? DEFAULT_COLOR_CONFIG.dark.warning)(
303
- `[${CONSOLE_ICONS[LogLevelLabel.WARN]} Warn] `
304
- )}${_chalk.bold.whiteBright(formatLogMessage(message))}
305
- `
306
- );
307
- };
308
- }
309
- if (typeof logLevel === "number" && LogLevel.SUCCESS >= logLevel) {
310
- return (message) => {
311
- console.info(
312
- `
313
- ${hideDateTime ? "" : `${_chalk.gray(formatTimestamp(fullDateTime))} `}${_chalk.hex(colors.success ?? DEFAULT_COLOR_CONFIG.dark.success)(
314
- `[${CONSOLE_ICONS[LogLevelLabel.SUCCESS]} Success] `
315
- )}${_chalk.bold.whiteBright(formatLogMessage(message))}
316
- `
317
- );
318
- };
319
- }
320
- if (typeof logLevel === "number" && LogLevel.INFO >= logLevel) {
321
- return (message) => {
322
- console.info(
323
- `
324
- ${hideDateTime ? "" : `${_chalk.gray(formatTimestamp(fullDateTime))} `}${_chalk.hex(colors.info ?? DEFAULT_COLOR_CONFIG.dark.info)(
325
- `[${CONSOLE_ICONS[LogLevelLabel.INFO]} Info] `
326
- )}${_chalk.bold.whiteBright(formatLogMessage(message))}
327
- `
328
- );
329
- };
330
- }
331
- if (typeof logLevel === "number" && LogLevel.PERFORMANCE >= logLevel) {
332
- return (message) => {
333
- console.debug(
334
- `
335
- ${hideDateTime ? "" : `${_chalk.gray(formatTimestamp(fullDateTime))} `}${_chalk.hex(colors.performance ?? DEFAULT_COLOR_CONFIG.dark.performance)(
336
- `[${CONSOLE_ICONS[LogLevelLabel.PERFORMANCE]} Performance] `
337
- )}${_chalk.bold.whiteBright(formatLogMessage(message))}
338
- `
339
- );
340
- };
341
- }
342
- if (typeof logLevel === "number" && LogLevel.DEBUG >= logLevel) {
343
- return (message) => {
344
- console.debug(
345
- `
346
- ${hideDateTime ? "" : `${_chalk.gray(formatTimestamp(fullDateTime))} `}${_chalk.hex(colors.debug ?? DEFAULT_COLOR_CONFIG.dark.debug)(
347
- `[${CONSOLE_ICONS[LogLevelLabel.DEBUG]} Debug] `
348
- )}${_chalk.bold.whiteBright(formatLogMessage(message))}
349
- `
350
- );
351
- };
352
- }
353
- if (typeof logLevel === "number" && LogLevel.TRACE >= logLevel) {
354
- return (message) => {
355
- console.debug(
356
- `
357
- ${hideDateTime ? "" : `${_chalk.gray(formatTimestamp(fullDateTime))} `}${_chalk.hex("#bbbbbb")(
358
- `[${CONSOLE_ICONS[LogLevelLabel.TRACE]} Trace] `
359
- )}${_chalk.bold.whiteBright(formatLogMessage(message))}
360
- `
361
- );
362
- };
363
- }
364
- return (message) => {
365
- console.log(
366
- `
367
- ${hideDateTime ? "" : `${_chalk.gray(formatTimestamp(fullDateTime))} `}${_chalk.hex(colors.brand ?? DEFAULT_COLOR_CONFIG.dark.brand)(
368
- `[${CONSOLE_ICONS[LogLevelLabel.ALL]} System] `
369
- )}${_chalk.bold.whiteBright(formatLogMessage(message))}
370
- `
371
- );
372
- };
253
+ //#endregion
254
+ //#region src/logger/console.ts
255
+ /**
256
+ * Get the log function for a log level
257
+ *
258
+ * @param logLevel - The log level
259
+ * @param config - The Storm configuration
260
+ * @returns The log function
261
+ */
262
+ const getLogFn = (logLevel = LogLevel.INFO, config = {}, options = {}) => {
263
+ const { chalk: _chalk = getChalk(), fullDateTime = false, hideDateTime = false } = options;
264
+ const colors = !config.colors?.dark && !config.colors?.["base"] && !config.colors?.["base"]?.dark ? DEFAULT_COLOR_CONFIG : config.colors?.dark && typeof config.colors.dark === "string" ? config.colors : config.colors?.["base"]?.dark && typeof config.colors["base"].dark === "string" ? config.colors["base"].dark : config.colors?.["base"] ? config.colors?.["base"] : DEFAULT_COLOR_CONFIG;
265
+ const configLogLevel = config.logLevel || process.env.STORM_LOG_LEVEL || LogLevelLabel.INFO;
266
+ if (logLevel > getLogLevel(configLogLevel) || logLevel <= LogLevel.SILENT || getLogLevel(configLogLevel) <= LogLevel.SILENT) return (_) => {};
267
+ if (typeof logLevel === "number" && LogLevel.FATAL >= logLevel) return (message) => {
268
+ console.error(`
269
+ ${hideDateTime ? "" : `${_chalk.gray(formatTimestamp(fullDateTime))} `}${_chalk.hex(colors.fatal ?? DEFAULT_COLOR_CONFIG.dark.fatal)(`[${CONSOLE_ICONS[LogLevelLabel.FATAL]} Fatal] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
270
+ `);
271
+ };
272
+ if (typeof logLevel === "number" && LogLevel.ERROR >= logLevel) return (message) => {
273
+ console.error(`
274
+ ${hideDateTime ? "" : `${_chalk.gray(formatTimestamp(fullDateTime))} `}${_chalk.hex(colors.danger ?? DEFAULT_COLOR_CONFIG.dark.danger)(`[${CONSOLE_ICONS[LogLevelLabel.ERROR]} Error] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
275
+ `);
276
+ };
277
+ if (typeof logLevel === "number" && LogLevel.WARN >= logLevel) return (message) => {
278
+ console.warn(`
279
+ ${hideDateTime ? "" : `${_chalk.gray(formatTimestamp(fullDateTime))} `}${_chalk.hex(colors.warning ?? DEFAULT_COLOR_CONFIG.dark.warning)(`[${CONSOLE_ICONS[LogLevelLabel.WARN]} Warn] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
280
+ `);
281
+ };
282
+ if (typeof logLevel === "number" && LogLevel.SUCCESS >= logLevel) return (message) => {
283
+ console.info(`
284
+ ${hideDateTime ? "" : `${_chalk.gray(formatTimestamp(fullDateTime))} `}${_chalk.hex(colors.success ?? DEFAULT_COLOR_CONFIG.dark.success)(`[${CONSOLE_ICONS[LogLevelLabel.SUCCESS]} Success] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
285
+ `);
286
+ };
287
+ if (typeof logLevel === "number" && LogLevel.INFO >= logLevel) return (message) => {
288
+ console.info(`
289
+ ${hideDateTime ? "" : `${_chalk.gray(formatTimestamp(fullDateTime))} `}${_chalk.hex(colors.info ?? DEFAULT_COLOR_CONFIG.dark.info)(`[${CONSOLE_ICONS[LogLevelLabel.INFO]} Info] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
290
+ `);
291
+ };
292
+ if (typeof logLevel === "number" && LogLevel.PERFORMANCE >= logLevel) return (message) => {
293
+ console.debug(`
294
+ ${hideDateTime ? "" : `${_chalk.gray(formatTimestamp(fullDateTime))} `}${_chalk.hex(colors.performance ?? DEFAULT_COLOR_CONFIG.dark.performance)(`[${CONSOLE_ICONS[LogLevelLabel.PERFORMANCE]} Performance] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
295
+ `);
296
+ };
297
+ if (typeof logLevel === "number" && LogLevel.DEBUG >= logLevel) return (message) => {
298
+ console.debug(`
299
+ ${hideDateTime ? "" : `${_chalk.gray(formatTimestamp(fullDateTime))} `}${_chalk.hex(colors.debug ?? DEFAULT_COLOR_CONFIG.dark.debug)(`[${CONSOLE_ICONS[LogLevelLabel.DEBUG]} Debug] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
300
+ `);
301
+ };
302
+ if (typeof logLevel === "number" && LogLevel.TRACE >= logLevel) return (message) => {
303
+ console.debug(`
304
+ ${hideDateTime ? "" : `${_chalk.gray(formatTimestamp(fullDateTime))} `}${_chalk.hex("#bbbbbb")(`[${CONSOLE_ICONS[LogLevelLabel.TRACE]} Trace] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
305
+ `);
306
+ };
307
+ return (message) => {
308
+ console.log(`
309
+ ${hideDateTime ? "" : `${_chalk.gray(formatTimestamp(fullDateTime))} `}${_chalk.hex(colors.brand ?? DEFAULT_COLOR_CONFIG.dark.brand)(`[${CONSOLE_ICONS[LogLevelLabel.ALL]} System] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
310
+ `);
311
+ };
373
312
  };
374
- var writeFatal = (message, config) => getLogFn(LogLevel.FATAL, config)(message);
375
- var writeError = (message, config) => getLogFn(LogLevel.ERROR, config)(message);
376
- var writeWarning = (message, config) => getLogFn(LogLevel.WARN, config)(message);
377
- var writeInfo = (message, config) => getLogFn(LogLevel.INFO, config)(message);
378
- var writeSuccess = (message, config) => getLogFn(LogLevel.SUCCESS, config)(message);
379
- var writeTrace = (message, config) => getLogFn(LogLevel.TRACE, config)(message);
380
- var MAX_DEPTH = 10;
381
- var formatLogMessage = (message, options = {}, depth2 = 0) => {
382
- if (depth2 > MAX_DEPTH) {
383
- return "<max depth>";
384
- }
385
- const prefix = options.prefix ?? "";
386
- const skip = options.skip ?? [];
387
- const sort = options.sort ?? true;
388
- return typeof message === "undefined" || message === null ? "<empty>" : typeof message === "string" ? !message ? "<empty string>" : message : Array.isArray(message) ? `
389
- ${message.sort(
390
- sort ? (a, b) => !a && !b ? 0 : !a ? 1 : !b ? -1 : String(a).localeCompare(String(b)) : void 0
391
- ).map(
392
- (item, index) => ` ${prefix}> #${index} = ${formatLogMessage(
393
- item,
394
- { prefix: `${prefix}--`, skip, sort },
395
- depth2 + 1
396
- )}`
397
- ).join("\n")}` : typeof message === "object" && message ? `
398
- ${Object.keys(message).filter(
399
- (key) => typeof key !== "string" || !skip.map((k) => k.toLowerCase().trim()).includes(key.toLowerCase().trim())
400
- ).sort(
401
- sort ? (a, b) => !a && !b ? 0 : !a ? 1 : !b ? -1 : String(a).localeCompare(String(b)) : void 0
402
- ).map(
403
- (key) => ` ${prefix}> ${key} = ${_isFunction(message[key]) ? "<function>" : typeof message[key] === "object" && message[key] ? Object.keys(message[key]).filter(
404
- (key2) => typeof key2 !== "string" || !skip.map((k) => k.toLowerCase().trim()).includes(key2.toLowerCase().trim())
405
- ).length === 0 ? "{}" : formatLogMessage(
406
- message[key],
407
- { prefix: `${prefix}--`, skip, sort },
408
- depth2 + 1
409
- ) : message[key]}`
410
- ).join("\n")}` : String(message);
313
+ /**
314
+ * Write a message to the console at the `fatal` log level
315
+ *
316
+ * @param message - The message to write
317
+ * @param config - The Storm configuration
318
+ */
319
+ const writeFatal = (message, config) => getLogFn(LogLevel.FATAL, config)(message);
320
+ /**
321
+ * Write a message to the console at the `error` log level
322
+ *
323
+ * @param message - The message to write
324
+ * @param config - The Storm configuration
325
+ */
326
+ const writeError = (message, config) => getLogFn(LogLevel.ERROR, config)(message);
327
+ /**
328
+ * Write a message to the console at the `warning` log level
329
+ *
330
+ * @param message - The message to write
331
+ * @param config - The Storm configuration
332
+ */
333
+ const writeWarning = (message, config) => getLogFn(LogLevel.WARN, config)(message);
334
+ /**
335
+ * Write a message to the console at the `info` log level
336
+ *
337
+ * @param message - The message to write
338
+ * @param config - The Storm configuration
339
+ */
340
+ const writeInfo = (message, config) => getLogFn(LogLevel.INFO, config)(message);
341
+ /**
342
+ * Write a message to the console at the `success` log level
343
+ *
344
+ * @param message - The message to write
345
+ * @param config - The Storm configuration
346
+ */
347
+ const writeSuccess = (message, config) => getLogFn(LogLevel.SUCCESS, config)(message);
348
+ /**
349
+ * Write a message to the console at the `trace` log level
350
+ *
351
+ * @param message - The message to write
352
+ * @param config - The Storm configuration
353
+ */
354
+ const writeTrace = (message, config) => getLogFn(LogLevel.TRACE, config)(message);
355
+ const MAX_DEPTH = 10;
356
+ /**
357
+ * Format a log message for output to the console, handling different types of messages (e.g. strings, objects, arrays) and applying formatting options such as prefixing and skipping certain keys in objects.
358
+ *
359
+ * @param message - The message to format
360
+ * @param options - Formatting options
361
+ * @param depth - The current depth of recursion
362
+ * @returns The formatted log message
363
+ */
364
+ const formatLogMessage = (message, options = {}, depth = 0) => {
365
+ if (depth > MAX_DEPTH) return "<max depth>";
366
+ const prefix = options.prefix ?? "";
367
+ const skip = options.skip ?? [];
368
+ const sort = options.sort ?? true;
369
+ return typeof message === "undefined" || message === null ? "<empty>" : typeof message === "string" ? !message ? "<empty string>" : message : Array.isArray(message) ? `\n${message.sort(sort ? (a, b) => !a && !b ? 0 : !a ? 1 : !b ? -1 : String(a).localeCompare(String(b)) : void 0).map((item, index) => ` ${prefix}> #${index} = ${formatLogMessage(item, {
370
+ prefix: `${prefix}--`,
371
+ skip,
372
+ sort
373
+ }, depth + 1)}`).join("\n")}` : typeof message === "object" && message ? `\n${Object.keys(message).filter((key) => typeof key !== "string" || !skip.map((k) => k.toLowerCase().trim()).includes(key.toLowerCase().trim())).sort(sort ? (a, b) => !a && !b ? 0 : !a ? 1 : !b ? -1 : String(a).localeCompare(String(b)) : void 0).map((key) => ` ${prefix}> ${key} = ${_isFunction(message[key]) ? "<function>" : typeof message[key] === "object" && message[key] ? Object.keys(message[key]).filter((key) => typeof key !== "string" || !skip.map((k) => k.toLowerCase().trim()).includes(key.toLowerCase().trim())).length === 0 ? "{}" : formatLogMessage(message[key], {
374
+ prefix: `${prefix}--`,
375
+ skip,
376
+ sort
377
+ }, depth + 1) : message[key]}`).join("\n")}` : String(message);
411
378
  };
412
- var _isFunction = (value) => {
413
- try {
414
- return value instanceof Function || typeof value === "function" || !!(value?.constructor && value?.call && value?.apply);
415
- } catch {
416
- return false;
417
- }
379
+ const _isFunction = (value) => {
380
+ try {
381
+ return value instanceof Function || typeof value === "function" || !!(value?.constructor && value?.call && value?.apply);
382
+ } catch {
383
+ return false;
384
+ }
418
385
  };
419
- var brandIcon = (config = {}, _chalk = getChalk()) => _chalk.hex(getColor("brand", config))("\u{1F5F2}");
420
-
421
- // src/utilities/correct-paths.ts
422
- var _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
386
+ /**
387
+ * Get the brand icon for the console
388
+ *
389
+ * @param config - The Storm configuration
390
+ * @param _chalk - The chalk instance
391
+ * @returns The brand icon
392
+ */
393
+ const brandIcon = (config = {}, _chalk = getChalk()) => _chalk.hex(getColor("brand", config))("🗲");
394
+ //#endregion
395
+ //#region src/utilities/correct-paths.ts
396
+ const _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
423
397
  function normalizeWindowsPath(input = "") {
424
- if (!input) {
425
- return input;
426
- }
427
- return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
398
+ if (!input) return input;
399
+ return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
428
400
  }
429
- var _UNC_REGEX = /^[/\\]{2}/;
430
- var _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
431
- var _DRIVE_LETTER_RE = /^[A-Za-z]:$/;
432
- var correctPaths = function(path) {
433
- if (!path || path.length === 0) {
434
- return ".";
435
- }
436
- path = normalizeWindowsPath(path);
437
- const isUNCPath = path?.match(_UNC_REGEX);
438
- const isPathAbsolute = isAbsolute(path);
439
- const trailingSeparator = path[path.length - 1] === "/";
440
- path = normalizeString(path, !isPathAbsolute);
441
- if (path.length === 0) {
442
- if (isPathAbsolute) {
443
- return "/";
444
- }
445
- return trailingSeparator ? "./" : ".";
446
- }
447
- if (trailingSeparator) {
448
- path += "/";
449
- }
450
- if (_DRIVE_LETTER_RE.test(path)) {
451
- path += "/";
452
- }
453
- if (isUNCPath) {
454
- if (!isPathAbsolute) {
455
- return `//./${path}`;
456
- }
457
- return `//${path}`;
458
- }
459
- return isPathAbsolute && !isAbsolute(path) ? `/${path}` : path;
401
+ const _UNC_REGEX = /^[/\\]{2}/;
402
+ const _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
403
+ const _DRIVE_LETTER_RE = /^[A-Za-z]:$/;
404
+ const correctPaths = function(path) {
405
+ if (!path || path.length === 0) return ".";
406
+ path = normalizeWindowsPath(path);
407
+ const isUNCPath = path?.match(_UNC_REGEX);
408
+ const isPathAbsolute = isAbsolute(path);
409
+ const trailingSeparator = path[path.length - 1] === "/";
410
+ path = normalizeString(path, !isPathAbsolute);
411
+ if (path.length === 0) {
412
+ if (isPathAbsolute) return "/";
413
+ return trailingSeparator ? "./" : ".";
414
+ }
415
+ if (trailingSeparator) path += "/";
416
+ if (_DRIVE_LETTER_RE.test(path)) path += "/";
417
+ if (isUNCPath) {
418
+ if (!isPathAbsolute) return `//./${path}`;
419
+ return `//${path}`;
420
+ }
421
+ return isPathAbsolute && !isAbsolute(path) ? `/${path}` : path;
460
422
  };
461
- var joinPaths = function(...segments) {
462
- let path = "";
463
- for (const seg of segments) {
464
- if (!seg) {
465
- continue;
466
- }
467
- if (path.length > 0) {
468
- const pathTrailing = path[path.length - 1] === "/";
469
- const segLeading = seg[0] === "/";
470
- const both = pathTrailing && segLeading;
471
- if (both) {
472
- path += seg.slice(1);
473
- } else {
474
- path += pathTrailing || segLeading ? seg : `/${seg}`;
475
- }
476
- } else {
477
- path += seg;
478
- }
479
- }
480
- return correctPaths(path);
423
+ const joinPaths = function(...segments) {
424
+ let path = "";
425
+ for (const seg of segments) {
426
+ if (!seg) continue;
427
+ if (path.length > 0) {
428
+ const pathTrailing = path[path.length - 1] === "/";
429
+ const segLeading = seg[0] === "/";
430
+ if (pathTrailing && segLeading) path += seg.slice(1);
431
+ else path += pathTrailing || segLeading ? seg : `/${seg}`;
432
+ } else path += seg;
433
+ }
434
+ return correctPaths(path);
481
435
  };
436
+ /**
437
+ * Resolves a string path, resolving '.' and '.' segments and allowing paths above the root.
438
+ *
439
+ * @param path - The path to normalise.
440
+ * @param allowAboveRoot - Whether to allow the resulting path to be above the root directory.
441
+ * @returns the normalised path string.
442
+ */
482
443
  function normalizeString(path, allowAboveRoot) {
483
- let res = "";
484
- let lastSegmentLength = 0;
485
- let lastSlash = -1;
486
- let dots = 0;
487
- let char = null;
488
- for (let index = 0; index <= path.length; ++index) {
489
- if (index < path.length) {
490
- char = path[index];
491
- } else if (char === "/") {
492
- break;
493
- } else {
494
- char = "/";
495
- }
496
- if (char === "/") {
497
- if (lastSlash === index - 1 || dots === 1) {
498
- } else if (dots === 2) {
499
- if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
500
- if (res.length > 2) {
501
- const lastSlashIndex = res.lastIndexOf("/");
502
- if (lastSlashIndex === -1) {
503
- res = "";
504
- lastSegmentLength = 0;
505
- } else {
506
- res = res.slice(0, lastSlashIndex);
507
- lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
508
- }
509
- lastSlash = index;
510
- dots = 0;
511
- continue;
512
- } else if (res.length > 0) {
513
- res = "";
514
- lastSegmentLength = 0;
515
- lastSlash = index;
516
- dots = 0;
517
- continue;
518
- }
519
- }
520
- if (allowAboveRoot) {
521
- res += res.length > 0 ? "/.." : "..";
522
- lastSegmentLength = 2;
523
- }
524
- } else {
525
- if (res.length > 0) {
526
- res += `/${path.slice(lastSlash + 1, index)}`;
527
- } else {
528
- res = path.slice(lastSlash + 1, index);
529
- }
530
- lastSegmentLength = index - lastSlash - 1;
531
- }
532
- lastSlash = index;
533
- dots = 0;
534
- } else if (char === "." && dots !== -1) {
535
- ++dots;
536
- } else {
537
- dots = -1;
538
- }
539
- }
540
- return res;
444
+ let res = "";
445
+ let lastSegmentLength = 0;
446
+ let lastSlash = -1;
447
+ let dots = 0;
448
+ let char = null;
449
+ for (let index = 0; index <= path.length; ++index) {
450
+ if (index < path.length) char = path[index];
451
+ else if (char === "/") break;
452
+ else char = "/";
453
+ if (char === "/") {
454
+ if (lastSlash === index - 1 || dots === 1) {} else if (dots === 2) {
455
+ if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
456
+ if (res.length > 2) {
457
+ const lastSlashIndex = res.lastIndexOf("/");
458
+ if (lastSlashIndex === -1) {
459
+ res = "";
460
+ lastSegmentLength = 0;
461
+ } else {
462
+ res = res.slice(0, lastSlashIndex);
463
+ lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
464
+ }
465
+ lastSlash = index;
466
+ dots = 0;
467
+ continue;
468
+ } else if (res.length > 0) {
469
+ res = "";
470
+ lastSegmentLength = 0;
471
+ lastSlash = index;
472
+ dots = 0;
473
+ continue;
474
+ }
475
+ }
476
+ if (allowAboveRoot) {
477
+ res += res.length > 0 ? "/.." : "..";
478
+ lastSegmentLength = 2;
479
+ }
480
+ } else {
481
+ if (res.length > 0) res += `/${path.slice(lastSlash + 1, index)}`;
482
+ else res = path.slice(lastSlash + 1, index);
483
+ lastSegmentLength = index - lastSlash - 1;
484
+ }
485
+ lastSlash = index;
486
+ dots = 0;
487
+ } else if (char === "." && dots !== -1) ++dots;
488
+ else dots = -1;
489
+ }
490
+ return res;
541
491
  }
542
- var isAbsolute = function(p) {
543
- return _IS_ABSOLUTE_RE.test(p);
492
+ const isAbsolute = function(p) {
493
+ return _IS_ABSOLUTE_RE.test(p);
544
494
  };
545
-
546
- // src/utilities/find-up.ts
547
- var import_node_fs = require("fs");
548
- var import_node_path = require("path");
549
- var MAX_PATH_SEARCH_DEPTH = 30;
550
- var depth = 0;
495
+ //#endregion
496
+ //#region src/utilities/find-up.ts
497
+ const MAX_PATH_SEARCH_DEPTH = 30;
498
+ let depth = 0;
499
+ /**
500
+ * Gets the nearest "node_modules" folder by walking up from start path.
501
+ */
551
502
  function findFolderUp(startPath, endFileNames = [], endDirectoryNames = []) {
552
- const _startPath = startPath ?? process.cwd();
553
- if (endDirectoryNames.some(
554
- (endDirName) => (0, import_node_fs.existsSync)((0, import_node_path.join)(_startPath, endDirName))
555
- )) {
556
- return _startPath;
557
- }
558
- if (endFileNames.some((endFileName) => (0, import_node_fs.existsSync)((0, import_node_path.join)(_startPath, endFileName)))) {
559
- return _startPath;
560
- }
561
- if (_startPath !== "/" && depth++ < MAX_PATH_SEARCH_DEPTH) {
562
- const parent = (0, import_node_path.join)(_startPath, "..");
563
- return findFolderUp(parent, endFileNames, endDirectoryNames);
564
- }
565
- return void 0;
503
+ const _startPath = startPath ?? process.cwd();
504
+ if (endDirectoryNames.some((endDirName) => (0, node_fs.existsSync)((0, node_path.join)(_startPath, endDirName)))) return _startPath;
505
+ if (endFileNames.some((endFileName) => (0, node_fs.existsSync)((0, node_path.join)(_startPath, endFileName)))) return _startPath;
506
+ if (_startPath !== "/" && depth++ < MAX_PATH_SEARCH_DEPTH) return findFolderUp((0, node_path.join)(_startPath, ".."), endFileNames, endDirectoryNames);
566
507
  }
567
-
568
- // src/utilities/find-workspace-root.ts
569
- var rootFiles = [
570
- "storm-workspace.json",
571
- "storm-workspace.yaml",
572
- "storm-workspace.yml",
573
- "storm-workspace.js",
574
- "storm-workspace.ts",
575
- ".storm-workspace.json",
576
- ".storm-workspace.yaml",
577
- ".storm-workspace.yml",
578
- ".storm-workspace.js",
579
- ".storm-workspace.ts",
580
- "lerna.json",
581
- "nx.json",
582
- "turbo.json",
583
- "npm-workspace.json",
584
- "yarn-workspace.json",
585
- "pnpm-workspace.json",
586
- "npm-workspace.yaml",
587
- "yarn-workspace.yaml",
588
- "pnpm-workspace.yaml",
589
- "npm-workspace.yml",
590
- "yarn-workspace.yml",
591
- "pnpm-workspace.yml",
592
- "npm-lock.json",
593
- "yarn-lock.json",
594
- "pnpm-lock.json",
595
- "npm-lock.yaml",
596
- "yarn-lock.yaml",
597
- "pnpm-lock.yaml",
598
- "npm-lock.yml",
599
- "yarn-lock.yml",
600
- "pnpm-lock.yml",
601
- "bun.lockb",
602
- "bun.lock",
603
- "bunfig.toml"
508
+ //#endregion
509
+ //#region src/utilities/find-workspace-root.ts
510
+ const rootFiles = [
511
+ "storm-workspace.json",
512
+ "storm-workspace.yaml",
513
+ "storm-workspace.yml",
514
+ "storm-workspace.js",
515
+ "storm-workspace.ts",
516
+ ".storm-workspace.json",
517
+ ".storm-workspace.yaml",
518
+ ".storm-workspace.yml",
519
+ ".storm-workspace.js",
520
+ ".storm-workspace.ts",
521
+ "lerna.json",
522
+ "nx.json",
523
+ "turbo.json",
524
+ "npm-workspace.json",
525
+ "yarn-workspace.json",
526
+ "pnpm-workspace.json",
527
+ "npm-workspace.yaml",
528
+ "yarn-workspace.yaml",
529
+ "pnpm-workspace.yaml",
530
+ "npm-workspace.yml",
531
+ "yarn-workspace.yml",
532
+ "pnpm-workspace.yml",
533
+ "npm-lock.json",
534
+ "yarn-lock.json",
535
+ "pnpm-lock.json",
536
+ "npm-lock.yaml",
537
+ "yarn-lock.yaml",
538
+ "pnpm-lock.yaml",
539
+ "npm-lock.yml",
540
+ "yarn-lock.yml",
541
+ "pnpm-lock.yml",
542
+ "bun.lockb",
543
+ "bun.lock",
544
+ "bunfig.toml"
604
545
  ];
605
- var rootDirectories = [
606
- ".storm-workspace",
607
- ".nx",
608
- ".git",
609
- ".github",
610
- ".vscode",
611
- ".verdaccio"
546
+ const rootDirectories = [
547
+ ".storm-workspace",
548
+ ".nx",
549
+ ".git",
550
+ ".github",
551
+ ".vscode",
552
+ ".verdaccio"
612
553
  ];
554
+ /**
555
+ * Find the monorepo root directory, searching upwards from `path`.
556
+ *
557
+ * @param pathInsideMonorepo - The path inside the monorepo to start searching from
558
+ * @returns The monorepo root directory
559
+ */
613
560
  function findWorkspaceRootSafe(pathInsideMonorepo) {
614
- if (process.env.STORM_WORKSPACE_ROOT || process.env.NX_WORKSPACE_ROOT_PATH) {
615
- return correctPaths(
616
- process.env.STORM_WORKSPACE_ROOT ?? process.env.NX_WORKSPACE_ROOT_PATH
617
- );
618
- }
619
- return correctPaths(
620
- findFolderUp(
621
- pathInsideMonorepo ?? process.cwd(),
622
- rootFiles,
623
- rootDirectories
624
- )
625
- );
561
+ if (process.env.STORM_WORKSPACE_ROOT || process.env.NX_WORKSPACE_ROOT_PATH) return correctPaths(process.env.STORM_WORKSPACE_ROOT ?? process.env.NX_WORKSPACE_ROOT_PATH);
562
+ return correctPaths(findFolderUp(pathInsideMonorepo ?? process.cwd(), rootFiles, rootDirectories));
626
563
  }
564
+ /**
565
+ * Find the monorepo root directory, searching upwards from `path`.
566
+ *
567
+ * @param pathInsideMonorepo - The path inside the monorepo to start searching from
568
+ * @returns The monorepo root directory
569
+ */
627
570
  function findWorkspaceRoot(pathInsideMonorepo) {
628
- const result = findWorkspaceRootSafe(pathInsideMonorepo);
629
- if (!result) {
630
- throw new Error(
631
- `Cannot find workspace root upwards from known path. Files search list includes:
632
- ${rootFiles.join(
633
- "\n"
634
- )}
635
- Path: ${pathInsideMonorepo ? pathInsideMonorepo : process.cwd()}`
636
- );
637
- }
638
- return result;
571
+ const result = findWorkspaceRootSafe(pathInsideMonorepo);
572
+ if (!result) throw new Error(`Cannot find workspace root upwards from known path. Files search list includes: \n${rootFiles.join("\n")}\nPath: ${pathInsideMonorepo ? pathInsideMonorepo : process.cwd()}`);
573
+ return result;
639
574
  }
640
-
641
- // src/utilities/get-default-config.ts
642
- var import_config = require("@storm-software/config");
643
- var import_node_fs2 = require("fs");
644
- var import_promises = require("fs/promises");
645
- var import_node_path2 = require("path");
575
+ //#endregion
576
+ //#region src/utilities/get-default-config.ts
577
+ /**
578
+ * Get the default Storm config values used during various dev-ops processes
579
+ *
580
+ * @returns The default Storm config values
581
+ */
646
582
  async function getPackageJsonConfig(root) {
647
- let license = import_config.STORM_DEFAULT_LICENSE;
648
- let homepage = void 0;
649
- let support = void 0;
650
- let name = void 0;
651
- let namespace = void 0;
652
- let repository = void 0;
653
- const workspaceRoot = findWorkspaceRoot(root);
654
- if ((0, import_node_fs2.existsSync)((0, import_node_path2.join)(workspaceRoot, "package.json"))) {
655
- const file = await (0, import_promises.readFile)(
656
- joinPaths(workspaceRoot, "package.json"),
657
- "utf8"
658
- );
659
- if (file) {
660
- const packageJson = JSON.parse(file);
661
- if (packageJson.name) {
662
- name = packageJson.name;
663
- }
664
- if (packageJson.namespace) {
665
- namespace = packageJson.namespace;
666
- }
667
- if (packageJson.repository) {
668
- if (typeof packageJson.repository === "string") {
669
- repository = packageJson.repository;
670
- } else if (packageJson.repository.url) {
671
- repository = packageJson.repository.url;
672
- }
673
- }
674
- if (packageJson.license) {
675
- license = packageJson.license;
676
- }
677
- if (packageJson.homepage) {
678
- homepage = packageJson.homepage;
679
- }
680
- if (packageJson.bugs) {
681
- if (typeof packageJson.bugs === "string") {
682
- support = packageJson.bugs;
683
- } else if (packageJson.bugs.url) {
684
- support = packageJson.bugs.url;
685
- }
686
- }
687
- }
688
- }
689
- return {
690
- workspaceRoot,
691
- name,
692
- namespace,
693
- repository,
694
- license,
695
- homepage,
696
- support
697
- };
583
+ let license = _storm_software_config.STORM_DEFAULT_LICENSE;
584
+ let homepage = void 0;
585
+ let support = void 0;
586
+ let name = void 0;
587
+ let namespace = void 0;
588
+ let repository = void 0;
589
+ const workspaceRoot = findWorkspaceRoot(root);
590
+ if ((0, node_fs.existsSync)((0, node_path.join)(workspaceRoot, "package.json"))) {
591
+ const file = await (0, node_fs_promises.readFile)(joinPaths(workspaceRoot, "package.json"), "utf8");
592
+ if (file) {
593
+ const packageJson = JSON.parse(file);
594
+ if (packageJson.name) name = packageJson.name;
595
+ if (packageJson.namespace) namespace = packageJson.namespace;
596
+ if (packageJson.repository) {
597
+ if (typeof packageJson.repository === "string") repository = packageJson.repository;
598
+ else if (packageJson.repository.url) repository = packageJson.repository.url;
599
+ }
600
+ if (packageJson.license) license = packageJson.license;
601
+ if (packageJson.homepage) homepage = packageJson.homepage;
602
+ if (packageJson.bugs) {
603
+ if (typeof packageJson.bugs === "string") support = packageJson.bugs;
604
+ else if (packageJson.bugs.url) support = packageJson.bugs.url;
605
+ }
606
+ }
607
+ }
608
+ return {
609
+ workspaceRoot,
610
+ name,
611
+ namespace,
612
+ repository,
613
+ license,
614
+ homepage,
615
+ support
616
+ };
698
617
  }
618
+ /**
619
+ * Apply default config values to the given config object
620
+ *
621
+ * @param config - The config object to apply defaults to
622
+ * @returns The config object with defaults applied
623
+ */
699
624
  function applyDefaultConfig(config) {
700
- if (!config.support && config.contact) {
701
- config.support = config.contact;
702
- }
703
- if (!config.contact && config.support) {
704
- config.contact = config.support;
705
- }
706
- if (config.homepage) {
707
- if (!config.docs) {
708
- config.docs = `${config.homepage}/docs`;
709
- }
710
- if (!config.license) {
711
- config.license = `${config.homepage}/license`;
712
- }
713
- if (!config.support) {
714
- config.support = `${config.homepage}/support`;
715
- }
716
- if (!config.contact) {
717
- config.contact = `${config.homepage}/contact`;
718
- }
719
- if (!config.error?.codesFile || !config?.error?.url) {
720
- config.error ??= { codesFile: import_config.STORM_DEFAULT_ERROR_CODES_FILE };
721
- if (config.homepage) {
722
- config.error.url ??= `${config.homepage}/errors`;
723
- }
724
- }
725
- }
726
- return config;
625
+ if (!config.support && config.contact) config.support = config.contact;
626
+ if (!config.contact && config.support) config.contact = config.support;
627
+ if (config.homepage) {
628
+ if (!config.docs) config.docs = `${config.homepage}/docs`;
629
+ if (!config.license) config.license = `${config.homepage}/license`;
630
+ if (!config.support) config.support = `${config.homepage}/support`;
631
+ if (!config.contact) config.contact = `${config.homepage}/contact`;
632
+ if (!config.error?.codesFile || !config?.error?.url) {
633
+ config.error ??= { codesFile: _storm_software_config.STORM_DEFAULT_ERROR_CODES_FILE };
634
+ if (config.homepage) config.error.url ??= `${config.homepage}/errors`;
635
+ }
636
+ }
637
+ return config;
727
638
  }
728
-
729
- // src/utilities/process-handler.ts
730
- var exitWithError = (config) => {
731
- writeFatal("Exiting script with an error status...", config);
732
- process.exit(1);
639
+ //#endregion
640
+ //#region src/utilities/process-handler.ts
641
+ const exitWithError = (config) => {
642
+ writeFatal("Exiting script with an error status...", config);
643
+ process.exit(1);
733
644
  };
734
- var exitWithSuccess = (config) => {
735
- writeSuccess("Script completed successfully. Exiting...", config);
736
- process.exit(0);
645
+ const exitWithSuccess = (config) => {
646
+ writeSuccess("Script completed successfully. Exiting...", config);
647
+ process.exit(0);
737
648
  };
738
- var handleProcess = (config) => {
739
- writeTrace(
740
- `Using the following arguments to process the script: ${process.argv.join(", ")}`,
741
- config
742
- );
743
- process.on("unhandledRejection", (error) => {
744
- writeError(
745
- `An Unhandled Rejection occurred while running the program: ${error && typeof error === "object" && "message" in error && error?.message ? error.message : typeof error === "string" ? error : "Unknown error"}
746
- Stacktrace: ${error && typeof error === "object" && "stack" in error && error?.stack ? error.stack : ""}`,
747
- config
748
- );
749
- exitWithError(config);
750
- });
751
- process.on("uncaughtException", (error) => {
752
- writeError(
753
- `An Uncaught Exception occurred while running the program: ${error && typeof error === "object" && "message" in error && error?.message ? error.message : typeof error === "string" ? error : "Unknown error"}
754
- Stacktrace: ${error && typeof error === "object" && "stack" in error && error?.stack ? error.stack : ""}`,
755
- config
756
- );
757
- exitWithError(config);
758
- });
759
- process.on("SIGTERM", (signal) => {
760
- writeError(`The program terminated with signal code: ${signal}`, config);
761
- exitWithError(config);
762
- });
763
- process.on("SIGINT", (signal) => {
764
- writeError(`The program terminated with signal code: ${signal}`, config);
765
- exitWithError(config);
766
- });
767
- process.on("SIGHUP", (signal) => {
768
- writeError(`The program terminated with signal code: ${signal}`, config);
769
- exitWithError(config);
770
- });
649
+ const handleProcess = (config) => {
650
+ writeTrace(`Using the following arguments to process the script: ${process.argv.join(", ")}`, config);
651
+ process.on("unhandledRejection", (error) => {
652
+ writeError(`An Unhandled Rejection occurred while running the program: ${error && typeof error === "object" && "message" in error && error?.message ? error.message : typeof error === "string" ? error : "Unknown error"} \nStacktrace: ${error && typeof error === "object" && "stack" in error && error?.stack ? error.stack : ""}`, config);
653
+ exitWithError(config);
654
+ });
655
+ process.on("uncaughtException", (error) => {
656
+ writeError(`An Uncaught Exception occurred while running the program: ${error && typeof error === "object" && "message" in error && error?.message ? error.message : typeof error === "string" ? error : "Unknown error"} \nStacktrace: ${error && typeof error === "object" && "stack" in error && error?.stack ? error.stack : ""}`, config);
657
+ exitWithError(config);
658
+ });
659
+ process.on("SIGTERM", (signal) => {
660
+ writeError(`The program terminated with signal code: ${signal}`, config);
661
+ exitWithError(config);
662
+ });
663
+ process.on("SIGINT", (signal) => {
664
+ writeError(`The program terminated with signal code: ${signal}`, config);
665
+ exitWithError(config);
666
+ });
667
+ process.on("SIGHUP", (signal) => {
668
+ writeError(`The program terminated with signal code: ${signal}`, config);
669
+ exitWithError(config);
670
+ });
771
671
  };
772
-
773
- // src/config-file/get-config-file.ts
774
- var getConfigFileByName = async (fileName, filePath, options = {}) => {
775
- const workspacePath = filePath || findWorkspaceRoot(filePath);
776
- const configs = await Promise.all([
777
- (0, import_c12.loadConfig)({
778
- cwd: workspacePath,
779
- packageJson: true,
780
- name: fileName,
781
- envName: fileName?.toUpperCase(),
782
- jitiOptions: {
783
- debug: false,
784
- fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : joinPaths(
785
- process.env.STORM_CACHE_DIR || "node_modules/.cache/storm",
786
- "jiti"
787
- )
788
- },
789
- ...options
790
- }),
791
- (0, import_c12.loadConfig)({
792
- cwd: workspacePath,
793
- packageJson: true,
794
- name: fileName,
795
- envName: fileName?.toUpperCase(),
796
- jitiOptions: {
797
- debug: false,
798
- fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : joinPaths(
799
- process.env.STORM_CACHE_DIR || "node_modules/.cache/storm",
800
- "jiti"
801
- )
802
- },
803
- configFile: fileName,
804
- ...options
805
- })
806
- ]);
807
- return (0, import_defu.default)(configs[0] ?? {}, configs[1] ?? {});
672
+ //#endregion
673
+ //#region src/config-file/get-config-file.ts
674
+ /**
675
+ * Get the config file for the current Storm workspace
676
+ *
677
+ * @param fileName - The name of the config file to search for
678
+ * @param filePath - The path to search for the config file in
679
+ * @returns The config file for the current Storm workspace
680
+ */
681
+ const getConfigFileByName = async (fileName, filePath, options = {}) => {
682
+ const workspacePath = filePath || findWorkspaceRoot(filePath);
683
+ const configs = await Promise.all([(0, c12.loadConfig)({
684
+ cwd: workspacePath,
685
+ packageJson: true,
686
+ name: fileName,
687
+ envName: fileName?.toUpperCase(),
688
+ jitiOptions: {
689
+ debug: false,
690
+ fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : joinPaths(process.env.STORM_CACHE_DIR || "node_modules/.cache/storm", "jiti")
691
+ },
692
+ ...options
693
+ }), (0, c12.loadConfig)({
694
+ cwd: workspacePath,
695
+ packageJson: true,
696
+ name: fileName,
697
+ envName: fileName?.toUpperCase(),
698
+ jitiOptions: {
699
+ debug: false,
700
+ fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : joinPaths(process.env.STORM_CACHE_DIR || "node_modules/.cache/storm", "jiti")
701
+ },
702
+ configFile: fileName,
703
+ ...options
704
+ })]);
705
+ return (0, defu.default)(configs[0] ?? {}, configs[1] ?? {});
808
706
  };
809
- var getConfigFile = async (filePath, additionalFileNames = []) => {
810
- const workspacePath = filePath ? filePath : findWorkspaceRoot(filePath);
811
- const result = await getConfigFileByName("storm-workspace", workspacePath);
812
- let config = result.config;
813
- const configFile = result.configFile;
814
- if (config && configFile && Object.keys(config).length > 0 && !config.skipConfigLogging) {
815
- writeTrace(
816
- `Found Storm configuration file "${configFile.includes(`${workspacePath}/`) ? configFile.replace(`${workspacePath}/`, "") : configFile}" at "${workspacePath}"`,
817
- {
818
- logLevel: "all"
819
- }
820
- );
821
- }
822
- if (additionalFileNames && additionalFileNames.length > 0) {
823
- const results = await Promise.all(
824
- additionalFileNames.map(
825
- (fileName) => getConfigFileByName(fileName, workspacePath)
826
- )
827
- );
828
- for (const result2 of results) {
829
- if (result2?.config && result2?.configFile && Object.keys(result2.config).length > 0) {
830
- if (!config.skipConfigLogging && !result2.config.skipConfigLogging) {
831
- writeTrace(
832
- `Found alternative configuration file "${result2.configFile.includes(`${workspacePath}/`) ? result2.configFile.replace(`${workspacePath}/`, "") : result2.configFile}" at "${workspacePath}"`,
833
- {
834
- logLevel: "all"
835
- }
836
- );
837
- }
838
- config = (0, import_defu.default)(result2.config ?? {}, config ?? {});
839
- }
840
- }
841
- }
842
- if (!config || Object.keys(config).length === 0) {
843
- return void 0;
844
- }
845
- config.configFile = configFile;
846
- return config;
707
+ /**
708
+ * Get the config file for the current Storm workspace
709
+ *
710
+ * @returns The config file for the current Storm workspace
711
+ */
712
+ const getConfigFile = async (filePath, additionalFileNames = []) => {
713
+ const workspacePath = filePath ? filePath : findWorkspaceRoot(filePath);
714
+ const result = await getConfigFileByName("storm-workspace", workspacePath);
715
+ let config = result.config;
716
+ const configFile = result.configFile;
717
+ if (config && configFile && Object.keys(config).length > 0 && !config.skipConfigLogging) writeTrace(`Found Storm configuration file "${configFile.includes(`${workspacePath}/`) ? configFile.replace(`${workspacePath}/`, "") : configFile}" at "${workspacePath}"`, { logLevel: "all" });
718
+ if (additionalFileNames && additionalFileNames.length > 0) {
719
+ const results = await Promise.all(additionalFileNames.map((fileName) => getConfigFileByName(fileName, workspacePath)));
720
+ for (const result of results) if (result?.config && result?.configFile && Object.keys(result.config).length > 0) {
721
+ if (!config.skipConfigLogging && !result.config.skipConfigLogging) writeTrace(`Found alternative configuration file "${result.configFile.includes(`${workspacePath}/`) ? result.configFile.replace(`${workspacePath}/`, "") : result.configFile}" at "${workspacePath}"`, { logLevel: "all" });
722
+ config = (0, defu.default)(result.config ?? {}, config ?? {});
723
+ }
724
+ }
725
+ if (!config || Object.keys(config).length === 0) return;
726
+ config.configFile = configFile;
727
+ return config;
847
728
  };
848
-
849
- // src/env/get-env.ts
850
- var import_config2 = require("@storm-software/config");
851
- var getExtensionEnv = (extensionName) => {
852
- const prefix = `STORM_EXTENSION_${extensionName.toUpperCase()}_`;
853
- return Object.keys(process.env).filter((key) => key.startsWith(prefix)).reduce((ret, key) => {
854
- const name = key.replace(prefix, "").split("_").map(
855
- (i) => i.length > 0 ? i.trim().charAt(0).toUpperCase() + i.trim().slice(1) : ""
856
- ).join("");
857
- if (name) {
858
- ret[name] = process.env[key];
859
- }
860
- return ret;
861
- }, {});
729
+ //#endregion
730
+ //#region src/env/get-env.ts
731
+ /**
732
+ * Get the config for an extension module of Storm workspace from environment variables
733
+ *
734
+ * @param extensionName - The name of the extension module
735
+ * @returns The config for the specified Storm extension module. If the module does not exist, `undefined` is returned.
736
+ */
737
+ const getExtensionEnv = (extensionName) => {
738
+ const prefix = `STORM_EXTENSION_${extensionName.toUpperCase()}_`;
739
+ return Object.keys(process.env).filter((key) => key.startsWith(prefix)).reduce((ret, key) => {
740
+ const name = key.replace(prefix, "").split("_").map((i) => i.length > 0 ? i.trim().charAt(0).toUpperCase() + i.trim().slice(1) : "").join("");
741
+ if (name) ret[name] = process.env[key];
742
+ return ret;
743
+ }, {});
862
744
  };
863
- var getConfigEnv = () => {
864
- const prefix = "STORM_";
865
- let config = {
866
- extends: process.env[`${prefix}EXTENDS`] || void 0,
867
- name: process.env[`${prefix}NAME`] || void 0,
868
- variant: process.env[`${prefix}VARIANT`] || void 0,
869
- namespace: process.env[`${prefix}NAMESPACE`] || void 0,
870
- owner: process.env[`${prefix}OWNER`] || void 0,
871
- bot: {
872
- name: process.env[`${prefix}BOT_NAME`] || void 0,
873
- email: process.env[`${prefix}BOT_EMAIL`] || void 0
874
- },
875
- release: {
876
- banner: {
877
- url: process.env[`${prefix}RELEASE_BANNER_URL`] || void 0,
878
- alt: process.env[`${prefix}RELEASE_BANNER_ALT`] || void 0
879
- },
880
- header: process.env[`${prefix}RELEASE_HEADER`] || void 0,
881
- footer: process.env[`${prefix}RELEASE_FOOTER`] || void 0
882
- },
883
- error: {
884
- codesFile: process.env[`${prefix}ERROR_CODES_FILE`] || void 0,
885
- url: process.env[`${prefix}ERROR_URL`] || void 0
886
- },
887
- socials: {
888
- twitter: process.env[`${prefix}SOCIAL_TWITTER`] || void 0,
889
- discord: process.env[`${prefix}SOCIAL_DISCORD`] || void 0,
890
- telegram: process.env[`${prefix}SOCIAL_TELEGRAM`] || void 0,
891
- slack: process.env[`${prefix}SOCIAL_SLACK`] || void 0,
892
- medium: process.env[`${prefix}SOCIAL_MEDIUM`] || void 0,
893
- github: process.env[`${prefix}SOCIAL_GITHUB`] || void 0
894
- },
895
- organization: process.env[`${prefix}ORG`] || process.env[`${prefix}ORGANIZATION`] || process.env[`${prefix}ORG_NAME`] || process.env[`${prefix}ORGANIZATION_NAME`] ? process.env[`${prefix}ORG_DESCRIPTION`] || process.env[`${prefix}ORGANIZATION_DESCRIPTION`] || process.env[`${prefix}ORG_URL`] || process.env[`${prefix}ORGANIZATION_URL`] || process.env[`${prefix}ORG_LOGO`] || process.env[`${prefix}ORGANIZATION_LOGO`] ? {
896
- name: process.env[`${prefix}ORG`] || process.env[`${prefix}ORGANIZATION`] || process.env[`${prefix}ORG_NAME`] || process.env[`${prefix}ORGANIZATION_NAME`],
897
- description: process.env[`${prefix}ORG_DESCRIPTION`] || process.env[`${prefix}ORGANIZATION_DESCRIPTION`] || void 0,
898
- url: process.env[`${prefix}ORG_URL`] || process.env[`${prefix}ORGANIZATION_URL`] || void 0,
899
- logo: process.env[`${prefix}ORG_LOGO`] || process.env[`${prefix}ORGANIZATION_LOGO`] || void 0,
900
- icon: process.env[`${prefix}ORG_ICON`] || process.env[`${prefix}ORGANIZATION_ICON`] || void 0
901
- } : process.env[`${prefix}ORG`] || process.env[`${prefix}ORGANIZATION`] || process.env[`${prefix}ORG_NAME`] || process.env[`${prefix}ORGANIZATION_NAME`] : void 0,
902
- packageManager: process.env[`${prefix}PACKAGE_MANAGER`] || void 0,
903
- license: process.env[`${prefix}LICENSE`] || void 0,
904
- homepage: process.env[`${prefix}HOMEPAGE`] || void 0,
905
- docs: process.env[`${prefix}DOCS`] || void 0,
906
- portal: process.env[`${prefix}PORTAL`] || void 0,
907
- licensing: process.env[`${prefix}LICENSING`] || void 0,
908
- contact: process.env[`${prefix}CONTACT`] || void 0,
909
- support: process.env[`${prefix}SUPPORT`] || void 0,
910
- timezone: process.env[`${prefix}TIMEZONE`] || process.env.TZ || void 0,
911
- locale: process.env[`${prefix}LOCALE`] || process.env.LOCALE || void 0,
912
- configFile: process.env[`${prefix}WORKSPACE_CONFIG_FILE`] ? correctPaths(process.env[`${prefix}WORKSPACE_CONFIG_FILE`]) : void 0,
913
- workspaceRoot: process.env[`${prefix}WORKSPACE_ROOT`] ? correctPaths(process.env[`${prefix}WORKSPACE_ROOT`]) : void 0,
914
- directories: {
915
- cache: process.env[`${prefix}CACHE_DIR`] ? correctPaths(process.env[`${prefix}CACHE_DIR`]) : process.env[`${prefix}CACHE_DIRECTORY`] ? correctPaths(process.env[`${prefix}CACHE_DIRECTORY`]) : void 0,
916
- data: process.env[`${prefix}DATA_DIR`] ? correctPaths(process.env[`${prefix}DATA_DIR`]) : process.env[`${prefix}DATA_DIRECTORY`] ? correctPaths(process.env[`${prefix}DATA_DIRECTORY`]) : void 0,
917
- config: process.env[`${prefix}CONFIG_DIR`] ? correctPaths(process.env[`${prefix}CONFIG_DIR`]) : process.env[`${prefix}CONFIG_DIRECTORY`] ? correctPaths(process.env[`${prefix}CONFIG_DIRECTORY`]) : void 0,
918
- temp: process.env[`${prefix}TEMP_DIR`] ? correctPaths(process.env[`${prefix}TEMP_DIR`]) : process.env[`${prefix}TEMP_DIRECTORY`] ? correctPaths(process.env[`${prefix}TEMP_DIRECTORY`]) : void 0,
919
- log: process.env[`${prefix}LOG_DIR`] ? correctPaths(process.env[`${prefix}LOG_DIR`]) : process.env[`${prefix}LOG_DIRECTORY`] ? correctPaths(process.env[`${prefix}LOG_DIRECTORY`]) : void 0,
920
- build: process.env[`${prefix}BUILD_DIR`] ? correctPaths(process.env[`${prefix}BUILD_DIR`]) : process.env[`${prefix}BUILD_DIRECTORY`] ? correctPaths(process.env[`${prefix}BUILD_DIRECTORY`]) : void 0
921
- },
922
- skipCache: process.env[`${prefix}SKIP_CACHE`] !== void 0 ? Boolean(process.env[`${prefix}SKIP_CACHE`]) : void 0,
923
- mode: (process.env[`${prefix}MODE`] ?? process.env.NODE_ENV ?? process.env.ENVIRONMENT) || void 0,
924
- // ci:
925
- // process.env[`${prefix}CI`] !== undefined
926
- // ? Boolean(
927
- // process.env[`${prefix}CI`] ??
928
- // process.env.CI ??
929
- // process.env.CONTINUOUS_INTEGRATION
930
- // )
931
- // : undefined,
932
- repository: process.env[`${prefix}REPOSITORY`] || void 0,
933
- branch: process.env[`${prefix}BRANCH`] || void 0,
934
- preid: process.env[`${prefix}PRE_ID`] || void 0,
935
- registry: {
936
- github: process.env[`${prefix}REGISTRY_GITHUB`] || void 0,
937
- npm: process.env[`${prefix}REGISTRY_NPM`] || void 0,
938
- cargo: process.env[`${prefix}REGISTRY_CARGO`] || void 0,
939
- cyclone: process.env[`${prefix}REGISTRY_CYCLONE`] || void 0,
940
- container: process.env[`${prefix}REGISTRY_CONTAINER`] || void 0
941
- },
942
- logLevel: process.env[`${prefix}LOG_LEVEL`] !== null && process.env[`${prefix}LOG_LEVEL`] !== void 0 ? process.env[`${prefix}LOG_LEVEL`] && Number.isSafeInteger(
943
- Number.parseInt(process.env[`${prefix}LOG_LEVEL`])
944
- ) ? getLogLevelLabel(
945
- Number.parseInt(process.env[`${prefix}LOG_LEVEL`])
946
- ) : process.env[`${prefix}LOG_LEVEL`] : void 0,
947
- skipConfigLogging: process.env[`${prefix}SKIP_CONFIG_LOGGING`] !== void 0 ? Boolean(process.env[`${prefix}SKIP_CONFIG_LOGGING`]) : void 0
948
- };
949
- const themeNames = Object.keys(process.env).filter(
950
- (envKey) => envKey.startsWith(`${prefix}COLOR_`) && import_config2.COLOR_KEYS.every(
951
- (colorKey) => !envKey.startsWith(`${prefix}COLOR_LIGHT_${colorKey}`) && !envKey.startsWith(`${prefix}COLOR_DARK_${colorKey}`)
952
- )
953
- );
954
- config.colors = themeNames.length > 0 ? themeNames.reduce(
955
- (ret, themeName) => {
956
- ret[themeName] = getThemeColorsEnv(prefix, themeName);
957
- return ret;
958
- },
959
- {}
960
- ) : getThemeColorsEnv(prefix);
961
- if (config.docs === import_config2.STORM_DEFAULT_DOCS) {
962
- if (config.homepage === import_config2.STORM_DEFAULT_HOMEPAGE) {
963
- config.docs = `${import_config2.STORM_DEFAULT_HOMEPAGE}/projects/${config.name}/docs`;
964
- } else {
965
- config.docs = `${config.homepage}/docs`;
966
- }
967
- }
968
- if (config.licensing === import_config2.STORM_DEFAULT_LICENSING) {
969
- if (config.homepage === import_config2.STORM_DEFAULT_HOMEPAGE) {
970
- config.licensing = `${import_config2.STORM_DEFAULT_HOMEPAGE}/projects/${config.name}/licensing`;
971
- } else {
972
- config.licensing = `${config.homepage}/docs`;
973
- }
974
- }
975
- const serializedConfig = process.env[`${prefix}WORKSPACE_CONFIG`];
976
- if (serializedConfig) {
977
- const parsed = JSON.parse(serializedConfig);
978
- config = {
979
- ...config,
980
- ...parsed,
981
- colors: { ...config.colors, ...parsed.colors },
982
- extensions: { ...config.extensions, ...parsed.extensions }
983
- };
984
- }
985
- return config;
745
+ /**
746
+ * Get the config for the current Storm workspace
747
+ *
748
+ * @returns The config for the current Storm workspace from environment variables
749
+ */
750
+ const getConfigEnv = () => {
751
+ const prefix = "STORM_";
752
+ let config = {
753
+ extends: process.env[`${prefix}EXTENDS`] || void 0,
754
+ name: process.env[`${prefix}NAME`] || void 0,
755
+ variant: process.env[`${prefix}VARIANT`] || void 0,
756
+ namespace: process.env[`${prefix}NAMESPACE`] || void 0,
757
+ owner: process.env[`${prefix}OWNER`] || void 0,
758
+ bot: {
759
+ name: process.env[`${prefix}BOT_NAME`] || void 0,
760
+ email: process.env[`${prefix}BOT_EMAIL`] || void 0
761
+ },
762
+ release: {
763
+ banner: {
764
+ url: process.env[`${prefix}RELEASE_BANNER_URL`] || void 0,
765
+ alt: process.env[`${prefix}RELEASE_BANNER_ALT`] || void 0
766
+ },
767
+ header: process.env[`${prefix}RELEASE_HEADER`] || void 0,
768
+ footer: process.env[`${prefix}RELEASE_FOOTER`] || void 0
769
+ },
770
+ error: {
771
+ codesFile: process.env[`${prefix}ERROR_CODES_FILE`] || void 0,
772
+ url: process.env[`${prefix}ERROR_URL`] || void 0
773
+ },
774
+ socials: {
775
+ twitter: process.env[`${prefix}SOCIAL_TWITTER`] || void 0,
776
+ discord: process.env[`${prefix}SOCIAL_DISCORD`] || void 0,
777
+ telegram: process.env[`${prefix}SOCIAL_TELEGRAM`] || void 0,
778
+ slack: process.env[`${prefix}SOCIAL_SLACK`] || void 0,
779
+ medium: process.env[`${prefix}SOCIAL_MEDIUM`] || void 0,
780
+ github: process.env[`${prefix}SOCIAL_GITHUB`] || void 0
781
+ },
782
+ organization: process.env[`${prefix}ORG`] || process.env[`${prefix}ORGANIZATION`] || process.env[`${prefix}ORG_NAME`] || process.env[`${prefix}ORGANIZATION_NAME`] ? process.env[`${prefix}ORG_DESCRIPTION`] || process.env[`${prefix}ORGANIZATION_DESCRIPTION`] || process.env[`${prefix}ORG_URL`] || process.env[`${prefix}ORGANIZATION_URL`] || process.env[`${prefix}ORG_LOGO`] || process.env[`${prefix}ORGANIZATION_LOGO`] ? {
783
+ name: process.env[`${prefix}ORG`] || process.env[`${prefix}ORGANIZATION`] || process.env[`${prefix}ORG_NAME`] || process.env[`${prefix}ORGANIZATION_NAME`],
784
+ description: process.env[`${prefix}ORG_DESCRIPTION`] || process.env[`${prefix}ORGANIZATION_DESCRIPTION`] || void 0,
785
+ url: process.env[`${prefix}ORG_URL`] || process.env[`${prefix}ORGANIZATION_URL`] || void 0,
786
+ logo: process.env[`${prefix}ORG_LOGO`] || process.env[`${prefix}ORGANIZATION_LOGO`] || void 0,
787
+ icon: process.env[`${prefix}ORG_ICON`] || process.env[`${prefix}ORGANIZATION_ICON`] || void 0
788
+ } : process.env[`${prefix}ORG`] || process.env[`${prefix}ORGANIZATION`] || process.env[`${prefix}ORG_NAME`] || process.env[`${prefix}ORGANIZATION_NAME`] : void 0,
789
+ packageManager: process.env[`${prefix}PACKAGE_MANAGER`] || void 0,
790
+ license: process.env[`${prefix}LICENSE`] || void 0,
791
+ homepage: process.env[`${prefix}HOMEPAGE`] || void 0,
792
+ docs: process.env[`${prefix}DOCS`] || void 0,
793
+ portal: process.env[`${prefix}PORTAL`] || void 0,
794
+ licensing: process.env[`${prefix}LICENSING`] || void 0,
795
+ contact: process.env[`${prefix}CONTACT`] || void 0,
796
+ support: process.env[`${prefix}SUPPORT`] || void 0,
797
+ timezone: process.env[`${prefix}TIMEZONE`] || process.env.TZ || void 0,
798
+ locale: process.env[`${prefix}LOCALE`] || process.env.LOCALE || void 0,
799
+ configFile: process.env[`${prefix}WORKSPACE_CONFIG_FILE`] ? correctPaths(process.env[`${prefix}WORKSPACE_CONFIG_FILE`]) : void 0,
800
+ workspaceRoot: process.env[`${prefix}WORKSPACE_ROOT`] ? correctPaths(process.env[`${prefix}WORKSPACE_ROOT`]) : void 0,
801
+ directories: {
802
+ cache: process.env[`${prefix}CACHE_DIR`] ? correctPaths(process.env[`${prefix}CACHE_DIR`]) : process.env[`${prefix}CACHE_DIRECTORY`] ? correctPaths(process.env[`${prefix}CACHE_DIRECTORY`]) : void 0,
803
+ data: process.env[`${prefix}DATA_DIR`] ? correctPaths(process.env[`${prefix}DATA_DIR`]) : process.env[`${prefix}DATA_DIRECTORY`] ? correctPaths(process.env[`${prefix}DATA_DIRECTORY`]) : void 0,
804
+ config: process.env[`${prefix}CONFIG_DIR`] ? correctPaths(process.env[`${prefix}CONFIG_DIR`]) : process.env[`${prefix}CONFIG_DIRECTORY`] ? correctPaths(process.env[`${prefix}CONFIG_DIRECTORY`]) : void 0,
805
+ temp: process.env[`${prefix}TEMP_DIR`] ? correctPaths(process.env[`${prefix}TEMP_DIR`]) : process.env[`${prefix}TEMP_DIRECTORY`] ? correctPaths(process.env[`${prefix}TEMP_DIRECTORY`]) : void 0,
806
+ log: process.env[`${prefix}LOG_DIR`] ? correctPaths(process.env[`${prefix}LOG_DIR`]) : process.env[`${prefix}LOG_DIRECTORY`] ? correctPaths(process.env[`${prefix}LOG_DIRECTORY`]) : void 0,
807
+ build: process.env[`${prefix}BUILD_DIR`] ? correctPaths(process.env[`${prefix}BUILD_DIR`]) : process.env[`${prefix}BUILD_DIRECTORY`] ? correctPaths(process.env[`${prefix}BUILD_DIRECTORY`]) : void 0
808
+ },
809
+ skipCache: process.env[`${prefix}SKIP_CACHE`] !== void 0 ? Boolean(process.env[`${prefix}SKIP_CACHE`]) : void 0,
810
+ mode: (process.env[`${prefix}MODE`] ?? process.env.NODE_ENV ?? process.env.ENVIRONMENT) || void 0,
811
+ repository: process.env[`${prefix}REPOSITORY`] || void 0,
812
+ branch: process.env[`${prefix}BRANCH`] || void 0,
813
+ preid: process.env[`${prefix}PRE_ID`] || void 0,
814
+ registry: {
815
+ github: process.env[`${prefix}REGISTRY_GITHUB`] || void 0,
816
+ npm: process.env[`${prefix}REGISTRY_NPM`] || void 0,
817
+ cargo: process.env[`${prefix}REGISTRY_CARGO`] || void 0,
818
+ cyclone: process.env[`${prefix}REGISTRY_CYCLONE`] || void 0,
819
+ container: process.env[`${prefix}REGISTRY_CONTAINER`] || void 0
820
+ },
821
+ logLevel: process.env[`${prefix}LOG_LEVEL`] !== null && process.env[`${prefix}LOG_LEVEL`] !== void 0 ? process.env[`${prefix}LOG_LEVEL`] && Number.isSafeInteger(Number.parseInt(process.env[`${prefix}LOG_LEVEL`])) ? getLogLevelLabel(Number.parseInt(process.env[`${prefix}LOG_LEVEL`])) : process.env[`${prefix}LOG_LEVEL`] : void 0,
822
+ skipConfigLogging: process.env[`${prefix}SKIP_CONFIG_LOGGING`] !== void 0 ? Boolean(process.env[`${prefix}SKIP_CONFIG_LOGGING`]) : void 0
823
+ };
824
+ const themeNames = Object.keys(process.env).filter((envKey) => envKey.startsWith(`${prefix}COLOR_`) && _storm_software_config.COLOR_KEYS.every((colorKey) => !envKey.startsWith(`${prefix}COLOR_LIGHT_${colorKey}`) && !envKey.startsWith(`${prefix}COLOR_DARK_${colorKey}`)));
825
+ config.colors = themeNames.length > 0 ? themeNames.reduce((ret, themeName) => {
826
+ ret[themeName] = getThemeColorsEnv(prefix, themeName);
827
+ return ret;
828
+ }, {}) : getThemeColorsEnv(prefix);
829
+ if (config.docs === _storm_software_config.STORM_DEFAULT_DOCS) {
830
+ if (config.homepage === _storm_software_config.STORM_DEFAULT_HOMEPAGE) config.docs = `${_storm_software_config.STORM_DEFAULT_HOMEPAGE}/projects/${config.name}/docs`;
831
+ else config.docs = `${config.homepage}/docs`;
832
+ }
833
+ if (config.licensing === _storm_software_config.STORM_DEFAULT_LICENSING) {
834
+ if (config.homepage === _storm_software_config.STORM_DEFAULT_HOMEPAGE) config.licensing = `${_storm_software_config.STORM_DEFAULT_HOMEPAGE}/projects/${config.name}/licensing`;
835
+ else config.licensing = `${config.homepage}/docs`;
836
+ }
837
+ const serializedConfig = process.env[`${prefix}WORKSPACE_CONFIG`];
838
+ if (serializedConfig) {
839
+ const parsed = JSON.parse(serializedConfig);
840
+ config = {
841
+ ...config,
842
+ ...parsed,
843
+ colors: {
844
+ ...config.colors,
845
+ ...parsed.colors
846
+ },
847
+ extensions: {
848
+ ...config.extensions,
849
+ ...parsed.extensions
850
+ }
851
+ };
852
+ }
853
+ return config;
986
854
  };
987
- var getThemeColorsEnv = (prefix, theme) => {
988
- const themeName = `COLOR_${theme && theme !== "base" ? `${theme}_` : ""}`.toUpperCase();
989
- return process.env[`${prefix}${themeName}LIGHT_BRAND`] || process.env[`${prefix}${themeName}DARK_BRAND`] ? getMultiThemeColorsEnv(prefix + themeName) : getSingleThemeColorsEnv(prefix + themeName);
855
+ const getThemeColorsEnv = (prefix, theme) => {
856
+ const themeName = `COLOR_${theme && theme !== "base" ? `${theme}_` : ""}`.toUpperCase();
857
+ return process.env[`${prefix}${themeName}LIGHT_BRAND`] || process.env[`${prefix}${themeName}DARK_BRAND`] ? getMultiThemeColorsEnv(prefix + themeName) : getSingleThemeColorsEnv(prefix + themeName);
990
858
  };
991
- var getSingleThemeColorsEnv = (prefix) => {
992
- const gradient = [];
993
- if (process.env[`${prefix}GRADIENT_START`] && process.env[`${prefix}GRADIENT_END`]) {
994
- gradient.push(
995
- process.env[`${prefix}GRADIENT_START`],
996
- process.env[`${prefix}GRADIENT_END`]
997
- );
998
- } else if (process.env[`${prefix}GRADIENT_0`] || process.env[`${prefix}GRADIENT_1`]) {
999
- let index = process.env[`${prefix}GRADIENT_0`] ? 0 : 1;
1000
- while (process.env[`${prefix}GRADIENT_${index}`]) {
1001
- gradient.push(process.env[`${prefix}GRADIENT_${index}`]);
1002
- index++;
1003
- }
1004
- }
1005
- return {
1006
- dark: process.env[`${prefix}DARK`],
1007
- light: process.env[`${prefix}LIGHT`],
1008
- brand: process.env[`${prefix}BRAND`],
1009
- alternate: process.env[`${prefix}ALTERNATE`],
1010
- accent: process.env[`${prefix}ACCENT`],
1011
- link: process.env[`${prefix}LINK`],
1012
- discovery: process.env[`${prefix}DISCOVERY`],
1013
- success: process.env[`${prefix}SUCCESS`],
1014
- info: process.env[`${prefix}INFO`],
1015
- debug: process.env[`${prefix}DEBUG`],
1016
- warning: process.env[`${prefix}WARNING`],
1017
- danger: process.env[`${prefix}DANGER`],
1018
- fatal: process.env[`${prefix}FATAL`],
1019
- performance: process.env[`${prefix}PERFORMANCE`],
1020
- positive: process.env[`${prefix}POSITIVE`],
1021
- negative: process.env[`${prefix}NEGATIVE`],
1022
- gradient
1023
- };
859
+ const getSingleThemeColorsEnv = (prefix) => {
860
+ const gradient = [];
861
+ if (process.env[`${prefix}GRADIENT_START`] && process.env[`${prefix}GRADIENT_END`]) gradient.push(process.env[`${prefix}GRADIENT_START`], process.env[`${prefix}GRADIENT_END`]);
862
+ else if (process.env[`${prefix}GRADIENT_0`] || process.env[`${prefix}GRADIENT_1`]) {
863
+ let index = process.env[`${prefix}GRADIENT_0`] ? 0 : 1;
864
+ while (process.env[`${prefix}GRADIENT_${index}`]) {
865
+ gradient.push(process.env[`${prefix}GRADIENT_${index}`]);
866
+ index++;
867
+ }
868
+ }
869
+ return {
870
+ dark: process.env[`${prefix}DARK`],
871
+ light: process.env[`${prefix}LIGHT`],
872
+ brand: process.env[`${prefix}BRAND`],
873
+ alternate: process.env[`${prefix}ALTERNATE`],
874
+ accent: process.env[`${prefix}ACCENT`],
875
+ link: process.env[`${prefix}LINK`],
876
+ discovery: process.env[`${prefix}DISCOVERY`],
877
+ success: process.env[`${prefix}SUCCESS`],
878
+ info: process.env[`${prefix}INFO`],
879
+ debug: process.env[`${prefix}DEBUG`],
880
+ warning: process.env[`${prefix}WARNING`],
881
+ danger: process.env[`${prefix}DANGER`],
882
+ fatal: process.env[`${prefix}FATAL`],
883
+ performance: process.env[`${prefix}PERFORMANCE`],
884
+ positive: process.env[`${prefix}POSITIVE`],
885
+ negative: process.env[`${prefix}NEGATIVE`],
886
+ gradient
887
+ };
1024
888
  };
1025
- var getMultiThemeColorsEnv = (prefix) => {
1026
- return {
1027
- light: getBaseThemeColorsEnv(`${prefix}_LIGHT_`),
1028
- dark: getBaseThemeColorsEnv(`${prefix}_DARK_`)
1029
- };
889
+ const getMultiThemeColorsEnv = (prefix) => {
890
+ return {
891
+ light: getBaseThemeColorsEnv(`${prefix}_LIGHT_`),
892
+ dark: getBaseThemeColorsEnv(`${prefix}_DARK_`)
893
+ };
1030
894
  };
1031
- var getBaseThemeColorsEnv = (prefix) => {
1032
- const gradient = [];
1033
- if (process.env[`${prefix}GRADIENT_START`] && process.env[`${prefix}GRADIENT_END`]) {
1034
- gradient.push(
1035
- process.env[`${prefix}GRADIENT_START`],
1036
- process.env[`${prefix}GRADIENT_END`]
1037
- );
1038
- } else if (process.env[`${prefix}GRADIENT_0`] || process.env[`${prefix}GRADIENT_1`]) {
1039
- let index = process.env[`${prefix}GRADIENT_0`] ? 0 : 1;
1040
- while (process.env[`${prefix}GRADIENT_${index}`]) {
1041
- gradient.push(process.env[`${prefix}GRADIENT_${index}`]);
1042
- index++;
1043
- }
1044
- }
1045
- return {
1046
- foreground: process.env[`${prefix}FOREGROUND`],
1047
- background: process.env[`${prefix}BACKGROUND`],
1048
- brand: process.env[`${prefix}BRAND`],
1049
- alternate: process.env[`${prefix}ALTERNATE`],
1050
- accent: process.env[`${prefix}ACCENT`],
1051
- link: process.env[`${prefix}LINK`],
1052
- discovery: process.env[`${prefix}DISCOVERY`],
1053
- success: process.env[`${prefix}SUCCESS`],
1054
- info: process.env[`${prefix}INFO`],
1055
- debug: process.env[`${prefix}DEBUG`],
1056
- warning: process.env[`${prefix}WARNING`],
1057
- danger: process.env[`${prefix}DANGER`],
1058
- fatal: process.env[`${prefix}FATAL`],
1059
- performance: process.env[`${prefix}PERFORMANCE`],
1060
- positive: process.env[`${prefix}POSITIVE`],
1061
- negative: process.env[`${prefix}NEGATIVE`],
1062
- gradient
1063
- };
895
+ const getBaseThemeColorsEnv = (prefix) => {
896
+ const gradient = [];
897
+ if (process.env[`${prefix}GRADIENT_START`] && process.env[`${prefix}GRADIENT_END`]) gradient.push(process.env[`${prefix}GRADIENT_START`], process.env[`${prefix}GRADIENT_END`]);
898
+ else if (process.env[`${prefix}GRADIENT_0`] || process.env[`${prefix}GRADIENT_1`]) {
899
+ let index = process.env[`${prefix}GRADIENT_0`] ? 0 : 1;
900
+ while (process.env[`${prefix}GRADIENT_${index}`]) {
901
+ gradient.push(process.env[`${prefix}GRADIENT_${index}`]);
902
+ index++;
903
+ }
904
+ }
905
+ return {
906
+ foreground: process.env[`${prefix}FOREGROUND`],
907
+ background: process.env[`${prefix}BACKGROUND`],
908
+ brand: process.env[`${prefix}BRAND`],
909
+ alternate: process.env[`${prefix}ALTERNATE`],
910
+ accent: process.env[`${prefix}ACCENT`],
911
+ link: process.env[`${prefix}LINK`],
912
+ discovery: process.env[`${prefix}DISCOVERY`],
913
+ success: process.env[`${prefix}SUCCESS`],
914
+ info: process.env[`${prefix}INFO`],
915
+ debug: process.env[`${prefix}DEBUG`],
916
+ warning: process.env[`${prefix}WARNING`],
917
+ danger: process.env[`${prefix}DANGER`],
918
+ fatal: process.env[`${prefix}FATAL`],
919
+ performance: process.env[`${prefix}PERFORMANCE`],
920
+ positive: process.env[`${prefix}POSITIVE`],
921
+ negative: process.env[`${prefix}NEGATIVE`],
922
+ gradient
923
+ };
1064
924
  };
1065
-
1066
- // src/env/set-env.ts
1067
- var setExtensionEnv = (extensionName, extension) => {
1068
- for (const key of Object.keys(extension ?? {})) {
1069
- if (extension[key]) {
1070
- const result = key?.replace(
1071
- /([A-Z])+/g,
1072
- (input) => input ? input[0]?.toUpperCase() + input.slice(1) : ""
1073
- ).split(/(?=[A-Z])|[.\-\s_]/).map((x) => x.toLowerCase()) ?? [];
1074
- let extensionKey;
1075
- if (result.length === 0) {
1076
- return;
1077
- }
1078
- if (result.length === 1) {
1079
- extensionKey = result[0]?.toUpperCase() ?? "";
1080
- } else {
1081
- extensionKey = result.reduce((ret, part) => {
1082
- return `${ret}_${part.toLowerCase()}`;
1083
- });
1084
- }
1085
- process.env[`STORM_EXTENSION_${extensionName.toUpperCase()}_${extensionKey.toUpperCase()}`] = extension[key];
1086
- }
1087
- }
925
+ //#endregion
926
+ //#region src/env/set-env.ts
927
+ /**
928
+ * Get the config for an extension module of Storm workspace from environment variables
929
+ *
930
+ * @param extensionName - The name of the extension module
931
+ * @returns The config for the specified Storm extension module. If the module does not exist, `undefined` is returned.
932
+ */
933
+ const setExtensionEnv = (extensionName, extension) => {
934
+ for (const key of Object.keys(extension ?? {})) if (extension[key]) {
935
+ const result = key?.replace(/([A-Z])+/g, (input) => input ? input[0]?.toUpperCase() + input.slice(1) : "").split(/(?=[A-Z])|[.\-\s_]/).map((x) => x.toLowerCase()) ?? [];
936
+ let extensionKey;
937
+ if (result.length === 0) return;
938
+ if (result.length === 1) extensionKey = result[0]?.toUpperCase() ?? "";
939
+ else extensionKey = result.reduce((ret, part) => {
940
+ return `${ret}_${part.toLowerCase()}`;
941
+ });
942
+ process.env[`STORM_EXTENSION_${extensionName.toUpperCase()}_${extensionKey.toUpperCase()}`] = extension[key];
943
+ }
1088
944
  };
1089
- var setConfigEnv = (config) => {
1090
- const prefix = "STORM_";
1091
- if (config.extends) {
1092
- process.env[`${prefix}EXTENDS`] = Array.isArray(config.extends) ? JSON.stringify(config.extends) : config.extends;
1093
- }
1094
- if (config.name) {
1095
- process.env[`${prefix}NAME`] = config.name;
1096
- }
1097
- if (config.variant) {
1098
- process.env[`${prefix}VARIANT`] = config.variant;
1099
- }
1100
- if (config.namespace) {
1101
- process.env[`${prefix}NAMESPACE`] = config.namespace;
1102
- }
1103
- if (config.owner) {
1104
- process.env[`${prefix}OWNER`] = config.owner;
1105
- }
1106
- if (config.bot) {
1107
- process.env[`${prefix}BOT_NAME`] = config.bot.name;
1108
- process.env[`${prefix}BOT_EMAIL`] = config.bot.email;
1109
- }
1110
- if (config.error) {
1111
- process.env[`${prefix}ERROR_CODES_FILE`] = config.error.codesFile;
1112
- process.env[`${prefix}ERROR_URL`] = config.error.url;
1113
- }
1114
- if (config.release) {
1115
- if (config.release.banner) {
1116
- if (typeof config.release.banner === "string") {
1117
- process.env[`${prefix}RELEASE_BANNER`] = config.release.banner;
1118
- process.env[`${prefix}RELEASE_BANNER_URL`] = config.release.banner;
1119
- } else {
1120
- process.env[`${prefix}RELEASE_BANNER`] = config.release.banner.url;
1121
- process.env[`${prefix}RELEASE_BANNER_URL`] = config.release.banner.url;
1122
- process.env[`${prefix}RELEASE_BANNER_ALT`] = config.release.banner.alt;
1123
- }
1124
- }
1125
- process.env[`${prefix}RELEASE_HEADER`] = config.release.header;
1126
- process.env[`${prefix}RELEASE_FOOTER`] = config.release.footer;
1127
- }
1128
- if (config.socials) {
1129
- if (config.socials.twitter) {
1130
- process.env[`${prefix}SOCIAL_TWITTER`] = config.socials.twitter;
1131
- }
1132
- if (config.socials.discord) {
1133
- process.env[`${prefix}SOCIAL_DISCORD`] = config.socials.discord;
1134
- }
1135
- if (config.socials.telegram) {
1136
- process.env[`${prefix}SOCIAL_TELEGRAM`] = config.socials.telegram;
1137
- }
1138
- if (config.socials.slack) {
1139
- process.env[`${prefix}SOCIAL_SLACK`] = config.socials.slack;
1140
- }
1141
- if (config.socials.medium) {
1142
- process.env[`${prefix}SOCIAL_MEDIUM`] = config.socials.medium;
1143
- }
1144
- if (config.socials.github) {
1145
- process.env[`${prefix}SOCIAL_GITHUB`] = config.socials.github;
1146
- }
1147
- }
1148
- if (config.organization) {
1149
- if (typeof config.organization === "string") {
1150
- process.env[`${prefix}ORG`] = config.organization;
1151
- process.env[`${prefix}ORG_NAME`] = config.organization;
1152
- process.env[`${prefix}ORGANIZATION`] = config.organization;
1153
- process.env[`${prefix}ORGANIZATION_NAME`] = config.organization;
1154
- } else {
1155
- process.env[`${prefix}ORG`] = config.organization.name;
1156
- process.env[`${prefix}ORG_NAME`] = config.organization.name;
1157
- process.env[`${prefix}ORGANIZATION`] = config.organization.name;
1158
- process.env[`${prefix}ORGANIZATION_NAME`] = config.organization.name;
1159
- if (config.organization.url) {
1160
- process.env[`${prefix}ORG_URL`] = config.organization.url;
1161
- process.env[`${prefix}ORGANIZATION_URL`] = config.organization.url;
1162
- }
1163
- if (config.organization.description) {
1164
- process.env[`${prefix}ORG_DESCRIPTION`] = config.organization.description;
1165
- process.env[`${prefix}ORGANIZATION_DESCRIPTION`] = config.organization.description;
1166
- }
1167
- if (config.organization.logo) {
1168
- process.env[`${prefix}ORG_LOGO`] = config.organization.logo;
1169
- process.env[`${prefix}ORGANIZATION_LOGO`] = config.organization.logo;
1170
- }
1171
- if (config.organization.icon) {
1172
- process.env[`${prefix}ORG_ICON`] = config.organization.icon;
1173
- process.env[`${prefix}ORGANIZATION_ICON`] = config.organization.icon;
1174
- }
1175
- }
1176
- }
1177
- if (config.packageManager) {
1178
- process.env[`${prefix}PACKAGE_MANAGER`] = config.packageManager;
1179
- }
1180
- if (config.license) {
1181
- process.env[`${prefix}LICENSE`] = config.license;
1182
- }
1183
- if (config.homepage) {
1184
- process.env[`${prefix}HOMEPAGE`] = config.homepage;
1185
- }
1186
- if (config.docs) {
1187
- process.env[`${prefix}DOCS`] = config.docs;
1188
- }
1189
- if (config.portal) {
1190
- process.env[`${prefix}PORTAL`] = config.portal;
1191
- }
1192
- if (config.licensing) {
1193
- process.env[`${prefix}LICENSING`] = config.licensing;
1194
- }
1195
- if (config.contact) {
1196
- process.env[`${prefix}CONTACT`] = config.contact;
1197
- }
1198
- if (config.support) {
1199
- process.env[`${prefix}SUPPORT`] = config.support;
1200
- }
1201
- if (config.timezone) {
1202
- process.env[`${prefix}TIMEZONE`] = config.timezone;
1203
- process.env.TZ = config.timezone;
1204
- process.env.DEFAULT_TIMEZONE = config.timezone;
1205
- process.env.TIMEZONE = config.timezone;
1206
- }
1207
- if (config.locale) {
1208
- process.env[`${prefix}LOCALE`] = config.locale;
1209
- process.env.DEFAULT_LOCALE = config.locale;
1210
- process.env.LOCALE = config.locale;
1211
- process.env.LANG = config.locale ? `${config.locale.replaceAll("-", "_")}.UTF-8` : "en_US.UTF-8";
1212
- }
1213
- if (config.configFile) {
1214
- process.env[`${prefix}WORKSPACE_CONFIG_FILE`] = correctPaths(
1215
- config.configFile
1216
- );
1217
- }
1218
- if (config.workspaceRoot) {
1219
- process.env[`${prefix}WORKSPACE_ROOT`] = correctPaths(config.workspaceRoot);
1220
- process.env.NX_WORKSPACE_ROOT = correctPaths(config.workspaceRoot);
1221
- process.env.NX_WORKSPACE_ROOT_PATH = correctPaths(config.workspaceRoot);
1222
- }
1223
- if (config.directories) {
1224
- if (!config.skipCache && config.directories.cache) {
1225
- process.env[`${prefix}CACHE_DIR`] = correctPaths(
1226
- config.directories.cache
1227
- );
1228
- process.env[`${prefix}CACHE_DIRECTORY`] = process.env[`${prefix}CACHE_DIR`];
1229
- }
1230
- if (config.directories.data) {
1231
- process.env[`${prefix}DATA_DIR`] = correctPaths(config.directories.data);
1232
- process.env[`${prefix}DATA_DIRECTORY`] = process.env[`${prefix}DATA_DIR`];
1233
- }
1234
- if (config.directories.config) {
1235
- process.env[`${prefix}CONFIG_DIR`] = correctPaths(
1236
- config.directories.config
1237
- );
1238
- process.env[`${prefix}CONFIG_DIRECTORY`] = process.env[`${prefix}CONFIG_DIR`];
1239
- }
1240
- if (config.directories.temp) {
1241
- process.env[`${prefix}TEMP_DIR`] = correctPaths(config.directories.temp);
1242
- process.env[`${prefix}TEMP_DIRECTORY`] = process.env[`${prefix}TEMP_DIR`];
1243
- }
1244
- if (config.directories.log) {
1245
- process.env[`${prefix}LOG_DIR`] = correctPaths(config.directories.log);
1246
- process.env[`${prefix}LOG_DIRECTORY`] = process.env[`${prefix}LOG_DIR`];
1247
- }
1248
- if (config.directories.build) {
1249
- process.env[`${prefix}BUILD_DIR`] = correctPaths(
1250
- config.directories.build
1251
- );
1252
- process.env[`${prefix}BUILD_DIRECTORY`] = process.env[`${prefix}BUILD_DIR`];
1253
- }
1254
- }
1255
- if (config.skipCache !== void 0) {
1256
- process.env[`${prefix}SKIP_CACHE`] = String(config.skipCache);
1257
- if (config.skipCache) {
1258
- process.env.NX_SKIP_NX_CACHE ??= String(config.skipCache);
1259
- process.env.NX_CACHE_PROJECT_GRAPH ??= String(config.skipCache);
1260
- }
1261
- }
1262
- if (config.mode) {
1263
- process.env[`${prefix}MODE`] = config.mode;
1264
- process.env.NODE_ENV = config.mode;
1265
- process.env.ENVIRONMENT = config.mode;
1266
- }
1267
- if (config.colors?.base?.light || config.colors?.base?.dark) {
1268
- for (const key of Object.keys(config.colors)) {
1269
- setThemeColorsEnv(`${prefix}COLOR_${key}_`, config.colors[key]);
1270
- }
1271
- } else {
1272
- setThemeColorsEnv(
1273
- `${prefix}COLOR_`,
1274
- config.colors
1275
- );
1276
- }
1277
- if (config.repository) {
1278
- process.env[`${prefix}REPOSITORY`] = config.repository;
1279
- }
1280
- if (config.branch) {
1281
- process.env[`${prefix}BRANCH`] = config.branch;
1282
- }
1283
- if (config.preid) {
1284
- process.env[`${prefix}PRE_ID`] = String(config.preid);
1285
- }
1286
- if (config.registry) {
1287
- if (config.registry.github) {
1288
- process.env[`${prefix}REGISTRY_GITHUB`] = String(config.registry.github);
1289
- }
1290
- if (config.registry.npm) {
1291
- process.env[`${prefix}REGISTRY_NPM`] = String(config.registry.npm);
1292
- }
1293
- if (config.registry.cargo) {
1294
- process.env[`${prefix}REGISTRY_CARGO`] = String(config.registry.cargo);
1295
- }
1296
- if (config.registry.cyclone) {
1297
- process.env[`${prefix}REGISTRY_CYCLONE`] = String(
1298
- config.registry.cyclone
1299
- );
1300
- }
1301
- if (config.registry.container) {
1302
- process.env[`${prefix}REGISTRY_CONTAINER`] = String(
1303
- config.registry.container
1304
- );
1305
- }
1306
- }
1307
- if (config.logLevel) {
1308
- process.env[`${prefix}LOG_LEVEL`] = String(config.logLevel);
1309
- process.env.LOG_LEVEL = String(config.logLevel);
1310
- process.env.NX_VERBOSE_LOGGING = String(
1311
- getLogLevel(config.logLevel) >= LogLevel.DEBUG ? true : false
1312
- );
1313
- process.env.RUST_BACKTRACE = getLogLevel(config.logLevel) >= LogLevel.DEBUG ? "full" : "none";
1314
- }
1315
- if (config.skipConfigLogging !== void 0) {
1316
- process.env[`${prefix}SKIP_CONFIG_LOGGING`] = String(
1317
- config.skipConfigLogging
1318
- );
1319
- }
1320
- process.env[`${prefix}WORKSPACE_CONFIG`] = JSON.stringify(config);
1321
- for (const key of Object.keys(config.extensions ?? {})) {
1322
- if (config.extensions[key] && Object.keys(config.extensions[key])) {
1323
- setExtensionEnv(key, config.extensions[key]);
1324
- }
1325
- }
945
+ /**
946
+ * Get the config for the current Storm workspace
947
+ *
948
+ * @returns The config for the current Storm workspace from environment variables
949
+ */
950
+ const setConfigEnv = (config) => {
951
+ const prefix = "STORM_";
952
+ if (config.extends) process.env[`${prefix}EXTENDS`] = Array.isArray(config.extends) ? JSON.stringify(config.extends) : config.extends;
953
+ if (config.name) process.env[`${prefix}NAME`] = config.name;
954
+ if (config.variant) process.env[`${prefix}VARIANT`] = config.variant;
955
+ if (config.namespace) process.env[`${prefix}NAMESPACE`] = config.namespace;
956
+ if (config.owner) process.env[`${prefix}OWNER`] = config.owner;
957
+ if (config.bot) {
958
+ process.env[`${prefix}BOT_NAME`] = config.bot.name;
959
+ process.env[`${prefix}BOT_EMAIL`] = config.bot.email;
960
+ }
961
+ if (config.error) {
962
+ process.env[`${prefix}ERROR_CODES_FILE`] = config.error.codesFile;
963
+ process.env[`${prefix}ERROR_URL`] = config.error.url;
964
+ }
965
+ if (config.release) {
966
+ if (config.release.banner) {
967
+ if (typeof config.release.banner === "string") {
968
+ process.env[`${prefix}RELEASE_BANNER`] = config.release.banner;
969
+ process.env[`${prefix}RELEASE_BANNER_URL`] = config.release.banner;
970
+ } else {
971
+ process.env[`${prefix}RELEASE_BANNER`] = config.release.banner.url;
972
+ process.env[`${prefix}RELEASE_BANNER_URL`] = config.release.banner.url;
973
+ process.env[`${prefix}RELEASE_BANNER_ALT`] = config.release.banner.alt;
974
+ }
975
+ }
976
+ process.env[`${prefix}RELEASE_HEADER`] = config.release.header;
977
+ process.env[`${prefix}RELEASE_FOOTER`] = config.release.footer;
978
+ }
979
+ if (config.socials) {
980
+ if (config.socials.twitter) process.env[`${prefix}SOCIAL_TWITTER`] = config.socials.twitter;
981
+ if (config.socials.discord) process.env[`${prefix}SOCIAL_DISCORD`] = config.socials.discord;
982
+ if (config.socials.telegram) process.env[`${prefix}SOCIAL_TELEGRAM`] = config.socials.telegram;
983
+ if (config.socials.slack) process.env[`${prefix}SOCIAL_SLACK`] = config.socials.slack;
984
+ if (config.socials.medium) process.env[`${prefix}SOCIAL_MEDIUM`] = config.socials.medium;
985
+ if (config.socials.github) process.env[`${prefix}SOCIAL_GITHUB`] = config.socials.github;
986
+ }
987
+ if (config.organization) {
988
+ if (typeof config.organization === "string") {
989
+ process.env[`${prefix}ORG`] = config.organization;
990
+ process.env[`${prefix}ORG_NAME`] = config.organization;
991
+ process.env[`${prefix}ORGANIZATION`] = config.organization;
992
+ process.env[`${prefix}ORGANIZATION_NAME`] = config.organization;
993
+ } else {
994
+ process.env[`${prefix}ORG`] = config.organization.name;
995
+ process.env[`${prefix}ORG_NAME`] = config.organization.name;
996
+ process.env[`${prefix}ORGANIZATION`] = config.organization.name;
997
+ process.env[`${prefix}ORGANIZATION_NAME`] = config.organization.name;
998
+ if (config.organization.url) {
999
+ process.env[`${prefix}ORG_URL`] = config.organization.url;
1000
+ process.env[`${prefix}ORGANIZATION_URL`] = config.organization.url;
1001
+ }
1002
+ if (config.organization.description) {
1003
+ process.env[`${prefix}ORG_DESCRIPTION`] = config.organization.description;
1004
+ process.env[`${prefix}ORGANIZATION_DESCRIPTION`] = config.organization.description;
1005
+ }
1006
+ if (config.organization.logo) {
1007
+ process.env[`${prefix}ORG_LOGO`] = config.organization.logo;
1008
+ process.env[`${prefix}ORGANIZATION_LOGO`] = config.organization.logo;
1009
+ }
1010
+ if (config.organization.icon) {
1011
+ process.env[`${prefix}ORG_ICON`] = config.organization.icon;
1012
+ process.env[`${prefix}ORGANIZATION_ICON`] = config.organization.icon;
1013
+ }
1014
+ }
1015
+ }
1016
+ if (config.packageManager) process.env[`${prefix}PACKAGE_MANAGER`] = config.packageManager;
1017
+ if (config.license) process.env[`${prefix}LICENSE`] = config.license;
1018
+ if (config.homepage) process.env[`${prefix}HOMEPAGE`] = config.homepage;
1019
+ if (config.docs) process.env[`${prefix}DOCS`] = config.docs;
1020
+ if (config.portal) process.env[`${prefix}PORTAL`] = config.portal;
1021
+ if (config.licensing) process.env[`${prefix}LICENSING`] = config.licensing;
1022
+ if (config.contact) process.env[`${prefix}CONTACT`] = config.contact;
1023
+ if (config.support) process.env[`${prefix}SUPPORT`] = config.support;
1024
+ if (config.timezone) {
1025
+ process.env[`${prefix}TIMEZONE`] = config.timezone;
1026
+ process.env.TZ = config.timezone;
1027
+ process.env.DEFAULT_TIMEZONE = config.timezone;
1028
+ process.env.TIMEZONE = config.timezone;
1029
+ }
1030
+ if (config.locale) {
1031
+ process.env[`${prefix}LOCALE`] = config.locale;
1032
+ process.env.DEFAULT_LOCALE = config.locale;
1033
+ process.env.LOCALE = config.locale;
1034
+ process.env.LANG = config.locale ? `${config.locale.replaceAll("-", "_")}.UTF-8` : "en_US.UTF-8";
1035
+ }
1036
+ if (config.configFile) process.env[`${prefix}WORKSPACE_CONFIG_FILE`] = correctPaths(config.configFile);
1037
+ if (config.workspaceRoot) {
1038
+ process.env[`${prefix}WORKSPACE_ROOT`] = correctPaths(config.workspaceRoot);
1039
+ process.env.NX_WORKSPACE_ROOT = correctPaths(config.workspaceRoot);
1040
+ process.env.NX_WORKSPACE_ROOT_PATH = correctPaths(config.workspaceRoot);
1041
+ }
1042
+ if (config.directories) {
1043
+ if (!config.skipCache && config.directories.cache) {
1044
+ process.env[`${prefix}CACHE_DIR`] = correctPaths(config.directories.cache);
1045
+ process.env[`${prefix}CACHE_DIRECTORY`] = process.env[`${prefix}CACHE_DIR`];
1046
+ }
1047
+ if (config.directories.data) {
1048
+ process.env[`${prefix}DATA_DIR`] = correctPaths(config.directories.data);
1049
+ process.env[`${prefix}DATA_DIRECTORY`] = process.env[`${prefix}DATA_DIR`];
1050
+ }
1051
+ if (config.directories.config) {
1052
+ process.env[`${prefix}CONFIG_DIR`] = correctPaths(config.directories.config);
1053
+ process.env[`${prefix}CONFIG_DIRECTORY`] = process.env[`${prefix}CONFIG_DIR`];
1054
+ }
1055
+ if (config.directories.temp) {
1056
+ process.env[`${prefix}TEMP_DIR`] = correctPaths(config.directories.temp);
1057
+ process.env[`${prefix}TEMP_DIRECTORY`] = process.env[`${prefix}TEMP_DIR`];
1058
+ }
1059
+ if (config.directories.log) {
1060
+ process.env[`${prefix}LOG_DIR`] = correctPaths(config.directories.log);
1061
+ process.env[`${prefix}LOG_DIRECTORY`] = process.env[`${prefix}LOG_DIR`];
1062
+ }
1063
+ if (config.directories.build) {
1064
+ process.env[`${prefix}BUILD_DIR`] = correctPaths(config.directories.build);
1065
+ process.env[`${prefix}BUILD_DIRECTORY`] = process.env[`${prefix}BUILD_DIR`];
1066
+ }
1067
+ }
1068
+ if (config.skipCache !== void 0) {
1069
+ process.env[`${prefix}SKIP_CACHE`] = String(config.skipCache);
1070
+ if (config.skipCache) {
1071
+ process.env.NX_SKIP_NX_CACHE ??= String(config.skipCache);
1072
+ process.env.NX_CACHE_PROJECT_GRAPH ??= String(config.skipCache);
1073
+ }
1074
+ }
1075
+ if (config.mode) {
1076
+ process.env[`${prefix}MODE`] = config.mode;
1077
+ process.env.NODE_ENV = config.mode;
1078
+ process.env.ENVIRONMENT = config.mode;
1079
+ }
1080
+ if (config.colors?.base?.light || config.colors?.base?.dark) for (const key of Object.keys(config.colors)) setThemeColorsEnv(`${prefix}COLOR_${key}_`, config.colors[key]);
1081
+ else setThemeColorsEnv(`${prefix}COLOR_`, config.colors);
1082
+ if (config.repository) process.env[`${prefix}REPOSITORY`] = config.repository;
1083
+ if (config.branch) process.env[`${prefix}BRANCH`] = config.branch;
1084
+ if (config.preid) process.env[`${prefix}PRE_ID`] = String(config.preid);
1085
+ if (config.registry) {
1086
+ if (config.registry.github) process.env[`${prefix}REGISTRY_GITHUB`] = String(config.registry.github);
1087
+ if (config.registry.npm) process.env[`${prefix}REGISTRY_NPM`] = String(config.registry.npm);
1088
+ if (config.registry.cargo) process.env[`${prefix}REGISTRY_CARGO`] = String(config.registry.cargo);
1089
+ if (config.registry.cyclone) process.env[`${prefix}REGISTRY_CYCLONE`] = String(config.registry.cyclone);
1090
+ if (config.registry.container) process.env[`${prefix}REGISTRY_CONTAINER`] = String(config.registry.container);
1091
+ }
1092
+ if (config.logLevel) {
1093
+ process.env[`${prefix}LOG_LEVEL`] = String(config.logLevel);
1094
+ process.env.LOG_LEVEL = String(config.logLevel);
1095
+ process.env.NX_VERBOSE_LOGGING = String(getLogLevel(config.logLevel) >= LogLevel.DEBUG ? true : false);
1096
+ process.env.RUST_BACKTRACE = getLogLevel(config.logLevel) >= LogLevel.DEBUG ? "full" : "none";
1097
+ }
1098
+ if (config.skipConfigLogging !== void 0) process.env[`${prefix}SKIP_CONFIG_LOGGING`] = String(config.skipConfigLogging);
1099
+ process.env[`${prefix}WORKSPACE_CONFIG`] = JSON.stringify(config);
1100
+ for (const key of Object.keys(config.extensions ?? {})) if (config.extensions[key] && Object.keys(config.extensions[key])) setExtensionEnv(key, config.extensions[key]);
1326
1101
  };
1327
- var setThemeColorsEnv = (prefix, config) => {
1328
- return config?.light?.brand || config?.dark?.brand ? setMultiThemeColorsEnv(prefix, config) : setSingleThemeColorsEnv(prefix, config);
1102
+ const setThemeColorsEnv = (prefix, config) => {
1103
+ return config?.light?.brand || config?.dark?.brand ? setMultiThemeColorsEnv(prefix, config) : setSingleThemeColorsEnv(prefix, config);
1329
1104
  };
1330
- var setSingleThemeColorsEnv = (prefix, config) => {
1331
- if (config.dark) {
1332
- process.env[`${prefix}DARK`] = config.dark;
1333
- }
1334
- if (config.light) {
1335
- process.env[`${prefix}LIGHT`] = config.light;
1336
- }
1337
- if (config.brand) {
1338
- process.env[`${prefix}BRAND`] = config.brand;
1339
- }
1340
- if (config.alternate) {
1341
- process.env[`${prefix}ALTERNATE`] = config.alternate;
1342
- }
1343
- if (config.accent) {
1344
- process.env[`${prefix}ACCENT`] = config.accent;
1345
- }
1346
- if (config.link) {
1347
- process.env[`${prefix}LINK`] = config.link;
1348
- }
1349
- if (config.discovery) {
1350
- process.env[`${prefix}DISCOVERY`] = config.discovery;
1351
- }
1352
- if (config.success) {
1353
- process.env[`${prefix}SUCCESS`] = config.success;
1354
- }
1355
- if (config.info) {
1356
- process.env[`${prefix}INFO`] = config.info;
1357
- }
1358
- if (config.debug) {
1359
- process.env[`${prefix}DEBUG`] = config.debug;
1360
- }
1361
- if (config.warning) {
1362
- process.env[`${prefix}WARNING`] = config.warning;
1363
- }
1364
- if (config.danger) {
1365
- process.env[`${prefix}DANGER`] = config.danger;
1366
- }
1367
- if (config.fatal) {
1368
- process.env[`${prefix}FATAL`] = config.fatal;
1369
- }
1370
- if (config.performance) {
1371
- process.env[`${prefix}PERFORMANCE`] = config.performance;
1372
- }
1373
- if (config.positive) {
1374
- process.env[`${prefix}POSITIVE`] = config.positive;
1375
- }
1376
- if (config.negative) {
1377
- process.env[`${prefix}NEGATIVE`] = config.negative;
1378
- }
1379
- if (config.gradient) {
1380
- for (let i = 0; i < config.gradient.length; i++) {
1381
- process.env[`${prefix}GRADIENT_${i}`] = config.gradient[i];
1382
- }
1383
- }
1105
+ const setSingleThemeColorsEnv = (prefix, config) => {
1106
+ if (config.dark) process.env[`${prefix}DARK`] = config.dark;
1107
+ if (config.light) process.env[`${prefix}LIGHT`] = config.light;
1108
+ if (config.brand) process.env[`${prefix}BRAND`] = config.brand;
1109
+ if (config.alternate) process.env[`${prefix}ALTERNATE`] = config.alternate;
1110
+ if (config.accent) process.env[`${prefix}ACCENT`] = config.accent;
1111
+ if (config.link) process.env[`${prefix}LINK`] = config.link;
1112
+ if (config.discovery) process.env[`${prefix}DISCOVERY`] = config.discovery;
1113
+ if (config.success) process.env[`${prefix}SUCCESS`] = config.success;
1114
+ if (config.info) process.env[`${prefix}INFO`] = config.info;
1115
+ if (config.debug) process.env[`${prefix}DEBUG`] = config.debug;
1116
+ if (config.warning) process.env[`${prefix}WARNING`] = config.warning;
1117
+ if (config.danger) process.env[`${prefix}DANGER`] = config.danger;
1118
+ if (config.fatal) process.env[`${prefix}FATAL`] = config.fatal;
1119
+ if (config.performance) process.env[`${prefix}PERFORMANCE`] = config.performance;
1120
+ if (config.positive) process.env[`${prefix}POSITIVE`] = config.positive;
1121
+ if (config.negative) process.env[`${prefix}NEGATIVE`] = config.negative;
1122
+ if (config.gradient) for (let i = 0; i < config.gradient.length; i++) process.env[`${prefix}GRADIENT_${i}`] = config.gradient[i];
1384
1123
  };
1385
- var setMultiThemeColorsEnv = (prefix, config) => {
1386
- return {
1387
- light: setBaseThemeColorsEnv(`${prefix}LIGHT_`, config.light),
1388
- dark: setBaseThemeColorsEnv(`${prefix}DARK_`, config.dark)
1389
- };
1124
+ const setMultiThemeColorsEnv = (prefix, config) => {
1125
+ return {
1126
+ light: setBaseThemeColorsEnv(`${prefix}LIGHT_`, config.light),
1127
+ dark: setBaseThemeColorsEnv(`${prefix}DARK_`, config.dark)
1128
+ };
1390
1129
  };
1391
- var setBaseThemeColorsEnv = (prefix, config) => {
1392
- if (config.foreground) {
1393
- process.env[`${prefix}FOREGROUND`] = config.foreground;
1394
- }
1395
- if (config.background) {
1396
- process.env[`${prefix}BACKGROUND`] = config.background;
1397
- }
1398
- if (config.brand) {
1399
- process.env[`${prefix}BRAND`] = config.brand;
1400
- }
1401
- if (config.alternate) {
1402
- process.env[`${prefix}ALTERNATE`] = config.alternate;
1403
- }
1404
- if (config.accent) {
1405
- process.env[`${prefix}ACCENT`] = config.accent;
1406
- }
1407
- if (config.link) {
1408
- process.env[`${prefix}LINK`] = config.link;
1409
- }
1410
- if (config.discovery) {
1411
- process.env[`${prefix}DISCOVERY`] = config.discovery;
1412
- }
1413
- if (config.success) {
1414
- process.env[`${prefix}SUCCESS`] = config.success;
1415
- }
1416
- if (config.info) {
1417
- process.env[`${prefix}INFO`] = config.info;
1418
- }
1419
- if (config.debug) {
1420
- process.env[`${prefix}DEBUG`] = config.debug;
1421
- }
1422
- if (config.warning) {
1423
- process.env[`${prefix}WARNING`] = config.warning;
1424
- }
1425
- if (config.danger) {
1426
- process.env[`${prefix}DANGER`] = config.danger;
1427
- }
1428
- if (config.fatal) {
1429
- process.env[`${prefix}FATAL`] = config.fatal;
1430
- }
1431
- if (config.performance) {
1432
- process.env[`${prefix}PERFORMANCE`] = config.performance;
1433
- }
1434
- if (config.positive) {
1435
- process.env[`${prefix}POSITIVE`] = config.positive;
1436
- }
1437
- if (config.negative) {
1438
- process.env[`${prefix}NEGATIVE`] = config.negative;
1439
- }
1440
- if (config.gradient) {
1441
- for (let i = 0; i < config.gradient.length; i++) {
1442
- process.env[`${prefix}GRADIENT_${i}`] = config.gradient[i];
1443
- }
1444
- }
1130
+ const setBaseThemeColorsEnv = (prefix, config) => {
1131
+ if (config.foreground) process.env[`${prefix}FOREGROUND`] = config.foreground;
1132
+ if (config.background) process.env[`${prefix}BACKGROUND`] = config.background;
1133
+ if (config.brand) process.env[`${prefix}BRAND`] = config.brand;
1134
+ if (config.alternate) process.env[`${prefix}ALTERNATE`] = config.alternate;
1135
+ if (config.accent) process.env[`${prefix}ACCENT`] = config.accent;
1136
+ if (config.link) process.env[`${prefix}LINK`] = config.link;
1137
+ if (config.discovery) process.env[`${prefix}DISCOVERY`] = config.discovery;
1138
+ if (config.success) process.env[`${prefix}SUCCESS`] = config.success;
1139
+ if (config.info) process.env[`${prefix}INFO`] = config.info;
1140
+ if (config.debug) process.env[`${prefix}DEBUG`] = config.debug;
1141
+ if (config.warning) process.env[`${prefix}WARNING`] = config.warning;
1142
+ if (config.danger) process.env[`${prefix}DANGER`] = config.danger;
1143
+ if (config.fatal) process.env[`${prefix}FATAL`] = config.fatal;
1144
+ if (config.performance) process.env[`${prefix}PERFORMANCE`] = config.performance;
1145
+ if (config.positive) process.env[`${prefix}POSITIVE`] = config.positive;
1146
+ if (config.negative) process.env[`${prefix}NEGATIVE`] = config.negative;
1147
+ if (config.gradient) for (let i = 0; i < config.gradient.length; i++) process.env[`${prefix}GRADIENT_${i}`] = config.gradient[i];
1445
1148
  };
1149
+ //#endregion
1150
+ //#region src/create-storm-config.ts
1151
+ const _extension_cache = /* @__PURE__ */ new WeakMap();
1152
+ let _static_cache = void 0;
1153
+ /**
1154
+ * Get the config for the current Storm workspace
1155
+ *
1156
+ * @param extensionName - The name of the config extension
1157
+ * @param schema - The schema for the config extension
1158
+ * @param workspaceRoot - The root directory of the workspace
1159
+ * @param skipLogs - Skip writing logs to the console
1160
+ * @param useDefault - Whether to use the default config if no config file is found
1161
+ * @returns The config for the current Storm workspace
1162
+ */
1163
+ const createStormWorkspaceConfig = async (extensionName, schema, workspaceRoot, skipLogs = false, useDefault = true) => {
1164
+ let result;
1165
+ if (!_static_cache?.data || !_static_cache?.timestamp || _static_cache.timestamp < Date.now() - 8e3) {
1166
+ let _workspaceRoot = workspaceRoot;
1167
+ if (!_workspaceRoot) _workspaceRoot = findWorkspaceRoot();
1168
+ const configEnv = getConfigEnv();
1169
+ const configFile = await getConfigFile(_workspaceRoot);
1170
+ if (!configFile) {
1171
+ if (!skipLogs) writeWarning("No Storm Workspace configuration file found in the current repository. Please ensure this is the expected behavior - you can add a `storm-workspace.json` file to the root of your workspace if it is not.\n", { logLevel: "all" });
1172
+ if (useDefault === false) return;
1173
+ }
1174
+ const defaultConfig = await getPackageJsonConfig(_workspaceRoot);
1175
+ const configInput = (0, defu.default)(configEnv, configFile, defaultConfig);
1176
+ if (!configInput.variant) configInput.variant = (0, node_fs.existsSync)(joinPaths(_workspaceRoot, "nx.json")) || (0, node_fs.existsSync)(joinPaths(_workspaceRoot, ".nx")) || (0, node_fs.existsSync)(joinPaths(_workspaceRoot, "lerna.json")) || (0, node_fs.existsSync)(joinPaths(_workspaceRoot, "turbo.json")) ? "monorepo" : "minimal";
1177
+ try {
1178
+ result = applyDefaultConfig((await Promise.resolve(_storm_software_config_schema.workspaceConfigSchema._zod.parse({
1179
+ value: configInput,
1180
+ issues: []
1181
+ }, { async: true }))).value);
1182
+ result.workspaceRoot ??= _workspaceRoot;
1183
+ } catch (error) {
1184
+ throw new Error(`Failed to parse Storm Workspace configuration${error?.message ? `: ${error.message}` : ""}
1446
1185
 
1447
- // src/create-storm-config.ts
1448
- var _extension_cache = /* @__PURE__ */ new WeakMap();
1449
- var _static_cache = void 0;
1450
- var createStormWorkspaceConfig = async (extensionName, schema, workspaceRoot, skipLogs = false, useDefault = true) => {
1451
- let result;
1452
- if (!_static_cache?.data || !_static_cache?.timestamp || _static_cache.timestamp < Date.now() - 8e3) {
1453
- let _workspaceRoot = workspaceRoot;
1454
- if (!_workspaceRoot) {
1455
- _workspaceRoot = findWorkspaceRoot();
1456
- }
1457
- const configEnv = getConfigEnv();
1458
- const configFile = await getConfigFile(_workspaceRoot);
1459
- if (!configFile) {
1460
- if (!skipLogs) {
1461
- writeWarning(
1462
- "No Storm Workspace configuration file found in the current repository. Please ensure this is the expected behavior - you can add a `storm-workspace.json` file to the root of your workspace if it is not.\n",
1463
- { logLevel: "all" }
1464
- );
1465
- }
1466
- if (useDefault === false) {
1467
- return void 0;
1468
- }
1469
- }
1470
- const defaultConfig = await getPackageJsonConfig(_workspaceRoot);
1471
- const configInput = (0, import_defu2.default)(
1472
- configEnv,
1473
- configFile,
1474
- defaultConfig
1475
- );
1476
- if (!configInput.variant) {
1477
- configInput.variant = (0, import_node_fs3.existsSync)(joinPaths(_workspaceRoot, "nx.json")) || (0, import_node_fs3.existsSync)(joinPaths(_workspaceRoot, ".nx")) || (0, import_node_fs3.existsSync)(joinPaths(_workspaceRoot, "lerna.json")) || (0, import_node_fs3.existsSync)(joinPaths(_workspaceRoot, "turbo.json")) ? "monorepo" : "minimal";
1478
- }
1479
- try {
1480
- const parseResult = await Promise.resolve(
1481
- import_schema.workspaceConfigSchema._zod.parse(
1482
- { value: configInput, issues: [] },
1483
- { async: true }
1484
- )
1485
- );
1486
- result = applyDefaultConfig(parseResult.value);
1487
- result.workspaceRoot ??= _workspaceRoot;
1488
- } catch (error) {
1489
- throw new Error(
1490
- `Failed to parse Storm Workspace configuration${error?.message ? `: ${error.message}` : ""}
1491
-
1492
- Please ensure your configuration file is valid JSON and matches the expected schema. The current workspace configuration input is: ${formatLogMessage(
1493
- configInput
1494
- )}`,
1495
- {
1496
- cause: error
1497
- }
1498
- );
1499
- }
1500
- } else {
1501
- result = _static_cache.data;
1502
- }
1503
- if (schema && extensionName) {
1504
- result.extensions = {
1505
- ...result.extensions,
1506
- [extensionName]: createConfigExtension(extensionName, schema)
1507
- };
1508
- }
1509
- _static_cache = {
1510
- timestamp: Date.now(),
1511
- data: result
1512
- };
1513
- return result;
1186
+ Please ensure your configuration file is valid JSON and matches the expected schema. The current workspace configuration input is: ${formatLogMessage(configInput)}`, { cause: error });
1187
+ }
1188
+ } else result = _static_cache.data;
1189
+ if (schema && extensionName) result.extensions = {
1190
+ ...result.extensions,
1191
+ [extensionName]: createConfigExtension(extensionName, schema)
1192
+ };
1193
+ _static_cache = {
1194
+ timestamp: Date.now(),
1195
+ data: result
1196
+ };
1197
+ return result;
1514
1198
  };
1515
- var createConfigExtension = (extensionName, schema) => {
1516
- const extension_cache_key = { extensionName };
1517
- if (_extension_cache.has(extension_cache_key)) {
1518
- return _extension_cache.get(extension_cache_key);
1519
- }
1520
- let extension = getExtensionEnv(extensionName);
1521
- if (schema) {
1522
- extension = schema.parse(extension);
1523
- }
1524
- _extension_cache.set(extension_cache_key, extension);
1525
- return extension;
1199
+ /**
1200
+ * Get the config for a specific Storm config Extension
1201
+ *
1202
+ * @param extensionName - The name of the config extension
1203
+ * @param options - The options for the config extension
1204
+ * @returns The config for the specified Storm config extension. If the extension does not exist, `undefined` is returned.
1205
+ */
1206
+ const createConfigExtension = (extensionName, schema) => {
1207
+ const extension_cache_key = { extensionName };
1208
+ if (_extension_cache.has(extension_cache_key)) return _extension_cache.get(extension_cache_key);
1209
+ let extension = getExtensionEnv(extensionName);
1210
+ if (schema) extension = schema.parse(extension);
1211
+ _extension_cache.set(extension_cache_key, extension);
1212
+ return extension;
1526
1213
  };
1527
- var loadStormWorkspaceConfig = async (workspaceRoot, skipLogs = false) => {
1528
- const config = await createStormWorkspaceConfig(
1529
- void 0,
1530
- void 0,
1531
- workspaceRoot,
1532
- skipLogs,
1533
- true
1534
- );
1535
- setConfigEnv(config);
1536
- if (!skipLogs && !config.skipConfigLogging) {
1537
- writeTrace(
1538
- `\u2699\uFE0F Using Storm Workspace configuration:
1539
- ${formatLogMessage(config)}`,
1540
- config
1541
- );
1542
- }
1543
- return config;
1214
+ /**
1215
+ * Load the config file values for the current Storm workspace into environment variables
1216
+ *
1217
+ * @param workspaceRoot - The root directory of the workspace
1218
+ * @param skipLogs - Skip writing logs to the console
1219
+ * @returns The config for the current Storm workspace, throws an error if the config file could not be loaded
1220
+ */
1221
+ const loadStormWorkspaceConfig = async (workspaceRoot, skipLogs = false) => {
1222
+ const config = await createStormWorkspaceConfig(void 0, void 0, workspaceRoot, skipLogs, true);
1223
+ setConfigEnv(config);
1224
+ if (!skipLogs && !config.skipConfigLogging) writeTrace(`⚙️ Using Storm Workspace configuration: \n${formatLogMessage(config)}`, config);
1225
+ return config;
1544
1226
  };
1545
-
1546
- // src/get-config.ts
1227
+ //#endregion
1228
+ //#region src/get-config.ts
1229
+ /**
1230
+ * Get the config for the current Storm workspace
1231
+ *
1232
+ * @param workspaceRoot - The root directory of the workspace
1233
+ * @param skipLogs - Skip writing logs to the console
1234
+ * @returns The config for the current Storm workspace
1235
+ */
1547
1236
  function getConfig(workspaceRoot, skipLogs = false) {
1548
- return loadStormWorkspaceConfig(workspaceRoot, skipLogs);
1237
+ return loadStormWorkspaceConfig(workspaceRoot, skipLogs);
1549
1238
  }
1550
-
1551
- // bin/config.ts
1239
+ //#endregion
1240
+ //#region bin/config.ts
1552
1241
  function createProgram() {
1553
- writeInfo(`${brandIcon()} Running Storm Configuration Tools`, {
1554
- logLevel: "all"
1555
- });
1556
- const root = findWorkspaceRootSafe(process.cwd());
1557
- process.env.STORM_WORKSPACE_ROOT ??= root;
1558
- process.env.NX_WORKSPACE_ROOT_PATH ??= root;
1559
- if (root) {
1560
- process.chdir(root);
1561
- }
1562
- const program = new import_commander.Command("storm-config");
1563
- program.version("1.0.0", "-v --version", "display CLI version");
1564
- program.command("view", { isDefault: true }).description("View the current Storm configuration for the workspace.").option(
1565
- "-d --dir <path>",
1566
- "A directory that exists inside the workspace root",
1567
- process.cwd()
1568
- ).action(viewAction);
1569
- return program;
1242
+ writeInfo(`${brandIcon()} Running Storm Configuration Tools`, { logLevel: "all" });
1243
+ const root = findWorkspaceRootSafe(process.cwd());
1244
+ process.env.STORM_WORKSPACE_ROOT ??= root;
1245
+ process.env.NX_WORKSPACE_ROOT_PATH ??= root;
1246
+ if (root) process.chdir(root);
1247
+ const program = new commander.Command("storm-config");
1248
+ program.version("1.0.0", "-v --version", "display CLI version");
1249
+ program.command("view", { isDefault: true }).description("View the current Storm configuration for the workspace.").option("-d --dir <path>", "A directory that exists inside the workspace root", process.cwd()).action(viewAction);
1250
+ return program;
1570
1251
  }
1571
1252
  async function viewAction({ dir }) {
1572
- writeInfo(
1573
- `\u{1F50D} Searching for Storm configuration for the workspace at "${dir}"...`,
1574
- {
1575
- logLevel: "all"
1576
- }
1577
- );
1578
- const config = await getConfig(findWorkspaceRootSafe(dir), true);
1579
- if (config) {
1580
- writeSuccess(
1581
- `The following Storm configuration values have been found for this repository:
1253
+ writeInfo(`🔍 Searching for Storm configuration for the workspace at "${dir}"...`, { logLevel: "all" });
1254
+ const config = await getConfig(findWorkspaceRootSafe(dir), true);
1255
+ if (config) writeSuccess(`The following Storm configuration values have been found for this repository:
1582
1256
 
1583
- ${formatLogMessage({ ...config, colors: void 0 })}
1257
+ ${formatLogMessage({
1258
+ ...config,
1259
+ colors: void 0
1260
+ })}
1584
1261
 
1585
1262
  ${typeof config.colors.light === "string" ? formatSingleThemeColors(config.colors) : formatMultiThemeColors(config.colors)}
1586
- `,
1587
- { ...config, logLevel: "all" }
1588
- );
1589
- } else {
1590
- writeError(
1591
- "No Storm config file found in the current workspace. Please ensure this is the expected behavior - you can add a `storm.json` file to the root of your workspace if it is not.\n",
1592
- { logLevel: "all" }
1593
- );
1594
- }
1263
+ `, {
1264
+ ...config,
1265
+ logLevel: "all"
1266
+ });
1267
+ else writeError("No Storm config file found in the current workspace. Please ensure this is the expected behavior - you can add a `storm.json` file to the root of your workspace if it is not.\n", { logLevel: "all" });
1595
1268
  }
1596
- void (async () => {
1597
- try {
1598
- handleProcess();
1599
- const program = createProgram();
1600
- await program.parseAsync(process.argv);
1601
- exitWithSuccess();
1602
- } catch (error) {
1603
- writeFatal(
1604
- `A fatal error occurred while running the Storm Git tool:
1269
+ (async () => {
1270
+ try {
1271
+ handleProcess();
1272
+ await createProgram().parseAsync(process.argv);
1273
+ exitWithSuccess();
1274
+ } catch (error) {
1275
+ writeFatal(`A fatal error occurred while running the Storm Git tool:
1605
1276
  ${error?.message ? error.message : JSON.stringify(error)}${error?.stack ? `
1606
- Stack Trace: ${error.stack}` : ""}`,
1607
- { logLevel: "all" }
1608
- );
1609
- exitWithError();
1610
- process.exit(1);
1611
- }
1277
+ Stack Trace: ${error.stack}` : ""}`, { logLevel: "all" });
1278
+ exitWithError();
1279
+ process.exit(1);
1280
+ }
1612
1281
  })();
1613
- var formatSingleThemeColors = (config) => {
1614
- return `---- Theme Colors ----
1615
- ${Object.entries(config).filter(
1616
- ([key, value]) => key !== "gradient" && typeof value === "string" && value.length > 0
1617
- ).map(
1618
- ([key, value]) => import_chalk3.default.hex(String(value))(`${key}: ${import_chalk3.default.bold(value)}`)
1619
- ).join(" \n")}
1282
+ const formatSingleThemeColors = (config) => {
1283
+ return `---- Theme Colors ----
1284
+ ${Object.entries(config).filter(([key, value]) => key !== "gradient" && typeof value === "string" && value.length > 0).map(([key, value]) => chalk.default.hex(String(value))(`${key}: ${chalk.default.bold(value)}`)).join(" \n")}
1620
1285
  `;
1621
1286
  };
1622
- var formatMultiThemeColors = (config) => {
1623
- return ` ---- Light Theme Colors ----
1624
- ${Object.entries(config.light).filter(
1625
- ([key, value]) => key !== "gradient" && typeof value === "string" && value.length > 0
1626
- ).map(
1627
- ([key, value]) => import_chalk3.default.hex(String(value))(`${key}: ${import_chalk3.default.bold(value)}`)
1628
- ).join(" \n")}
1287
+ const formatMultiThemeColors = (config) => {
1288
+ return ` ---- Light Theme Colors ----
1289
+ ${Object.entries(config.light).filter(([key, value]) => key !== "gradient" && typeof value === "string" && value.length > 0).map(([key, value]) => chalk.default.hex(String(value))(`${key}: ${chalk.default.bold(value)}`)).join(" \n")}
1629
1290
 
1630
1291
  ---- Dark Theme Colors ----
1631
- ${Object.entries(config.dark).filter(
1632
- ([key, value]) => key !== "gradient" && typeof value === "string" && value.length > 0
1633
- ).map(
1634
- ([key, value]) => import_chalk3.default.hex(String(value))(`${key}: ${import_chalk3.default.bold(value)}`)
1635
- ).join(" \n")}
1292
+ ${Object.entries(config.dark).filter(([key, value]) => key !== "gradient" && typeof value === "string" && value.length > 0).map(([key, value]) => chalk.default.hex(String(value))(`${key}: ${chalk.default.bold(value)}`)).join(" \n")}
1636
1293
  `;
1637
1294
  };
1638
- // Annotate the CommonJS export names for ESM import in node:
1639
- 0 && (module.exports = {
1640
- createProgram,
1641
- viewAction
1642
- });
1295
+ //#endregion
1296
+ exports.createProgram = createProgram;
1297
+ exports.viewAction = viewAction;