@storm-software/git-tools 2.123.16 → 2.124.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/README.md +1 -1
  2. package/bin/{chunk-SWXHQXUT.cjs → chunk-AU5PZKTN.cjs} +2 -0
  3. package/bin/chunk-AU5PZKTN.cjs.map +1 -0
  4. package/bin/{chunk-G3JMIIRF.cjs → chunk-EHPPIARR.cjs} +12 -17
  5. package/bin/chunk-EHPPIARR.cjs.map +1 -0
  6. package/bin/{chunk-L64XVBGM.cjs → chunk-FH5OSXAJ.cjs} +2 -0
  7. package/bin/chunk-FH5OSXAJ.cjs.map +1 -0
  8. package/bin/{chunk-S5PS23TL.js → chunk-G3YPGVPS.js} +2 -0
  9. package/bin/chunk-G3YPGVPS.js.map +1 -0
  10. package/bin/{chunk-AMSZ7DVW.js → chunk-Q3DQKTOI.js} +2 -0
  11. package/bin/chunk-Q3DQKTOI.js.map +1 -0
  12. package/bin/{chunk-K3LWFM6S.js → chunk-VBJB46HW.js} +13 -17
  13. package/bin/chunk-VBJB46HW.js.map +1 -0
  14. package/bin/git.cjs +941 -1500
  15. package/bin/git.cjs.map +1 -0
  16. package/bin/git.js +887 -1447
  17. package/bin/git.js.map +1 -0
  18. package/bin/post-checkout.cjs +16 -14
  19. package/bin/post-checkout.cjs.map +1 -0
  20. package/bin/post-checkout.js +5 -3
  21. package/bin/post-checkout.js.map +1 -0
  22. package/bin/post-commit.cjs +16 -14
  23. package/bin/post-commit.cjs.map +1 -0
  24. package/bin/post-commit.js +5 -3
  25. package/bin/post-commit.js.map +1 -0
  26. package/bin/post-merge.cjs +16 -14
  27. package/bin/post-merge.cjs.map +1 -0
  28. package/bin/post-merge.js +5 -3
  29. package/bin/post-merge.js.map +1 -0
  30. package/bin/pre-commit.cjs +14 -12
  31. package/bin/pre-commit.cjs.map +1 -0
  32. package/bin/pre-commit.js +4 -2
  33. package/bin/pre-commit.js.map +1 -0
  34. package/bin/pre-install.cjs +13 -11
  35. package/bin/pre-install.cjs.map +1 -0
  36. package/bin/pre-install.js +4 -2
  37. package/bin/pre-install.js.map +1 -0
  38. package/bin/pre-push.cjs +21 -19
  39. package/bin/pre-push.cjs.map +1 -0
  40. package/bin/pre-push.js +5 -3
  41. package/bin/pre-push.js.map +1 -0
  42. package/bin/prepare.cjs +11 -9
  43. package/bin/prepare.cjs.map +1 -0
  44. package/bin/prepare.js +4 -2
  45. package/bin/prepare.js.map +1 -0
  46. package/bin/version-warning.cjs +9 -7
  47. package/bin/version-warning.cjs.map +1 -0
  48. package/bin/version-warning.js +4 -2
  49. package/bin/version-warning.js.map +1 -0
  50. package/dist/chunk-3GGWHKRP.js +3 -6
  51. package/dist/chunk-4VPJA7YJ.cjs +9 -9
  52. package/dist/chunk-5XU2KBM6.js +1 -3
  53. package/dist/chunk-F7OO6L26.cjs +11 -16
  54. package/dist/chunk-JCEVFJCA.js +4 -14
  55. package/dist/chunk-KZRVQ5RZ.js +3 -11
  56. package/dist/chunk-M4QURF2M.cjs +2454 -0
  57. package/dist/chunk-NY53WLGC.cjs +16 -23
  58. package/dist/chunk-RJCCG4TV.js +2420 -0
  59. package/dist/chunk-YBAE6I5L.cjs +3 -3
  60. package/dist/commit/minimal.cjs +11 -3
  61. package/dist/commit/minimal.js +3 -10
  62. package/dist/commit/monorepo.cjs +11 -3
  63. package/dist/commit/monorepo.d.cts +1 -0
  64. package/dist/commit/monorepo.d.ts +1 -0
  65. package/dist/commit/monorepo.js +4 -11
  66. package/dist/commitlint/minimal.cjs +4 -5
  67. package/dist/commitlint/minimal.js +3 -6
  68. package/dist/commitlint/monorepo.cjs +4 -5
  69. package/dist/commitlint/monorepo.js +3 -6
  70. package/dist/index.cjs +40 -14
  71. package/dist/index.d.cts +4 -3
  72. package/dist/index.d.ts +4 -3
  73. package/dist/index.js +5 -20
  74. package/dist/release/config.cjs +30 -6
  75. package/dist/release/config.d.cts +33 -243
  76. package/dist/release/config.d.ts +33 -243
  77. package/dist/release/config.js +5 -14
  78. package/dist/types.cjs +7 -3
  79. package/dist/types.d.cts +91 -94
  80. package/dist/types.d.ts +91 -94
  81. package/dist/types.js +1 -6
  82. package/package.json +12 -12
  83. package/dist/chunk-GOKUSEH3.cjs +0 -77
  84. package/dist/chunk-YCEUZFMU.js +0 -77
@@ -0,0 +1,2420 @@
1
+ import { DEFAULT_MONOREPO_COMMIT_QUESTIONS } from './chunk-JCEVFJCA.js';
2
+ import { DEFAULT_COMMIT_TYPES } from './chunk-3GGWHKRP.js';
3
+ import defu from 'defu';
4
+ import { loadConfig } from 'c12';
5
+ import chalk from 'chalk';
6
+ import { existsSync } from 'node:fs';
7
+ import { join } from 'node:path';
8
+ import * as z from 'zod/mini';
9
+ import { readFile } from 'node:fs/promises';
10
+ import axios2 from 'axios';
11
+ import DefaultChangelogRenderer from 'nx/release/changelog-renderer';
12
+ import { DEFAULT_CONVENTIONAL_COMMITS_CONFIG } from 'nx/src/command-line/release/config/conventional-commits';
13
+ import { major } from 'semver';
14
+ import '@nx/devkit';
15
+ import 'nx/src/command-line/release/utils/shared';
16
+ import 'nx/src/tasks-runner/utils';
17
+ import 'prettier';
18
+ import 'enquirer';
19
+ import 'node:child_process';
20
+ import 'node:os';
21
+ import 'nx/src/command-line/release/utils/print-changes';
22
+ import 'nx/src/command-line/release/utils/remote-release-clients/github';
23
+ import 'yaml';
24
+
25
+ // ../config-tools/src/utilities/correct-paths.ts
26
+ var _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
27
+ function normalizeWindowsPath(input = "") {
28
+ if (!input) {
29
+ return input;
30
+ }
31
+ return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
32
+ }
33
+ var _UNC_REGEX = /^[/\\]{2}/;
34
+ var _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
35
+ var _DRIVE_LETTER_RE = /^[A-Za-z]:$/;
36
+ var correctPaths = function(path) {
37
+ if (!path || path.length === 0) {
38
+ return ".";
39
+ }
40
+ path = normalizeWindowsPath(path);
41
+ const isUNCPath = path?.match(_UNC_REGEX);
42
+ const isPathAbsolute = isAbsolute(path);
43
+ const trailingSeparator = path[path.length - 1] === "/";
44
+ path = normalizeString(path, !isPathAbsolute);
45
+ if (path.length === 0) {
46
+ if (isPathAbsolute) {
47
+ return "/";
48
+ }
49
+ return trailingSeparator ? "./" : ".";
50
+ }
51
+ if (trailingSeparator) {
52
+ path += "/";
53
+ }
54
+ if (_DRIVE_LETTER_RE.test(path)) {
55
+ path += "/";
56
+ }
57
+ if (isUNCPath) {
58
+ if (!isPathAbsolute) {
59
+ return `//./${path}`;
60
+ }
61
+ return `//${path}`;
62
+ }
63
+ return isPathAbsolute && !isAbsolute(path) ? `/${path}` : path;
64
+ };
65
+ var joinPaths = function(...segments) {
66
+ let path = "";
67
+ for (const seg of segments) {
68
+ if (!seg) {
69
+ continue;
70
+ }
71
+ if (path.length > 0) {
72
+ const pathTrailing = path[path.length - 1] === "/";
73
+ const segLeading = seg[0] === "/";
74
+ const both = pathTrailing && segLeading;
75
+ if (both) {
76
+ path += seg.slice(1);
77
+ } else {
78
+ path += pathTrailing || segLeading ? seg : `/${seg}`;
79
+ }
80
+ } else {
81
+ path += seg;
82
+ }
83
+ }
84
+ return correctPaths(path);
85
+ };
86
+ function normalizeString(path, allowAboveRoot) {
87
+ let res = "";
88
+ let lastSegmentLength = 0;
89
+ let lastSlash = -1;
90
+ let dots = 0;
91
+ let char = null;
92
+ for (let index = 0; index <= path.length; ++index) {
93
+ if (index < path.length) {
94
+ char = path[index];
95
+ } else if (char === "/") {
96
+ break;
97
+ } else {
98
+ char = "/";
99
+ }
100
+ if (char === "/") {
101
+ if (lastSlash === index - 1 || dots === 1) ; else if (dots === 2) {
102
+ if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
103
+ if (res.length > 2) {
104
+ const lastSlashIndex = res.lastIndexOf("/");
105
+ if (lastSlashIndex === -1) {
106
+ res = "";
107
+ lastSegmentLength = 0;
108
+ } else {
109
+ res = res.slice(0, lastSlashIndex);
110
+ lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
111
+ }
112
+ lastSlash = index;
113
+ dots = 0;
114
+ continue;
115
+ } else if (res.length > 0) {
116
+ res = "";
117
+ lastSegmentLength = 0;
118
+ lastSlash = index;
119
+ dots = 0;
120
+ continue;
121
+ }
122
+ }
123
+ if (allowAboveRoot) {
124
+ res += res.length > 0 ? "/.." : "..";
125
+ lastSegmentLength = 2;
126
+ }
127
+ } else {
128
+ if (res.length > 0) {
129
+ res += `/${path.slice(lastSlash + 1, index)}`;
130
+ } else {
131
+ res = path.slice(lastSlash + 1, index);
132
+ }
133
+ lastSegmentLength = index - lastSlash - 1;
134
+ }
135
+ lastSlash = index;
136
+ dots = 0;
137
+ } else if (char === "." && dots !== -1) {
138
+ ++dots;
139
+ } else {
140
+ dots = -1;
141
+ }
142
+ }
143
+ return res;
144
+ }
145
+ var isAbsolute = function(p) {
146
+ return _IS_ABSOLUTE_RE.test(p);
147
+ };
148
+
149
+ // src/utilities/omit.ts
150
+ function omit(obj, keys) {
151
+ const result = { ...obj };
152
+ for (let i = 0; i < keys.length; i++) {
153
+ const key = keys[i];
154
+ if (key && key in result) {
155
+ delete result[key];
156
+ }
157
+ }
158
+ return result;
159
+ }
160
+
161
+ // ../config-tools/src/types.ts
162
+ var LogLevel = {
163
+ SILENT: 0,
164
+ FATAL: 10,
165
+ ERROR: 20,
166
+ WARN: 30,
167
+ SUCCESS: 35,
168
+ INFO: 40,
169
+ DEBUG: 60,
170
+ TRACE: 70,
171
+ ALL: 100
172
+ };
173
+ var LogLevelLabel = {
174
+ SILENT: "silent",
175
+ FATAL: "fatal",
176
+ ERROR: "error",
177
+ WARN: "warn",
178
+ SUCCESS: "success",
179
+ INFO: "info",
180
+ DEBUG: "debug",
181
+ TRACE: "trace",
182
+ ALL: "all"
183
+ };
184
+
185
+ // ../config-tools/src/utilities/colors.ts
186
+ var DEFAULT_COLOR_CONFIG = {
187
+ dark: {
188
+ brand: "#2dd4bf",
189
+ success: "#10b981",
190
+ info: "#58a6ff",
191
+ warning: "#f3d371",
192
+ danger: "#D8314A",
193
+ fatal: "#a40e26"}
194
+ };
195
+ var chalkDefault = {
196
+ hex: (_) => (message) => message,
197
+ bgHex: (_) => ({
198
+ whiteBright: (message) => message,
199
+ white: (message) => message
200
+ }),
201
+ white: (message) => message,
202
+ whiteBright: (message) => message,
203
+ gray: (message) => message,
204
+ bold: {
205
+ hex: (_) => (message) => message,
206
+ bgHex: (_) => ({
207
+ whiteBright: (message) => message,
208
+ white: (message) => message
209
+ }),
210
+ whiteBright: (message) => message,
211
+ white: (message) => message
212
+ },
213
+ dim: {
214
+ hex: (_) => (message) => message,
215
+ gray: (message) => message
216
+ }
217
+ };
218
+ var getChalk = () => {
219
+ let _chalk = chalk;
220
+ if (!_chalk?.hex || !_chalk?.bold?.hex || !_chalk?.bgHex || !_chalk?.whiteBright || !_chalk?.white) {
221
+ _chalk = chalkDefault;
222
+ }
223
+ return _chalk;
224
+ };
225
+
226
+ // ../config-tools/src/logger/is-unicode-supported.ts
227
+ function isUnicodeSupported() {
228
+ if (process.platform !== "win32") {
229
+ return process.env.TERM !== "linux";
230
+ }
231
+ return Boolean(process.env.WT_SESSION) || // Windows Terminal
232
+ Boolean(process.env.TERMINUS_SUBLIME) || // Terminus (<0.2.27)
233
+ process.env.ConEmuTask === "{cmd::Cmder}" || // ConEmu and cmder
234
+ 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";
235
+ }
236
+
237
+ // ../config-tools/src/logger/console-icons.ts
238
+ var useIcon = (c, fallback) => isUnicodeSupported() ? c : fallback;
239
+ var CONSOLE_ICONS = {
240
+ [LogLevelLabel.ERROR]: useIcon("\u2718", "\xD7"),
241
+ [LogLevelLabel.FATAL]: useIcon("\u{1F480}", "\xD7"),
242
+ [LogLevelLabel.WARN]: useIcon("\u26A0", "\u203C"),
243
+ [LogLevelLabel.INFO]: useIcon("\u2139", "i"),
244
+ [LogLevelLabel.SUCCESS]: useIcon("\u2714", "\u221A"),
245
+ [LogLevelLabel.DEBUG]: useIcon("\u{1F6E0}", "D"),
246
+ [LogLevelLabel.TRACE]: useIcon("\u{1F6E0}", "T"),
247
+ [LogLevelLabel.ALL]: useIcon("\u2709", "\u2192")
248
+ };
249
+
250
+ // ../config-tools/src/logger/format-timestamp.ts
251
+ var formatTimestamp = (date = /* @__PURE__ */ new Date()) => {
252
+ return `${date.toLocaleDateString()} ${date.toLocaleTimeString()}`;
253
+ };
254
+
255
+ // ../config-tools/src/logger/get-log-level.ts
256
+ var getLogLevel = (label) => {
257
+ switch (label) {
258
+ case "all":
259
+ return LogLevel.ALL;
260
+ case "trace":
261
+ return LogLevel.TRACE;
262
+ case "debug":
263
+ return LogLevel.DEBUG;
264
+ case "info":
265
+ return LogLevel.INFO;
266
+ case "warn":
267
+ return LogLevel.WARN;
268
+ case "error":
269
+ return LogLevel.ERROR;
270
+ case "fatal":
271
+ return LogLevel.FATAL;
272
+ case "silent":
273
+ return LogLevel.SILENT;
274
+ default:
275
+ return LogLevel.INFO;
276
+ }
277
+ };
278
+ var getLogLevelLabel = (logLevel = LogLevel.INFO) => {
279
+ if (logLevel >= LogLevel.ALL) {
280
+ return LogLevelLabel.ALL;
281
+ }
282
+ if (logLevel >= LogLevel.TRACE) {
283
+ return LogLevelLabel.TRACE;
284
+ }
285
+ if (logLevel >= LogLevel.DEBUG) {
286
+ return LogLevelLabel.DEBUG;
287
+ }
288
+ if (logLevel >= LogLevel.INFO) {
289
+ return LogLevelLabel.INFO;
290
+ }
291
+ if (logLevel >= LogLevel.WARN) {
292
+ return LogLevelLabel.WARN;
293
+ }
294
+ if (logLevel >= LogLevel.ERROR) {
295
+ return LogLevelLabel.ERROR;
296
+ }
297
+ if (logLevel >= LogLevel.FATAL) {
298
+ return LogLevelLabel.FATAL;
299
+ }
300
+ if (logLevel <= LogLevel.SILENT) {
301
+ return LogLevelLabel.SILENT;
302
+ }
303
+ return LogLevelLabel.INFO;
304
+ };
305
+
306
+ // ../config-tools/src/logger/console.ts
307
+ var getLogFn = (logLevel = LogLevel.INFO, config = {}, _chalk = getChalk()) => {
308
+ 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;
309
+ const configLogLevel = config.logLevel || process.env.STORM_LOG_LEVEL || LogLevelLabel.INFO;
310
+ if (logLevel > getLogLevel(configLogLevel) || logLevel <= LogLevel.SILENT || getLogLevel(configLogLevel) <= LogLevel.SILENT) {
311
+ return (_) => {
312
+ };
313
+ }
314
+ if (typeof logLevel === "number" && LogLevel.FATAL >= logLevel) {
315
+ return (message) => {
316
+ console.error(
317
+ `
318
+ ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.fatal ?? DEFAULT_COLOR_CONFIG.dark.fatal)(`[${CONSOLE_ICONS[LogLevelLabel.FATAL]} Fatal] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
319
+ `
320
+ );
321
+ };
322
+ }
323
+ if (typeof logLevel === "number" && LogLevel.ERROR >= logLevel) {
324
+ return (message) => {
325
+ console.error(
326
+ `
327
+ ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.danger ?? DEFAULT_COLOR_CONFIG.dark.danger)(`[${CONSOLE_ICONS[LogLevelLabel.ERROR]} Error] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
328
+ `
329
+ );
330
+ };
331
+ }
332
+ if (typeof logLevel === "number" && LogLevel.WARN >= logLevel) {
333
+ return (message) => {
334
+ console.warn(
335
+ `
336
+ ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.warning ?? DEFAULT_COLOR_CONFIG.dark.warning)(`[${CONSOLE_ICONS[LogLevelLabel.WARN]} Warn] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
337
+ `
338
+ );
339
+ };
340
+ }
341
+ if (typeof logLevel === "number" && LogLevel.SUCCESS >= logLevel) {
342
+ return (message) => {
343
+ console.info(
344
+ `
345
+ ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.success ?? DEFAULT_COLOR_CONFIG.dark.success)(`[${CONSOLE_ICONS[LogLevelLabel.SUCCESS]} Success] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
346
+ `
347
+ );
348
+ };
349
+ }
350
+ if (typeof logLevel === "number" && LogLevel.INFO >= logLevel) {
351
+ return (message) => {
352
+ console.info(
353
+ `
354
+ ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.info ?? DEFAULT_COLOR_CONFIG.dark.info)(`[${CONSOLE_ICONS[LogLevelLabel.INFO]} Info] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
355
+ `
356
+ );
357
+ };
358
+ }
359
+ if (typeof logLevel === "number" && LogLevel.DEBUG >= logLevel) {
360
+ return (message) => {
361
+ console.debug(
362
+ `
363
+ ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.info ?? DEFAULT_COLOR_CONFIG.dark.info)(`[${CONSOLE_ICONS[LogLevelLabel.DEBUG]} Debug] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
364
+ `
365
+ );
366
+ };
367
+ }
368
+ if (typeof logLevel === "number" && LogLevel.TRACE >= logLevel) {
369
+ return (message) => {
370
+ console.debug(
371
+ `
372
+ ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.info ?? DEFAULT_COLOR_CONFIG.dark.info)(`[${CONSOLE_ICONS[LogLevelLabel.TRACE]} Trace] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
373
+ `
374
+ );
375
+ };
376
+ }
377
+ return (message) => {
378
+ console.log(
379
+ `
380
+ ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.brand ?? DEFAULT_COLOR_CONFIG.dark.brand)(`[${CONSOLE_ICONS[LogLevelLabel.ALL]} System] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
381
+ `
382
+ );
383
+ };
384
+ };
385
+ var writeWarning = (message, config) => getLogFn(LogLevel.WARN, config)(message);
386
+ var writeTrace = (message, config) => getLogFn(LogLevel.TRACE, config)(message);
387
+ var MAX_DEPTH = 4;
388
+ var formatLogMessage = (message, options = {}, depth2 = 0) => {
389
+ if (depth2 > MAX_DEPTH) {
390
+ return "<max depth>";
391
+ }
392
+ const prefix = options.prefix ?? "-";
393
+ const skip = options.skip ?? [];
394
+ return typeof message === "undefined" || message === null || !message && typeof message !== "boolean" ? "<none>" : typeof message === "string" ? message : Array.isArray(message) ? `
395
+ ${message.map((item, index) => ` ${prefix}> #${index} = ${formatLogMessage(item, { prefix: `${prefix}-`, skip }, depth2 + 1)}`).join("\n")}` : typeof message === "object" ? `
396
+ ${Object.keys(message).filter((key) => !skip.includes(key)).map(
397
+ (key) => ` ${prefix}> ${key} = ${_isFunction(message[key]) ? "<function>" : typeof message[key] === "object" ? formatLogMessage(
398
+ message[key],
399
+ { prefix: `${prefix}-`, skip },
400
+ depth2 + 1
401
+ ) : message[key]}`
402
+ ).join("\n")}` : message;
403
+ };
404
+ var _isFunction = (value) => {
405
+ try {
406
+ return value instanceof Function || typeof value === "function" || !!(value?.constructor && value?.call && value?.apply);
407
+ } catch {
408
+ return false;
409
+ }
410
+ };
411
+ var MAX_PATH_SEARCH_DEPTH = 30;
412
+ var depth = 0;
413
+ function findFolderUp(startPath, endFileNames = [], endDirectoryNames = []) {
414
+ const _startPath = startPath ?? process.cwd();
415
+ if (endDirectoryNames.some(
416
+ (endDirName) => existsSync(join(_startPath, endDirName))
417
+ )) {
418
+ return _startPath;
419
+ }
420
+ if (endFileNames.some(
421
+ (endFileName) => existsSync(join(_startPath, endFileName))
422
+ )) {
423
+ return _startPath;
424
+ }
425
+ if (_startPath !== "/" && depth++ < MAX_PATH_SEARCH_DEPTH) {
426
+ const parent = join(_startPath, "..");
427
+ return findFolderUp(parent, endFileNames, endDirectoryNames);
428
+ }
429
+ return void 0;
430
+ }
431
+
432
+ // ../config-tools/src/utilities/find-workspace-root.ts
433
+ var rootFiles = [
434
+ "storm-workspace.json",
435
+ "storm-workspace.yaml",
436
+ "storm-workspace.yml",
437
+ "storm-workspace.js",
438
+ "storm-workspace.ts",
439
+ ".storm-workspace.json",
440
+ ".storm-workspace.yaml",
441
+ ".storm-workspace.yml",
442
+ ".storm-workspace.js",
443
+ ".storm-workspace.ts",
444
+ "lerna.json",
445
+ "nx.json",
446
+ "turbo.json",
447
+ "npm-workspace.json",
448
+ "yarn-workspace.json",
449
+ "pnpm-workspace.json",
450
+ "npm-workspace.yaml",
451
+ "yarn-workspace.yaml",
452
+ "pnpm-workspace.yaml",
453
+ "npm-workspace.yml",
454
+ "yarn-workspace.yml",
455
+ "pnpm-workspace.yml",
456
+ "npm-lock.json",
457
+ "yarn-lock.json",
458
+ "pnpm-lock.json",
459
+ "npm-lock.yaml",
460
+ "yarn-lock.yaml",
461
+ "pnpm-lock.yaml",
462
+ "npm-lock.yml",
463
+ "yarn-lock.yml",
464
+ "pnpm-lock.yml",
465
+ "bun.lockb"
466
+ ];
467
+ var rootDirectories = [
468
+ ".storm-workspace",
469
+ ".nx",
470
+ ".git",
471
+ ".github",
472
+ ".vscode",
473
+ ".verdaccio"
474
+ ];
475
+ function findWorkspaceRootSafe(pathInsideMonorepo) {
476
+ if (process.env.STORM_WORKSPACE_ROOT || process.env.NX_WORKSPACE_ROOT_PATH) {
477
+ return correctPaths(
478
+ process.env.STORM_WORKSPACE_ROOT ?? process.env.NX_WORKSPACE_ROOT_PATH
479
+ );
480
+ }
481
+ return correctPaths(
482
+ findFolderUp(
483
+ pathInsideMonorepo ?? process.cwd(),
484
+ rootFiles,
485
+ rootDirectories
486
+ )
487
+ );
488
+ }
489
+ function findWorkspaceRoot(pathInsideMonorepo) {
490
+ const result = findWorkspaceRootSafe(pathInsideMonorepo);
491
+ if (!result) {
492
+ throw new Error(
493
+ `Cannot find workspace root upwards from known path. Files search list includes:
494
+ ${rootFiles.join(
495
+ "\n"
496
+ )}
497
+ Path: ${pathInsideMonorepo ? pathInsideMonorepo : process.cwd()}`
498
+ );
499
+ }
500
+ return result;
501
+ }
502
+
503
+ // ../config/src/constants.ts
504
+ var STORM_DEFAULT_DOCS = "https://docs.stormsoftware.com";
505
+ var STORM_DEFAULT_HOMEPAGE = "https://stormsoftware.com";
506
+ var STORM_DEFAULT_LICENSING = "https://stormsoftware.com/license";
507
+ var STORM_DEFAULT_LICENSE = "Apache-2.0";
508
+ var STORM_DEFAULT_ERROR_CODES_FILE = "tools/errors/codes.json";
509
+ var STORM_DEFAULT_BANNER_ALT = "The workspace's banner image";
510
+ var schemaRegistry = z.registry();
511
+ var colorSchema = z.string().check(
512
+ z.length(7),
513
+ z.toLowerCase(),
514
+ z.regex(/^#([0-9a-f]{3}){1,2}$/i),
515
+ z.trim()
516
+ );
517
+ schemaRegistry.add(colorSchema, {
518
+ description: "A base schema for describing the format of colors"
519
+ });
520
+ var darkColorSchema = z._default(colorSchema, "#151718");
521
+ schemaRegistry.add(darkColorSchema, {
522
+ description: "The dark background color of the workspace"
523
+ });
524
+ var lightColorSchema = z._default(colorSchema, "#cbd5e1");
525
+ schemaRegistry.add(lightColorSchema, {
526
+ description: "The light background color of the workspace"
527
+ });
528
+ var brandColorSchema = z._default(colorSchema, "#1fb2a6");
529
+ schemaRegistry.add(brandColorSchema, {
530
+ description: "The primary brand specific color of the workspace"
531
+ });
532
+ var alternateColorSchema = z.optional(colorSchema);
533
+ schemaRegistry.add(alternateColorSchema, {
534
+ description: "The alternate brand specific color of the workspace"
535
+ });
536
+ var accentColorSchema = z.optional(colorSchema);
537
+ schemaRegistry.add(accentColorSchema, {
538
+ description: "The secondary brand specific color of the workspace"
539
+ });
540
+ var linkColorSchema = z._default(colorSchema, "#3fa6ff");
541
+ schemaRegistry.add(linkColorSchema, {
542
+ description: "The color used to display hyperlink text"
543
+ });
544
+ var helpColorSchema = z._default(colorSchema, "#818cf8");
545
+ schemaRegistry.add(helpColorSchema, {
546
+ description: "The second brand specific color of the workspace"
547
+ });
548
+ var successColorSchema = z._default(colorSchema, "#45b27e");
549
+ schemaRegistry.add(successColorSchema, {
550
+ description: "The success color of the workspace"
551
+ });
552
+ var infoColorSchema = z._default(colorSchema, "#38bdf8");
553
+ schemaRegistry.add(infoColorSchema, {
554
+ description: "The informational color of the workspace"
555
+ });
556
+ var warningColorSchema = z._default(colorSchema, "#f3d371");
557
+ schemaRegistry.add(warningColorSchema, {
558
+ description: "The warning color of the workspace"
559
+ });
560
+ var dangerColorSchema = z._default(colorSchema, "#d8314a");
561
+ schemaRegistry.add(dangerColorSchema, {
562
+ description: "The danger color of the workspace"
563
+ });
564
+ var fatalColorSchema = z.optional(colorSchema);
565
+ schemaRegistry.add(fatalColorSchema, {
566
+ description: "The fatal color of the workspace"
567
+ });
568
+ var positiveColorSchema = z._default(colorSchema, "#4ade80");
569
+ schemaRegistry.add(positiveColorSchema, {
570
+ description: "The positive number color of the workspace"
571
+ });
572
+ var negativeColorSchema = z._default(colorSchema, "#ef4444");
573
+ schemaRegistry.add(negativeColorSchema, {
574
+ description: "The negative number color of the workspace"
575
+ });
576
+ var gradientStopsSchema = z.optional(z.array(colorSchema));
577
+ schemaRegistry.add(gradientStopsSchema, {
578
+ description: "The color stops for the base gradient color pattern used in the workspace"
579
+ });
580
+ var darkColorsSchema = z.object({
581
+ foreground: lightColorSchema,
582
+ background: darkColorSchema,
583
+ brand: brandColorSchema,
584
+ alternate: alternateColorSchema,
585
+ accent: accentColorSchema,
586
+ link: linkColorSchema,
587
+ help: helpColorSchema,
588
+ success: successColorSchema,
589
+ info: infoColorSchema,
590
+ warning: warningColorSchema,
591
+ danger: dangerColorSchema,
592
+ fatal: fatalColorSchema,
593
+ positive: positiveColorSchema,
594
+ negative: negativeColorSchema,
595
+ gradient: gradientStopsSchema
596
+ });
597
+ var lightColorsSchema = z.object({
598
+ foreground: darkColorSchema,
599
+ background: lightColorSchema,
600
+ brand: brandColorSchema,
601
+ alternate: alternateColorSchema,
602
+ accent: accentColorSchema,
603
+ link: linkColorSchema,
604
+ help: helpColorSchema,
605
+ success: successColorSchema,
606
+ info: infoColorSchema,
607
+ warning: warningColorSchema,
608
+ danger: dangerColorSchema,
609
+ fatal: fatalColorSchema,
610
+ positive: positiveColorSchema,
611
+ negative: negativeColorSchema,
612
+ gradient: gradientStopsSchema
613
+ });
614
+ var multiColorsSchema = z.object({
615
+ dark: darkColorsSchema,
616
+ light: lightColorsSchema
617
+ });
618
+ var singleColorsSchema = z.object({
619
+ dark: darkColorSchema,
620
+ light: lightColorSchema,
621
+ brand: brandColorSchema,
622
+ alternate: alternateColorSchema,
623
+ accent: accentColorSchema,
624
+ link: linkColorSchema,
625
+ help: helpColorSchema,
626
+ success: successColorSchema,
627
+ info: infoColorSchema,
628
+ warning: warningColorSchema,
629
+ danger: dangerColorSchema,
630
+ fatal: fatalColorSchema,
631
+ positive: positiveColorSchema,
632
+ negative: negativeColorSchema,
633
+ gradient: gradientStopsSchema
634
+ });
635
+ var registryUrlConfigSchema = z.optional(z.url());
636
+ schemaRegistry.add(registryUrlConfigSchema, {
637
+ description: "A remote registry URL used to publish distributable packages"
638
+ });
639
+ var registrySchema = z._default(
640
+ z.object({
641
+ github: registryUrlConfigSchema,
642
+ npm: registryUrlConfigSchema,
643
+ cargo: registryUrlConfigSchema,
644
+ cyclone: registryUrlConfigSchema,
645
+ container: registryUrlConfigSchema
646
+ }),
647
+ {}
648
+ );
649
+ schemaRegistry.add(registrySchema, {
650
+ description: "A list of remote registry URLs used by Storm Software"
651
+ });
652
+ var colorsSchema = z.union([singleColorsSchema, multiColorsSchema]);
653
+ schemaRegistry.add(colorsSchema, {
654
+ description: "Colors used for various workspace elements"
655
+ });
656
+ var themeColorsSchema = z.record(
657
+ z.union([z.union([z.literal("base"), z.string()]), z.string()]),
658
+ colorsSchema
659
+ );
660
+ schemaRegistry.add(themeColorsSchema, {
661
+ description: "Storm theme config values used for styling various package elements"
662
+ });
663
+ var extendsSchema = z.optional(
664
+ z.union([z.string().check(z.trim()), z.array(z.string().check(z.trim()))])
665
+ );
666
+ schemaRegistry.add(extendsSchema, {
667
+ description: "The path to a base config file to use as a configuration preset file. Documentation can be found at https://github.com/unjs/c12#extending-configuration."
668
+ });
669
+ var workspaceBotNameSchema = z.string().check(z.trim());
670
+ schemaRegistry.add(workspaceBotNameSchema, {
671
+ description: "The workspace bot user's name (this is the bot that will be used to perform various tasks)"
672
+ });
673
+ var workspaceBotEmailSchema = z.string().check(z.trim());
674
+ schemaRegistry.add(workspaceBotEmailSchema, {
675
+ description: "The email of the workspace bot"
676
+ });
677
+ var workspaceBotSchema = z.object({
678
+ name: workspaceBotNameSchema,
679
+ email: workspaceBotEmailSchema
680
+ });
681
+ schemaRegistry.add(workspaceBotSchema, {
682
+ description: "The workspace's bot user's config used to automated various operations tasks"
683
+ });
684
+ var workspaceReleaseBannerUrlSchema = z.optional(
685
+ z.string().check(z.trim(), z.url())
686
+ );
687
+ schemaRegistry.add(workspaceReleaseBannerUrlSchema, {
688
+ description: "A URL to a banner image used to display the workspace's release"
689
+ });
690
+ var workspaceReleaseBannerAltSchema = z._default(
691
+ z.string().check(z.trim()),
692
+ STORM_DEFAULT_BANNER_ALT
693
+ );
694
+ schemaRegistry.add(workspaceReleaseBannerAltSchema, {
695
+ description: "The alt text for the workspace's release banner image"
696
+ });
697
+ var workspaceReleaseBannerSchema = z.object({
698
+ url: workspaceReleaseBannerUrlSchema,
699
+ alt: workspaceReleaseBannerAltSchema
700
+ });
701
+ schemaRegistry.add(workspaceReleaseBannerSchema, {
702
+ description: "The workspace's banner image used during the release process"
703
+ });
704
+ var workspaceReleaseHeaderSchema = z.optional(
705
+ z.string().check(z.trim())
706
+ );
707
+ schemaRegistry.add(workspaceReleaseHeaderSchema, {
708
+ description: "A header message appended to the start of the workspace's release notes"
709
+ });
710
+ var workspaceReleaseFooterSchema = z.optional(
711
+ z.string().check(z.trim())
712
+ );
713
+ schemaRegistry.add(workspaceReleaseFooterSchema, {
714
+ description: "A footer message appended to the end of the workspace's release notes"
715
+ });
716
+ var workspaceReleaseSchema = z.object({
717
+ banner: z.union([
718
+ workspaceReleaseBannerSchema,
719
+ z.string().check(z.trim(), z.url())
720
+ ]),
721
+ header: workspaceReleaseHeaderSchema,
722
+ footer: workspaceReleaseFooterSchema
723
+ });
724
+ schemaRegistry.add(workspaceReleaseSchema, {
725
+ description: "The workspace's release config used during the release process"
726
+ });
727
+ var workspaceSocialsTwitterSchema = z.optional(
728
+ z.string().check(z.trim())
729
+ );
730
+ schemaRegistry.add(workspaceSocialsTwitterSchema, {
731
+ description: "A Twitter/X account associated with the organization/project"
732
+ });
733
+ var workspaceSocialsDiscordSchema = z.optional(
734
+ z.string().check(z.trim())
735
+ );
736
+ schemaRegistry.add(workspaceSocialsDiscordSchema, {
737
+ description: "A Discord account associated with the organization/project"
738
+ });
739
+ var workspaceSocialsTelegramSchema = z.optional(
740
+ z.string().check(z.trim())
741
+ );
742
+ schemaRegistry.add(workspaceSocialsTelegramSchema, {
743
+ description: "A Telegram account associated with the organization/project"
744
+ });
745
+ var workspaceSocialsSlackSchema = z.optional(
746
+ z.string().check(z.trim())
747
+ );
748
+ schemaRegistry.add(workspaceSocialsSlackSchema, {
749
+ description: "A Slack account associated with the organization/project"
750
+ });
751
+ var workspaceSocialsMediumSchema = z.optional(
752
+ z.string().check(z.trim())
753
+ );
754
+ schemaRegistry.add(workspaceSocialsMediumSchema, {
755
+ description: "A Medium account associated with the organization/project"
756
+ });
757
+ var workspaceSocialsGithubSchema = z.optional(
758
+ z.string().check(z.trim())
759
+ );
760
+ schemaRegistry.add(workspaceSocialsGithubSchema, {
761
+ description: "A GitHub account associated with the organization/project"
762
+ });
763
+ var workspaceSocialsSchema = z.object({
764
+ twitter: workspaceSocialsTwitterSchema,
765
+ discord: workspaceSocialsDiscordSchema,
766
+ telegram: workspaceSocialsTelegramSchema,
767
+ slack: workspaceSocialsSlackSchema,
768
+ medium: workspaceSocialsMediumSchema,
769
+ github: workspaceSocialsGithubSchema
770
+ });
771
+ schemaRegistry.add(workspaceSocialsSchema, {
772
+ description: "The workspace's account config used to store various social media links"
773
+ });
774
+ var workspaceDirectoryCacheSchema = z.optional(
775
+ z.string().check(z.trim())
776
+ );
777
+ schemaRegistry.add(workspaceDirectoryCacheSchema, {
778
+ description: "The directory used to store the environment's cached file data"
779
+ });
780
+ var workspaceDirectoryDataSchema = z.optional(
781
+ z.string().check(z.trim())
782
+ );
783
+ schemaRegistry.add(workspaceDirectoryDataSchema, {
784
+ description: "The directory used to store the environment's data files"
785
+ });
786
+ var workspaceDirectoryConfigSchema = z.optional(
787
+ z.string().check(z.trim())
788
+ );
789
+ schemaRegistry.add(workspaceDirectoryConfigSchema, {
790
+ description: "The directory used to store the environment's configuration files"
791
+ });
792
+ var workspaceDirectoryTempSchema = z.optional(
793
+ z.string().check(z.trim())
794
+ );
795
+ schemaRegistry.add(workspaceDirectoryTempSchema, {
796
+ description: "The directory used to store the environment's temp files"
797
+ });
798
+ var workspaceDirectoryLogSchema = z.optional(
799
+ z.string().check(z.trim())
800
+ );
801
+ schemaRegistry.add(workspaceDirectoryLogSchema, {
802
+ description: "The directory used to store the environment's log files"
803
+ });
804
+ var workspaceDirectoryBuildSchema = z._default(
805
+ z.string().check(z.trim()),
806
+ "dist"
807
+ );
808
+ schemaRegistry.add(workspaceDirectoryBuildSchema, {
809
+ description: "The directory used to store the workspace's distributable files after a build (relative to the workspace root)"
810
+ });
811
+ var workspaceDirectorySchema = z.object({
812
+ cache: workspaceDirectoryCacheSchema,
813
+ data: workspaceDirectoryDataSchema,
814
+ config: workspaceDirectoryConfigSchema,
815
+ temp: workspaceDirectoryTempSchema,
816
+ log: workspaceDirectoryLogSchema,
817
+ build: workspaceDirectoryBuildSchema
818
+ });
819
+ schemaRegistry.add(workspaceDirectorySchema, {
820
+ description: "Various directories used by the workspace to store data, cache, and configuration files"
821
+ });
822
+ var variantSchema = z._default(
823
+ z.enum(["minimal", "monorepo"]),
824
+ "monorepo"
825
+ );
826
+ schemaRegistry.add(variantSchema, {
827
+ description: "The variant of the workspace. This can be used to enable or disable certain features or configurations."
828
+ });
829
+ var errorCodesFileSchema = z._default(
830
+ z.string().check(z.trim()),
831
+ STORM_DEFAULT_ERROR_CODES_FILE
832
+ );
833
+ schemaRegistry.add(errorCodesFileSchema, {
834
+ description: "The path to the workspace's error codes JSON file"
835
+ });
836
+ var errorUrlSchema = z.optional(z.url());
837
+ schemaRegistry.add(errorUrlSchema, {
838
+ description: "A URL to a page that looks up the workspace's error messages given a specific error code"
839
+ });
840
+ var errorSchema = z.object({
841
+ codesFile: errorCodesFileSchema,
842
+ url: errorUrlSchema
843
+ });
844
+ schemaRegistry.add(errorSchema, {
845
+ description: "The workspace's error config used when creating error details during a system error"
846
+ });
847
+ var organizationNameSchema = z.optional(
848
+ z.string().check(z.trim(), z.toLowerCase())
849
+ );
850
+ schemaRegistry.add(organizationNameSchema, {
851
+ description: "The name of the organization"
852
+ });
853
+ var organizationDescriptionSchema = z.optional(
854
+ z.string().check(z.trim())
855
+ );
856
+ schemaRegistry.add(organizationDescriptionSchema, {
857
+ description: "A description of the organization"
858
+ });
859
+ var organizationLogoSchema = z.optional(z.url());
860
+ schemaRegistry.add(organizationLogoSchema, {
861
+ description: "A URL to the organization's logo image"
862
+ });
863
+ var organizationIconSchema = z.optional(z.url());
864
+ schemaRegistry.add(organizationIconSchema, {
865
+ description: "A URL to the organization's icon image"
866
+ });
867
+ var organizationUrlSchema = z.optional(z.url());
868
+ schemaRegistry.add(organizationUrlSchema, {
869
+ description: "A URL to a page that provides more information about the organization"
870
+ });
871
+ var organizationSchema = z.object({
872
+ name: organizationNameSchema,
873
+ description: organizationDescriptionSchema,
874
+ logo: organizationLogoSchema,
875
+ icon: organizationIconSchema,
876
+ url: organizationUrlSchema
877
+ });
878
+ schemaRegistry.add(organizationSchema, {
879
+ description: "The workspace's organization details"
880
+ });
881
+ var schemaNameSchema = z._default(
882
+ z.string().check(z.trim(), z.toLowerCase()),
883
+ "https://public.storm-cdn.com/schemas/storm-workspace.schema.json"
884
+ );
885
+ schemaRegistry.add(schemaNameSchema, {
886
+ description: "The URL or file path to the JSON schema file that describes the Storm configuration file"
887
+ });
888
+ var nameSchema = z.string().check(z.trim(), z.toLowerCase());
889
+ schemaRegistry.add(nameSchema, {
890
+ description: "The name of the workspace/project/service/package/scope using this configuration"
891
+ });
892
+ var namespaceSchema = z.string().check(z.trim(), z.toLowerCase());
893
+ schemaRegistry.add(namespaceSchema, {
894
+ description: "The namespace of the workspace/project/service/package/scope using this configuration"
895
+ });
896
+ var orgSchema = z.union([
897
+ organizationSchema,
898
+ z.string().check(z.trim(), z.toLowerCase())
899
+ ]);
900
+ schemaRegistry.add(orgSchema, {
901
+ description: "The organization of the workspace. This can be a string or an object containing the organization's details"
902
+ });
903
+ var repositorySchema = z.string().check(z.trim(), z.toLowerCase());
904
+ schemaRegistry.add(repositorySchema, {
905
+ description: "The repo URL of the workspace (i.e. the GitHub repository URL)"
906
+ });
907
+ var licenseSchema = z._default(
908
+ z.string().check(z.trim()),
909
+ "Apache-2.0"
910
+ );
911
+ schemaRegistry.add(licenseSchema, {
912
+ description: "The license type of the package"
913
+ });
914
+ var homepageSchema = z.optional(z.url());
915
+ schemaRegistry.add(homepageSchema, {
916
+ description: "The homepage of the workspace"
917
+ });
918
+ var docsSchema = z.optional(z.url());
919
+ schemaRegistry.add(docsSchema, {
920
+ description: "The documentation site for the workspace"
921
+ });
922
+ var portalSchema = z.optional(z.url());
923
+ schemaRegistry.add(portalSchema, {
924
+ description: "The development portal site for the workspace"
925
+ });
926
+ var licensingSchema = z.optional(z.url());
927
+ schemaRegistry.add(licensingSchema, {
928
+ description: "The licensing site for the workspace"
929
+ });
930
+ var contactSchema = z.optional(z.url());
931
+ schemaRegistry.add(contactSchema, {
932
+ description: "The contact site for the workspace"
933
+ });
934
+ var supportSchema = z.optional(z.url());
935
+ schemaRegistry.add(supportSchema, {
936
+ description: "The support site for the workspace. If not provided, this is defaulted to the `contact` config value"
937
+ });
938
+ var branchSchema = z._default(
939
+ z.string().check(z.trim(), z.toLowerCase()),
940
+ "main"
941
+ );
942
+ schemaRegistry.add(branchSchema, {
943
+ description: "The branch of the workspace"
944
+ });
945
+ var preidSchema = z.optional(
946
+ z.string().check(z.trim(), z.toLowerCase())
947
+ );
948
+ schemaRegistry.add(preidSchema, {
949
+ description: "A tag specifying the version pre-release identifier"
950
+ });
951
+ var ownerSchema = z.optional(
952
+ z.string().check(z.trim(), z.toLowerCase())
953
+ );
954
+ schemaRegistry.add(ownerSchema, {
955
+ description: "The owner of the package"
956
+ });
957
+ var modeSchema = z._default(
958
+ z.enum(["development", "test", "production"]).check(z.trim(), z.toLowerCase()),
959
+ "production"
960
+ );
961
+ schemaRegistry.add(modeSchema, {
962
+ description: "The current runtime environment mode for the package"
963
+ });
964
+ var workspaceRootSchema = z.string().check(z.trim(), z.toLowerCase());
965
+ schemaRegistry.add(workspaceRootSchema, {
966
+ description: "The root directory of the workspace"
967
+ });
968
+ var skipCacheSchema = z._default(z.boolean(), false);
969
+ schemaRegistry.add(skipCacheSchema, {
970
+ description: "Should all known types of workspace caching be skipped?"
971
+ });
972
+ var packageManagerSchema = z._default(
973
+ z.enum(["npm", "yarn", "pnpm", "bun"]),
974
+ "npm"
975
+ );
976
+ schemaRegistry.add(packageManagerSchema, {
977
+ description: "The JavaScript/TypeScript package manager used by the repository"
978
+ });
979
+ var timezoneSchema = z._default(
980
+ z.string().check(z.trim()),
981
+ "America/New_York"
982
+ );
983
+ schemaRegistry.add(timezoneSchema, {
984
+ description: "The default timezone of the workspace"
985
+ });
986
+ var localeSchema = z._default(z.string().check(z.trim()), "en-US");
987
+ schemaRegistry.add(localeSchema, {
988
+ description: "The default locale of the workspace"
989
+ });
990
+ var logLevelSchema = z._default(
991
+ z.enum([
992
+ "silent",
993
+ "fatal",
994
+ "error",
995
+ "warn",
996
+ "success",
997
+ "info",
998
+ "debug",
999
+ "trace",
1000
+ "all"
1001
+ ]),
1002
+ "info"
1003
+ );
1004
+ schemaRegistry.add(logLevelSchema, {
1005
+ description: "The log level used to filter out lower priority log messages. If not provided, this is defaulted using the `environment` config value (if `environment` is set to `production` then `level` is `error`, else `level` is `debug`)."
1006
+ });
1007
+ var skipConfigLoggingSchema = z._default(z.boolean(), true);
1008
+ schemaRegistry.add(skipConfigLoggingSchema, {
1009
+ description: "Should the logging of the current Storm Workspace configuration be skipped?"
1010
+ });
1011
+ var configFileSchema = z._default(
1012
+ z.nullable(z.string().check(z.trim())),
1013
+ null
1014
+ );
1015
+ schemaRegistry.add(configFileSchema, {
1016
+ description: "The filepath of the Storm config. When this field is null, no config file was found in the current workspace."
1017
+ });
1018
+ var extensionsSchema = z._default(z.record(z.string(), z.any()), {});
1019
+ schemaRegistry.add(extensionsSchema, {
1020
+ description: "Configuration of each used extension"
1021
+ });
1022
+ var workspaceConfigSchema = z.object({
1023
+ $schema: schemaNameSchema,
1024
+ extends: extendsSchema,
1025
+ name: nameSchema,
1026
+ variant: variantSchema,
1027
+ namespace: namespaceSchema,
1028
+ organization: orgSchema,
1029
+ repository: repositorySchema,
1030
+ license: licenseSchema,
1031
+ homepage: homepageSchema,
1032
+ docs: docsSchema,
1033
+ portal: portalSchema,
1034
+ licensing: licensingSchema,
1035
+ contact: contactSchema,
1036
+ support: supportSchema,
1037
+ branch: branchSchema,
1038
+ preid: preidSchema,
1039
+ owner: ownerSchema,
1040
+ bot: workspaceBotSchema,
1041
+ release: workspaceReleaseSchema,
1042
+ socials: workspaceSocialsSchema,
1043
+ error: errorSchema,
1044
+ mode: modeSchema,
1045
+ workspaceRoot: workspaceRootSchema,
1046
+ skipCache: skipCacheSchema,
1047
+ directories: workspaceDirectorySchema,
1048
+ packageManager: packageManagerSchema,
1049
+ timezone: timezoneSchema,
1050
+ locale: localeSchema,
1051
+ logLevel: logLevelSchema,
1052
+ skipConfigLogging: skipConfigLoggingSchema,
1053
+ registry: registrySchema,
1054
+ configFile: configFileSchema,
1055
+ colors: z.union([colorsSchema, themeColorsSchema]),
1056
+ extensions: extensionsSchema
1057
+ });
1058
+ schemaRegistry.add(extensionsSchema, {
1059
+ description: "Storm Workspace config values used during various dev-ops processes. This type is a combination of the StormPackageConfig and StormProject types. It represents the config of the entire monorepo."
1060
+ });
1061
+
1062
+ // ../config/src/types.ts
1063
+ var COLOR_KEYS = [
1064
+ "dark",
1065
+ "light",
1066
+ "base",
1067
+ "brand",
1068
+ "alternate",
1069
+ "accent",
1070
+ "link",
1071
+ "success",
1072
+ "help",
1073
+ "info",
1074
+ "warning",
1075
+ "danger",
1076
+ "fatal",
1077
+ "positive",
1078
+ "negative"
1079
+ ];
1080
+ async function getPackageJsonConfig(root) {
1081
+ let license = STORM_DEFAULT_LICENSE;
1082
+ let homepage = void 0;
1083
+ let support = void 0;
1084
+ let name = void 0;
1085
+ let namespace = void 0;
1086
+ let repository = void 0;
1087
+ const workspaceRoot = findWorkspaceRoot(root);
1088
+ if (existsSync(join(workspaceRoot, "package.json"))) {
1089
+ const file = await readFile(
1090
+ joinPaths(workspaceRoot, "package.json"),
1091
+ "utf8"
1092
+ );
1093
+ if (file) {
1094
+ const packageJson = JSON.parse(file);
1095
+ if (packageJson.name) {
1096
+ name = packageJson.name;
1097
+ }
1098
+ if (packageJson.namespace) {
1099
+ namespace = packageJson.namespace;
1100
+ }
1101
+ if (packageJson.repository) {
1102
+ if (typeof packageJson.repository === "string") {
1103
+ repository = packageJson.repository;
1104
+ } else if (packageJson.repository.url) {
1105
+ repository = packageJson.repository.url;
1106
+ }
1107
+ }
1108
+ if (packageJson.license) {
1109
+ license = packageJson.license;
1110
+ }
1111
+ if (packageJson.homepage) {
1112
+ homepage = packageJson.homepage;
1113
+ }
1114
+ if (packageJson.bugs) {
1115
+ if (typeof packageJson.bugs === "string") {
1116
+ support = packageJson.bugs;
1117
+ } else if (packageJson.bugs.url) {
1118
+ support = packageJson.bugs.url;
1119
+ }
1120
+ }
1121
+ }
1122
+ }
1123
+ return {
1124
+ workspaceRoot,
1125
+ name,
1126
+ namespace,
1127
+ repository,
1128
+ license,
1129
+ homepage,
1130
+ support
1131
+ };
1132
+ }
1133
+ function applyDefaultConfig(config) {
1134
+ if (!config.support && config.contact) {
1135
+ config.support = config.contact;
1136
+ }
1137
+ if (!config.contact && config.support) {
1138
+ config.contact = config.support;
1139
+ }
1140
+ if (config.homepage) {
1141
+ if (!config.docs) {
1142
+ config.docs = `${config.homepage}/docs`;
1143
+ }
1144
+ if (!config.license) {
1145
+ config.license = `${config.homepage}/license`;
1146
+ }
1147
+ if (!config.support) {
1148
+ config.support = `${config.homepage}/support`;
1149
+ }
1150
+ if (!config.contact) {
1151
+ config.contact = `${config.homepage}/contact`;
1152
+ }
1153
+ if (!config.error?.codesFile || !config?.error?.url) {
1154
+ config.error ??= { codesFile: STORM_DEFAULT_ERROR_CODES_FILE };
1155
+ if (config.homepage) {
1156
+ config.error.url ??= `${config.homepage}/errors`;
1157
+ }
1158
+ }
1159
+ }
1160
+ return config;
1161
+ }
1162
+
1163
+ // ../config-tools/src/config-file/get-config-file.ts
1164
+ var getConfigFileByName = async (fileName, filePath, options = {}) => {
1165
+ const workspacePath = filePath || findWorkspaceRoot(filePath);
1166
+ const configs = await Promise.all([
1167
+ loadConfig({
1168
+ cwd: workspacePath,
1169
+ packageJson: true,
1170
+ name: fileName,
1171
+ envName: fileName?.toUpperCase(),
1172
+ jitiOptions: {
1173
+ debug: false,
1174
+ fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : joinPaths(
1175
+ process.env.STORM_CACHE_DIR || "node_modules/.cache/storm",
1176
+ "jiti"
1177
+ )
1178
+ },
1179
+ ...options
1180
+ }),
1181
+ loadConfig({
1182
+ cwd: workspacePath,
1183
+ packageJson: true,
1184
+ name: fileName,
1185
+ envName: fileName?.toUpperCase(),
1186
+ jitiOptions: {
1187
+ debug: false,
1188
+ fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : joinPaths(
1189
+ process.env.STORM_CACHE_DIR || "node_modules/.cache/storm",
1190
+ "jiti"
1191
+ )
1192
+ },
1193
+ configFile: fileName,
1194
+ ...options
1195
+ })
1196
+ ]);
1197
+ return defu(configs[0] ?? {}, configs[1] ?? {});
1198
+ };
1199
+ var getConfigFile = async (filePath, additionalFileNames = []) => {
1200
+ const workspacePath = filePath ? filePath : findWorkspaceRoot(filePath);
1201
+ const result = await getConfigFileByName("storm-workspace", workspacePath);
1202
+ let config = result.config;
1203
+ const configFile = result.configFile;
1204
+ if (config && configFile && Object.keys(config).length > 0 && !config.skipConfigLogging) {
1205
+ writeTrace(
1206
+ `Found Storm configuration file "${configFile.includes(`${workspacePath}/`) ? configFile.replace(`${workspacePath}/`, "") : configFile}" at "${workspacePath}"`,
1207
+ {
1208
+ logLevel: "all"
1209
+ }
1210
+ );
1211
+ }
1212
+ if (additionalFileNames && additionalFileNames.length > 0) {
1213
+ const results = await Promise.all(
1214
+ additionalFileNames.map(
1215
+ (fileName) => getConfigFileByName(fileName, workspacePath)
1216
+ )
1217
+ );
1218
+ for (const result2 of results) {
1219
+ if (result2?.config && result2?.configFile && Object.keys(result2.config).length > 0) {
1220
+ if (!config.skipConfigLogging && !result2.config.skipConfigLogging) {
1221
+ writeTrace(
1222
+ `Found alternative configuration file "${result2.configFile.includes(`${workspacePath}/`) ? result2.configFile.replace(`${workspacePath}/`, "") : result2.configFile}" at "${workspacePath}"`,
1223
+ {
1224
+ logLevel: "all"
1225
+ }
1226
+ );
1227
+ }
1228
+ config = defu(result2.config ?? {}, config ?? {});
1229
+ }
1230
+ }
1231
+ }
1232
+ if (!config || Object.keys(config).length === 0) {
1233
+ return void 0;
1234
+ }
1235
+ config.configFile = configFile;
1236
+ return config;
1237
+ };
1238
+ var getConfigEnv = () => {
1239
+ const prefix = "STORM_";
1240
+ let config = {
1241
+ extends: process.env[`${prefix}EXTENDS`] || void 0,
1242
+ name: process.env[`${prefix}NAME`] || void 0,
1243
+ variant: process.env[`${prefix}VARIANT`] || void 0,
1244
+ namespace: process.env[`${prefix}NAMESPACE`] || void 0,
1245
+ owner: process.env[`${prefix}OWNER`] || void 0,
1246
+ bot: {
1247
+ name: process.env[`${prefix}BOT_NAME`] || void 0,
1248
+ email: process.env[`${prefix}BOT_EMAIL`] || void 0
1249
+ },
1250
+ release: {
1251
+ banner: {
1252
+ url: process.env[`${prefix}RELEASE_BANNER_URL`] || void 0,
1253
+ alt: process.env[`${prefix}RELEASE_BANNER_ALT`] || void 0
1254
+ },
1255
+ header: process.env[`${prefix}RELEASE_HEADER`] || void 0,
1256
+ footer: process.env[`${prefix}RELEASE_FOOTER`] || void 0
1257
+ },
1258
+ error: {
1259
+ codesFile: process.env[`${prefix}ERROR_CODES_FILE`] || void 0,
1260
+ url: process.env[`${prefix}ERROR_URL`] || void 0
1261
+ },
1262
+ socials: {
1263
+ twitter: process.env[`${prefix}SOCIAL_TWITTER`] || void 0,
1264
+ discord: process.env[`${prefix}SOCIAL_DISCORD`] || void 0,
1265
+ telegram: process.env[`${prefix}SOCIAL_TELEGRAM`] || void 0,
1266
+ slack: process.env[`${prefix}SOCIAL_SLACK`] || void 0,
1267
+ medium: process.env[`${prefix}SOCIAL_MEDIUM`] || void 0,
1268
+ github: process.env[`${prefix}SOCIAL_GITHUB`] || void 0
1269
+ },
1270
+ 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`] ? {
1271
+ name: process.env[`${prefix}ORG`] || process.env[`${prefix}ORGANIZATION`] || process.env[`${prefix}ORG_NAME`] || process.env[`${prefix}ORGANIZATION_NAME`],
1272
+ description: process.env[`${prefix}ORG_DESCRIPTION`] || process.env[`${prefix}ORGANIZATION_DESCRIPTION`] || void 0,
1273
+ url: process.env[`${prefix}ORG_URL`] || process.env[`${prefix}ORGANIZATION_URL`] || void 0,
1274
+ logo: process.env[`${prefix}ORG_LOGO`] || process.env[`${prefix}ORGANIZATION_LOGO`] || void 0,
1275
+ icon: process.env[`${prefix}ORG_ICON`] || process.env[`${prefix}ORGANIZATION_ICON`] || void 0
1276
+ } : process.env[`${prefix}ORG`] || process.env[`${prefix}ORGANIZATION`] || process.env[`${prefix}ORG_NAME`] || process.env[`${prefix}ORGANIZATION_NAME`] : void 0,
1277
+ packageManager: process.env[`${prefix}PACKAGE_MANAGER`] || void 0,
1278
+ license: process.env[`${prefix}LICENSE`] || void 0,
1279
+ homepage: process.env[`${prefix}HOMEPAGE`] || void 0,
1280
+ docs: process.env[`${prefix}DOCS`] || void 0,
1281
+ portal: process.env[`${prefix}PORTAL`] || void 0,
1282
+ licensing: process.env[`${prefix}LICENSING`] || void 0,
1283
+ contact: process.env[`${prefix}CONTACT`] || void 0,
1284
+ support: process.env[`${prefix}SUPPORT`] || void 0,
1285
+ timezone: process.env[`${prefix}TIMEZONE`] || process.env.TZ || void 0,
1286
+ locale: process.env[`${prefix}LOCALE`] || process.env.LOCALE || void 0,
1287
+ configFile: process.env[`${prefix}WORKSPACE_CONFIG_FILE`] ? correctPaths(process.env[`${prefix}WORKSPACE_CONFIG_FILE`]) : void 0,
1288
+ workspaceRoot: process.env[`${prefix}WORKSPACE_ROOT`] ? correctPaths(process.env[`${prefix}WORKSPACE_ROOT`]) : void 0,
1289
+ directories: {
1290
+ 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,
1291
+ 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,
1292
+ 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,
1293
+ 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,
1294
+ 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,
1295
+ 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
1296
+ },
1297
+ skipCache: process.env[`${prefix}SKIP_CACHE`] !== void 0 ? Boolean(process.env[`${prefix}SKIP_CACHE`]) : void 0,
1298
+ mode: (process.env[`${prefix}MODE`] ?? process.env.NODE_ENV ?? process.env.ENVIRONMENT) || void 0,
1299
+ // ci:
1300
+ // process.env[`${prefix}CI`] !== undefined
1301
+ // ? Boolean(
1302
+ // process.env[`${prefix}CI`] ??
1303
+ // process.env.CI ??
1304
+ // process.env.CONTINUOUS_INTEGRATION
1305
+ // )
1306
+ // : undefined,
1307
+ repository: process.env[`${prefix}REPOSITORY`] || void 0,
1308
+ branch: process.env[`${prefix}BRANCH`] || void 0,
1309
+ preid: process.env[`${prefix}PRE_ID`] || void 0,
1310
+ registry: {
1311
+ github: process.env[`${prefix}REGISTRY_GITHUB`] || void 0,
1312
+ npm: process.env[`${prefix}REGISTRY_NPM`] || void 0,
1313
+ cargo: process.env[`${prefix}REGISTRY_CARGO`] || void 0,
1314
+ cyclone: process.env[`${prefix}REGISTRY_CYCLONE`] || void 0,
1315
+ container: process.env[`${prefix}REGISTRY_CONTAINER`] || void 0
1316
+ },
1317
+ logLevel: process.env[`${prefix}LOG_LEVEL`] !== null && process.env[`${prefix}LOG_LEVEL`] !== void 0 ? process.env[`${prefix}LOG_LEVEL`] && Number.isSafeInteger(
1318
+ Number.parseInt(process.env[`${prefix}LOG_LEVEL`])
1319
+ ) ? getLogLevelLabel(
1320
+ Number.parseInt(process.env[`${prefix}LOG_LEVEL`])
1321
+ ) : process.env[`${prefix}LOG_LEVEL`] : void 0,
1322
+ skipConfigLogging: process.env[`${prefix}SKIP_CONFIG_LOGGING`] !== void 0 ? Boolean(process.env[`${prefix}SKIP_CONFIG_LOGGING`]) : void 0
1323
+ };
1324
+ const themeNames = Object.keys(process.env).filter(
1325
+ (envKey) => envKey.startsWith(`${prefix}COLOR_`) && COLOR_KEYS.every(
1326
+ (colorKey) => !envKey.startsWith(`${prefix}COLOR_LIGHT_${colorKey}`) && !envKey.startsWith(`${prefix}COLOR_DARK_${colorKey}`)
1327
+ )
1328
+ );
1329
+ config.colors = themeNames.length > 0 ? themeNames.reduce(
1330
+ (ret, themeName) => {
1331
+ ret[themeName] = getThemeColorsEnv(prefix, themeName);
1332
+ return ret;
1333
+ },
1334
+ {}
1335
+ ) : getThemeColorsEnv(prefix);
1336
+ if (config.docs === STORM_DEFAULT_DOCS) {
1337
+ if (config.homepage === STORM_DEFAULT_HOMEPAGE) {
1338
+ config.docs = `${STORM_DEFAULT_HOMEPAGE}/projects/${config.name}/docs`;
1339
+ } else {
1340
+ config.docs = `${config.homepage}/docs`;
1341
+ }
1342
+ }
1343
+ if (config.licensing === STORM_DEFAULT_LICENSING) {
1344
+ if (config.homepage === STORM_DEFAULT_HOMEPAGE) {
1345
+ config.licensing = `${STORM_DEFAULT_HOMEPAGE}/projects/${config.name}/licensing`;
1346
+ } else {
1347
+ config.licensing = `${config.homepage}/docs`;
1348
+ }
1349
+ }
1350
+ const serializedConfig = process.env[`${prefix}WORKSPACE_CONFIG`];
1351
+ if (serializedConfig) {
1352
+ const parsed = JSON.parse(serializedConfig);
1353
+ config = {
1354
+ ...config,
1355
+ ...parsed,
1356
+ colors: { ...config.colors, ...parsed.colors },
1357
+ extensions: { ...config.extensions, ...parsed.extensions }
1358
+ };
1359
+ }
1360
+ return config;
1361
+ };
1362
+ var getThemeColorsEnv = (prefix, theme) => {
1363
+ const themeName = `COLOR_${theme && theme !== "base" ? `${theme}_` : ""}`.toUpperCase();
1364
+ return process.env[`${prefix}${themeName}LIGHT_BRAND`] || process.env[`${prefix}${themeName}DARK_BRAND`] ? getMultiThemeColorsEnv(prefix + themeName) : getSingleThemeColorsEnv(prefix + themeName);
1365
+ };
1366
+ var getSingleThemeColorsEnv = (prefix) => {
1367
+ const gradient = [];
1368
+ if (process.env[`${prefix}GRADIENT_START`] && process.env[`${prefix}GRADIENT_END`]) {
1369
+ gradient.push(
1370
+ process.env[`${prefix}GRADIENT_START`],
1371
+ process.env[`${prefix}GRADIENT_END`]
1372
+ );
1373
+ } else if (process.env[`${prefix}GRADIENT_0`] || process.env[`${prefix}GRADIENT_1`]) {
1374
+ let index = process.env[`${prefix}GRADIENT_0`] ? 0 : 1;
1375
+ while (process.env[`${prefix}GRADIENT_${index}`]) {
1376
+ gradient.push(process.env[`${prefix}GRADIENT_${index}`]);
1377
+ index++;
1378
+ }
1379
+ }
1380
+ return {
1381
+ dark: process.env[`${prefix}DARK`],
1382
+ light: process.env[`${prefix}LIGHT`],
1383
+ brand: process.env[`${prefix}BRAND`],
1384
+ alternate: process.env[`${prefix}ALTERNATE`],
1385
+ accent: process.env[`${prefix}ACCENT`],
1386
+ link: process.env[`${prefix}LINK`],
1387
+ help: process.env[`${prefix}HELP`],
1388
+ success: process.env[`${prefix}SUCCESS`],
1389
+ info: process.env[`${prefix}INFO`],
1390
+ warning: process.env[`${prefix}WARNING`],
1391
+ danger: process.env[`${prefix}DANGER`],
1392
+ fatal: process.env[`${prefix}FATAL`],
1393
+ positive: process.env[`${prefix}POSITIVE`],
1394
+ negative: process.env[`${prefix}NEGATIVE`],
1395
+ gradient
1396
+ };
1397
+ };
1398
+ var getMultiThemeColorsEnv = (prefix) => {
1399
+ return {
1400
+ light: getBaseThemeColorsEnv(`${prefix}_LIGHT_`),
1401
+ dark: getBaseThemeColorsEnv(`${prefix}_DARK_`)
1402
+ };
1403
+ };
1404
+ var getBaseThemeColorsEnv = (prefix) => {
1405
+ const gradient = [];
1406
+ if (process.env[`${prefix}GRADIENT_START`] && process.env[`${prefix}GRADIENT_END`]) {
1407
+ gradient.push(
1408
+ process.env[`${prefix}GRADIENT_START`],
1409
+ process.env[`${prefix}GRADIENT_END`]
1410
+ );
1411
+ } else if (process.env[`${prefix}GRADIENT_0`] || process.env[`${prefix}GRADIENT_1`]) {
1412
+ let index = process.env[`${prefix}GRADIENT_0`] ? 0 : 1;
1413
+ while (process.env[`${prefix}GRADIENT_${index}`]) {
1414
+ gradient.push(process.env[`${prefix}GRADIENT_${index}`]);
1415
+ index++;
1416
+ }
1417
+ }
1418
+ return {
1419
+ foreground: process.env[`${prefix}FOREGROUND`],
1420
+ background: process.env[`${prefix}BACKGROUND`],
1421
+ brand: process.env[`${prefix}BRAND`],
1422
+ alternate: process.env[`${prefix}ALTERNATE`],
1423
+ accent: process.env[`${prefix}ACCENT`],
1424
+ link: process.env[`${prefix}LINK`],
1425
+ help: process.env[`${prefix}HELP`],
1426
+ success: process.env[`${prefix}SUCCESS`],
1427
+ info: process.env[`${prefix}INFO`],
1428
+ warning: process.env[`${prefix}WARNING`],
1429
+ danger: process.env[`${prefix}DANGER`],
1430
+ fatal: process.env[`${prefix}FATAL`],
1431
+ positive: process.env[`${prefix}POSITIVE`],
1432
+ negative: process.env[`${prefix}NEGATIVE`],
1433
+ gradient
1434
+ };
1435
+ };
1436
+
1437
+ // ../config-tools/src/env/set-env.ts
1438
+ var setExtensionEnv = (extensionName, extension) => {
1439
+ for (const key of Object.keys(extension ?? {})) {
1440
+ if (extension[key]) {
1441
+ const result = key?.replace(
1442
+ /([A-Z])+/g,
1443
+ (input) => input ? input[0]?.toUpperCase() + input.slice(1) : ""
1444
+ ).split(/(?=[A-Z])|[.\-\s_]/).map((x) => x.toLowerCase()) ?? [];
1445
+ let extensionKey;
1446
+ if (result.length === 0) {
1447
+ return;
1448
+ }
1449
+ if (result.length === 1) {
1450
+ extensionKey = result[0]?.toUpperCase() ?? "";
1451
+ } else {
1452
+ extensionKey = result.reduce((ret, part) => {
1453
+ return `${ret}_${part.toLowerCase()}`;
1454
+ });
1455
+ }
1456
+ process.env[`STORM_EXTENSION_${extensionName.toUpperCase()}_${extensionKey.toUpperCase()}`] = extension[key];
1457
+ }
1458
+ }
1459
+ };
1460
+ var setConfigEnv = (config) => {
1461
+ const prefix = "STORM_";
1462
+ if (config.extends) {
1463
+ process.env[`${prefix}EXTENDS`] = Array.isArray(config.extends) ? JSON.stringify(config.extends) : config.extends;
1464
+ }
1465
+ if (config.name) {
1466
+ process.env[`${prefix}NAME`] = config.name;
1467
+ }
1468
+ if (config.variant) {
1469
+ process.env[`${prefix}VARIANT`] = config.variant;
1470
+ }
1471
+ if (config.namespace) {
1472
+ process.env[`${prefix}NAMESPACE`] = config.namespace;
1473
+ }
1474
+ if (config.owner) {
1475
+ process.env[`${prefix}OWNER`] = config.owner;
1476
+ }
1477
+ if (config.bot) {
1478
+ process.env[`${prefix}BOT_NAME`] = config.bot.name;
1479
+ process.env[`${prefix}BOT_EMAIL`] = config.bot.email;
1480
+ }
1481
+ if (config.error) {
1482
+ process.env[`${prefix}ERROR_CODES_FILE`] = config.error.codesFile;
1483
+ process.env[`${prefix}ERROR_URL`] = config.error.url;
1484
+ }
1485
+ if (config.release) {
1486
+ if (config.release.banner) {
1487
+ if (typeof config.release.banner === "string") {
1488
+ process.env[`${prefix}RELEASE_BANNER`] = config.release.banner;
1489
+ process.env[`${prefix}RELEASE_BANNER_URL`] = config.release.banner;
1490
+ } else {
1491
+ process.env[`${prefix}RELEASE_BANNER`] = config.release.banner.url;
1492
+ process.env[`${prefix}RELEASE_BANNER_URL`] = config.release.banner.url;
1493
+ process.env[`${prefix}RELEASE_BANNER_ALT`] = config.release.banner.alt;
1494
+ }
1495
+ }
1496
+ process.env[`${prefix}RELEASE_HEADER`] = config.release.header;
1497
+ process.env[`${prefix}RELEASE_FOOTER`] = config.release.footer;
1498
+ }
1499
+ if (config.socials) {
1500
+ if (config.socials.twitter) {
1501
+ process.env[`${prefix}SOCIAL_TWITTER`] = config.socials.twitter;
1502
+ }
1503
+ if (config.socials.discord) {
1504
+ process.env[`${prefix}SOCIAL_DISCORD`] = config.socials.discord;
1505
+ }
1506
+ if (config.socials.telegram) {
1507
+ process.env[`${prefix}SOCIAL_TELEGRAM`] = config.socials.telegram;
1508
+ }
1509
+ if (config.socials.slack) {
1510
+ process.env[`${prefix}SOCIAL_SLACK`] = config.socials.slack;
1511
+ }
1512
+ if (config.socials.medium) {
1513
+ process.env[`${prefix}SOCIAL_MEDIUM`] = config.socials.medium;
1514
+ }
1515
+ if (config.socials.github) {
1516
+ process.env[`${prefix}SOCIAL_GITHUB`] = config.socials.github;
1517
+ }
1518
+ }
1519
+ if (config.organization) {
1520
+ if (typeof config.organization === "string") {
1521
+ process.env[`${prefix}ORG`] = config.organization;
1522
+ process.env[`${prefix}ORG_NAME`] = config.organization;
1523
+ process.env[`${prefix}ORGANIZATION`] = config.organization;
1524
+ process.env[`${prefix}ORGANIZATION_NAME`] = config.organization;
1525
+ } else {
1526
+ process.env[`${prefix}ORG`] = config.organization.name;
1527
+ process.env[`${prefix}ORG_NAME`] = config.organization.name;
1528
+ process.env[`${prefix}ORGANIZATION`] = config.organization.name;
1529
+ process.env[`${prefix}ORGANIZATION_NAME`] = config.organization.name;
1530
+ if (config.organization.url) {
1531
+ process.env[`${prefix}ORG_URL`] = config.organization.url;
1532
+ process.env[`${prefix}ORGANIZATION_URL`] = config.organization.url;
1533
+ }
1534
+ if (config.organization.description) {
1535
+ process.env[`${prefix}ORG_DESCRIPTION`] = config.organization.description;
1536
+ process.env[`${prefix}ORGANIZATION_DESCRIPTION`] = config.organization.description;
1537
+ }
1538
+ if (config.organization.logo) {
1539
+ process.env[`${prefix}ORG_LOGO`] = config.organization.logo;
1540
+ process.env[`${prefix}ORGANIZATION_LOGO`] = config.organization.logo;
1541
+ }
1542
+ if (config.organization.icon) {
1543
+ process.env[`${prefix}ORG_ICON`] = config.organization.icon;
1544
+ process.env[`${prefix}ORGANIZATION_ICON`] = config.organization.icon;
1545
+ }
1546
+ }
1547
+ }
1548
+ if (config.packageManager) {
1549
+ process.env[`${prefix}PACKAGE_MANAGER`] = config.packageManager;
1550
+ }
1551
+ if (config.license) {
1552
+ process.env[`${prefix}LICENSE`] = config.license;
1553
+ }
1554
+ if (config.homepage) {
1555
+ process.env[`${prefix}HOMEPAGE`] = config.homepage;
1556
+ }
1557
+ if (config.docs) {
1558
+ process.env[`${prefix}DOCS`] = config.docs;
1559
+ }
1560
+ if (config.portal) {
1561
+ process.env[`${prefix}PORTAL`] = config.portal;
1562
+ }
1563
+ if (config.licensing) {
1564
+ process.env[`${prefix}LICENSING`] = config.licensing;
1565
+ }
1566
+ if (config.contact) {
1567
+ process.env[`${prefix}CONTACT`] = config.contact;
1568
+ }
1569
+ if (config.support) {
1570
+ process.env[`${prefix}SUPPORT`] = config.support;
1571
+ }
1572
+ if (config.timezone) {
1573
+ process.env[`${prefix}TIMEZONE`] = config.timezone;
1574
+ process.env.TZ = config.timezone;
1575
+ process.env.DEFAULT_TIMEZONE = config.timezone;
1576
+ process.env.TIMEZONE = config.timezone;
1577
+ }
1578
+ if (config.locale) {
1579
+ process.env[`${prefix}LOCALE`] = config.locale;
1580
+ process.env.DEFAULT_LOCALE = config.locale;
1581
+ process.env.LOCALE = config.locale;
1582
+ process.env.LANG = config.locale ? `${config.locale.replaceAll("-", "_")}.UTF-8` : "en_US.UTF-8";
1583
+ }
1584
+ if (config.configFile) {
1585
+ process.env[`${prefix}WORKSPACE_CONFIG_FILE`] = correctPaths(
1586
+ config.configFile
1587
+ );
1588
+ }
1589
+ if (config.workspaceRoot) {
1590
+ process.env[`${prefix}WORKSPACE_ROOT`] = correctPaths(config.workspaceRoot);
1591
+ process.env.NX_WORKSPACE_ROOT = correctPaths(config.workspaceRoot);
1592
+ process.env.NX_WORKSPACE_ROOT_PATH = correctPaths(config.workspaceRoot);
1593
+ }
1594
+ if (config.directories) {
1595
+ if (!config.skipCache && config.directories.cache) {
1596
+ process.env[`${prefix}CACHE_DIR`] = correctPaths(
1597
+ config.directories.cache
1598
+ );
1599
+ process.env[`${prefix}CACHE_DIRECTORY`] = process.env[`${prefix}CACHE_DIR`];
1600
+ }
1601
+ if (config.directories.data) {
1602
+ process.env[`${prefix}DATA_DIR`] = correctPaths(config.directories.data);
1603
+ process.env[`${prefix}DATA_DIRECTORY`] = process.env[`${prefix}DATA_DIR`];
1604
+ }
1605
+ if (config.directories.config) {
1606
+ process.env[`${prefix}CONFIG_DIR`] = correctPaths(
1607
+ config.directories.config
1608
+ );
1609
+ process.env[`${prefix}CONFIG_DIRECTORY`] = process.env[`${prefix}CONFIG_DIR`];
1610
+ }
1611
+ if (config.directories.temp) {
1612
+ process.env[`${prefix}TEMP_DIR`] = correctPaths(config.directories.temp);
1613
+ process.env[`${prefix}TEMP_DIRECTORY`] = process.env[`${prefix}TEMP_DIR`];
1614
+ }
1615
+ if (config.directories.log) {
1616
+ process.env[`${prefix}LOG_DIR`] = correctPaths(config.directories.log);
1617
+ process.env[`${prefix}LOG_DIRECTORY`] = process.env[`${prefix}LOG_DIR`];
1618
+ }
1619
+ if (config.directories.build) {
1620
+ process.env[`${prefix}BUILD_DIR`] = correctPaths(
1621
+ config.directories.build
1622
+ );
1623
+ process.env[`${prefix}BUILD_DIRECTORY`] = process.env[`${prefix}BUILD_DIR`];
1624
+ }
1625
+ }
1626
+ if (config.skipCache !== void 0) {
1627
+ process.env[`${prefix}SKIP_CACHE`] = String(config.skipCache);
1628
+ if (config.skipCache) {
1629
+ process.env.NX_SKIP_NX_CACHE ??= String(config.skipCache);
1630
+ process.env.NX_CACHE_PROJECT_GRAPH ??= String(config.skipCache);
1631
+ }
1632
+ }
1633
+ if (config.mode) {
1634
+ process.env[`${prefix}MODE`] = config.mode;
1635
+ process.env.NODE_ENV = config.mode;
1636
+ process.env.ENVIRONMENT = config.mode;
1637
+ }
1638
+ if (config.colors?.base?.light || config.colors?.base?.dark) {
1639
+ for (const key of Object.keys(config.colors)) {
1640
+ setThemeColorsEnv(`${prefix}COLOR_${key}_`, config.colors[key]);
1641
+ }
1642
+ } else {
1643
+ setThemeColorsEnv(
1644
+ `${prefix}COLOR_`,
1645
+ config.colors
1646
+ );
1647
+ }
1648
+ if (config.repository) {
1649
+ process.env[`${prefix}REPOSITORY`] = config.repository;
1650
+ }
1651
+ if (config.branch) {
1652
+ process.env[`${prefix}BRANCH`] = config.branch;
1653
+ }
1654
+ if (config.preid) {
1655
+ process.env[`${prefix}PRE_ID`] = String(config.preid);
1656
+ }
1657
+ if (config.registry) {
1658
+ if (config.registry.github) {
1659
+ process.env[`${prefix}REGISTRY_GITHUB`] = String(config.registry.github);
1660
+ }
1661
+ if (config.registry.npm) {
1662
+ process.env[`${prefix}REGISTRY_NPM`] = String(config.registry.npm);
1663
+ }
1664
+ if (config.registry.cargo) {
1665
+ process.env[`${prefix}REGISTRY_CARGO`] = String(config.registry.cargo);
1666
+ }
1667
+ if (config.registry.cyclone) {
1668
+ process.env[`${prefix}REGISTRY_CYCLONE`] = String(
1669
+ config.registry.cyclone
1670
+ );
1671
+ }
1672
+ if (config.registry.container) {
1673
+ process.env[`${prefix}REGISTRY_CONTAINER`] = String(
1674
+ config.registry.container
1675
+ );
1676
+ }
1677
+ }
1678
+ if (config.logLevel) {
1679
+ process.env[`${prefix}LOG_LEVEL`] = String(config.logLevel);
1680
+ process.env.LOG_LEVEL = String(config.logLevel);
1681
+ process.env.NX_VERBOSE_LOGGING = String(
1682
+ getLogLevel(config.logLevel) >= LogLevel.DEBUG ? true : false
1683
+ );
1684
+ process.env.RUST_BACKTRACE = getLogLevel(config.logLevel) >= LogLevel.DEBUG ? "full" : "none";
1685
+ }
1686
+ if (config.skipConfigLogging !== void 0) {
1687
+ process.env[`${prefix}SKIP_CONFIG_LOGGING`] = String(
1688
+ config.skipConfigLogging
1689
+ );
1690
+ }
1691
+ process.env[`${prefix}WORKSPACE_CONFIG`] = JSON.stringify(config);
1692
+ for (const key of Object.keys(config.extensions ?? {})) {
1693
+ if (config.extensions[key] && Object.keys(config.extensions[key])) {
1694
+ setExtensionEnv(key, config.extensions[key]);
1695
+ }
1696
+ }
1697
+ };
1698
+ var setThemeColorsEnv = (prefix, config) => {
1699
+ return config?.light?.brand || config?.dark?.brand ? setMultiThemeColorsEnv(prefix, config) : setSingleThemeColorsEnv(prefix, config);
1700
+ };
1701
+ var setSingleThemeColorsEnv = (prefix, config) => {
1702
+ if (config.dark) {
1703
+ process.env[`${prefix}DARK`] = config.dark;
1704
+ }
1705
+ if (config.light) {
1706
+ process.env[`${prefix}LIGHT`] = config.light;
1707
+ }
1708
+ if (config.brand) {
1709
+ process.env[`${prefix}BRAND`] = config.brand;
1710
+ }
1711
+ if (config.alternate) {
1712
+ process.env[`${prefix}ALTERNATE`] = config.alternate;
1713
+ }
1714
+ if (config.accent) {
1715
+ process.env[`${prefix}ACCENT`] = config.accent;
1716
+ }
1717
+ if (config.link) {
1718
+ process.env[`${prefix}LINK`] = config.link;
1719
+ }
1720
+ if (config.help) {
1721
+ process.env[`${prefix}HELP`] = config.help;
1722
+ }
1723
+ if (config.success) {
1724
+ process.env[`${prefix}SUCCESS`] = config.success;
1725
+ }
1726
+ if (config.info) {
1727
+ process.env[`${prefix}INFO`] = config.info;
1728
+ }
1729
+ if (config.warning) {
1730
+ process.env[`${prefix}WARNING`] = config.warning;
1731
+ }
1732
+ if (config.danger) {
1733
+ process.env[`${prefix}DANGER`] = config.danger;
1734
+ }
1735
+ if (config.fatal) {
1736
+ process.env[`${prefix}FATAL`] = config.fatal;
1737
+ }
1738
+ if (config.positive) {
1739
+ process.env[`${prefix}POSITIVE`] = config.positive;
1740
+ }
1741
+ if (config.negative) {
1742
+ process.env[`${prefix}NEGATIVE`] = config.negative;
1743
+ }
1744
+ if (config.gradient) {
1745
+ for (let i = 0; i < config.gradient.length; i++) {
1746
+ process.env[`${prefix}GRADIENT_${i}`] = config.gradient[i];
1747
+ }
1748
+ }
1749
+ };
1750
+ var setMultiThemeColorsEnv = (prefix, config) => {
1751
+ return {
1752
+ light: setBaseThemeColorsEnv(`${prefix}LIGHT_`, config.light),
1753
+ dark: setBaseThemeColorsEnv(`${prefix}DARK_`, config.dark)
1754
+ };
1755
+ };
1756
+ var setBaseThemeColorsEnv = (prefix, config) => {
1757
+ if (config.foreground) {
1758
+ process.env[`${prefix}FOREGROUND`] = config.foreground;
1759
+ }
1760
+ if (config.background) {
1761
+ process.env[`${prefix}BACKGROUND`] = config.background;
1762
+ }
1763
+ if (config.brand) {
1764
+ process.env[`${prefix}BRAND`] = config.brand;
1765
+ }
1766
+ if (config.alternate) {
1767
+ process.env[`${prefix}ALTERNATE`] = config.alternate;
1768
+ }
1769
+ if (config.accent) {
1770
+ process.env[`${prefix}ACCENT`] = config.accent;
1771
+ }
1772
+ if (config.link) {
1773
+ process.env[`${prefix}LINK`] = config.link;
1774
+ }
1775
+ if (config.help) {
1776
+ process.env[`${prefix}HELP`] = config.help;
1777
+ }
1778
+ if (config.success) {
1779
+ process.env[`${prefix}SUCCESS`] = config.success;
1780
+ }
1781
+ if (config.info) {
1782
+ process.env[`${prefix}INFO`] = config.info;
1783
+ }
1784
+ if (config.warning) {
1785
+ process.env[`${prefix}WARNING`] = config.warning;
1786
+ }
1787
+ if (config.danger) {
1788
+ process.env[`${prefix}DANGER`] = config.danger;
1789
+ }
1790
+ if (config.fatal) {
1791
+ process.env[`${prefix}FATAL`] = config.fatal;
1792
+ }
1793
+ if (config.positive) {
1794
+ process.env[`${prefix}POSITIVE`] = config.positive;
1795
+ }
1796
+ if (config.negative) {
1797
+ process.env[`${prefix}NEGATIVE`] = config.negative;
1798
+ }
1799
+ if (config.gradient) {
1800
+ for (let i = 0; i < config.gradient.length; i++) {
1801
+ process.env[`${prefix}GRADIENT_${i}`] = config.gradient[i];
1802
+ }
1803
+ }
1804
+ };
1805
+ var _static_cache = void 0;
1806
+ var createStormWorkspaceConfig = async (extensionName, schema, workspaceRoot, skipLogs = false, useDefault = true) => {
1807
+ let result;
1808
+ if (!_static_cache?.data || !_static_cache?.timestamp || _static_cache.timestamp < Date.now() - 8e3) {
1809
+ let _workspaceRoot = workspaceRoot;
1810
+ if (!_workspaceRoot) {
1811
+ _workspaceRoot = findWorkspaceRoot();
1812
+ }
1813
+ const configEnv = getConfigEnv();
1814
+ const configFile = await getConfigFile(_workspaceRoot);
1815
+ if (!configFile) {
1816
+ if (!skipLogs) {
1817
+ writeWarning(
1818
+ "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",
1819
+ { logLevel: "all" }
1820
+ );
1821
+ }
1822
+ if (useDefault === false) {
1823
+ return void 0;
1824
+ }
1825
+ }
1826
+ const defaultConfig = await getPackageJsonConfig(_workspaceRoot);
1827
+ const configInput = defu(
1828
+ configEnv,
1829
+ configFile,
1830
+ defaultConfig
1831
+ );
1832
+ if (!configInput.variant) {
1833
+ configInput.variant = existsSync(joinPaths(_workspaceRoot, "nx.json")) || existsSync(joinPaths(_workspaceRoot, ".nx")) || existsSync(joinPaths(_workspaceRoot, "lerna.json")) || existsSync(joinPaths(_workspaceRoot, "turbo.json")) ? "monorepo" : "minimal";
1834
+ }
1835
+ try {
1836
+ result = applyDefaultConfig(
1837
+ await workspaceConfigSchema.parseAsync(configInput)
1838
+ );
1839
+ result.workspaceRoot ??= _workspaceRoot;
1840
+ } catch (error) {
1841
+ throw new Error(
1842
+ `Failed to parse Storm Workspace configuration${error?.message ? `: ${error.message}` : ""}
1843
+
1844
+ Please ensure your configuration file is valid JSON and matches the expected schema. The current workspace configuration input is: ${formatLogMessage(
1845
+ configInput
1846
+ )}`,
1847
+ {
1848
+ cause: error
1849
+ }
1850
+ );
1851
+ }
1852
+ } else {
1853
+ result = _static_cache.data;
1854
+ }
1855
+ _static_cache = {
1856
+ timestamp: Date.now(),
1857
+ data: result
1858
+ };
1859
+ return result;
1860
+ };
1861
+ var loadStormWorkspaceConfig = async (workspaceRoot, skipLogs = false) => {
1862
+ const config = await createStormWorkspaceConfig(
1863
+ void 0,
1864
+ void 0,
1865
+ workspaceRoot,
1866
+ skipLogs,
1867
+ true
1868
+ );
1869
+ setConfigEnv(config);
1870
+ if (!skipLogs && !config.skipConfigLogging) {
1871
+ writeTrace(
1872
+ `\u2699\uFE0F Using Storm Workspace configuration:
1873
+ ${formatLogMessage(config)}`,
1874
+ config
1875
+ );
1876
+ }
1877
+ return config;
1878
+ };
1879
+
1880
+ // ../config-tools/src/get-config.ts
1881
+ function getConfig(workspaceRoot, skipLogs = false) {
1882
+ return loadStormWorkspaceConfig(workspaceRoot, skipLogs);
1883
+ }
1884
+ function getWorkspaceConfig(skipLogs = true, options = {}) {
1885
+ let workspaceRoot = options.workspaceRoot;
1886
+ if (!workspaceRoot) {
1887
+ workspaceRoot = findWorkspaceRoot(options.cwd);
1888
+ }
1889
+ return getConfig(workspaceRoot, skipLogs);
1890
+ }
1891
+
1892
+ // src/utilities/title-case.ts
1893
+ var ACRONYMS = [
1894
+ "3D",
1895
+ "4D",
1896
+ "5G",
1897
+ "6G",
1898
+ "7G",
1899
+ "8G",
1900
+ "ACID",
1901
+ "AES",
1902
+ "AI",
1903
+ "AJAX",
1904
+ "API",
1905
+ "AR",
1906
+ "ASCII",
1907
+ "B2B",
1908
+ "B2C",
1909
+ "BFF",
1910
+ "BI",
1911
+ "BIOS",
1912
+ "BGP",
1913
+ "BOM",
1914
+ "BYOD",
1915
+ "C2C",
1916
+ "CAGR",
1917
+ "CAPTCHA",
1918
+ "CD",
1919
+ "CDN",
1920
+ "CDP",
1921
+ "CI",
1922
+ "CI/CD",
1923
+ "CIAM",
1924
+ "CICD",
1925
+ "CLI",
1926
+ "CMDB",
1927
+ "CORS",
1928
+ "CPU",
1929
+ "CRUD",
1930
+ "CSR",
1931
+ "CSS",
1932
+ "CX",
1933
+ "DAG",
1934
+ "DBMS",
1935
+ "DDoS",
1936
+ "DNS",
1937
+ "DNSSEC",
1938
+ "DOM",
1939
+ "DR",
1940
+ "DRM",
1941
+ "DWH",
1942
+ "E2E",
1943
+ "EAI",
1944
+ "EKS",
1945
+ "EOF",
1946
+ "EOD",
1947
+ "ETC",
1948
+ "ETL",
1949
+ "EULA",
1950
+ "FIDO",
1951
+ "FQDN",
1952
+ "FTP",
1953
+ "FaaS",
1954
+ "GDPR",
1955
+ "GCP",
1956
+ "GPU",
1957
+ "GUID",
1958
+ "GUI",
1959
+ "GZIP",
1960
+ "HCI",
1961
+ "HDD",
1962
+ "HDFS",
1963
+ "HIPAA",
1964
+ "HMAC",
1965
+ "HOTP",
1966
+ "HSM",
1967
+ "HTML",
1968
+ "HTTP",
1969
+ "HTTP/2",
1970
+ "HTTP/2.0",
1971
+ "HTTP/3",
1972
+ "HTTP/3.0",
1973
+ "HTTP2",
1974
+ "HTTPS",
1975
+ "HTTPS/2",
1976
+ "HTTPS/3",
1977
+ "HTTPS3",
1978
+ "IAM",
1979
+ "IAMM",
1980
+ "IAMT",
1981
+ "IaaS",
1982
+ "ID",
1983
+ "IMAP",
1984
+ "IP",
1985
+ "IPFS",
1986
+ "IoT",
1987
+ "JSON",
1988
+ "JSONP",
1989
+ "JWT",
1990
+ "K8s",
1991
+ "KMS",
1992
+ "KPI",
1993
+ "LAN",
1994
+ "LHS",
1995
+ "LXC",
1996
+ "MFA",
1997
+ "ML",
1998
+ "MLOps",
1999
+ "MVC",
2000
+ "MVP",
2001
+ "NAS",
2002
+ "NAT",
2003
+ "NDA",
2004
+ "NFS",
2005
+ "NIST",
2006
+ "NLP",
2007
+ "NPS",
2008
+ "OCR",
2009
+ "OEM",
2010
+ "OKR",
2011
+ "OLAP",
2012
+ "OLTP",
2013
+ "OOP",
2014
+ "ORM",
2015
+ "OS",
2016
+ "OTP",
2017
+ "P2P",
2018
+ "PDP",
2019
+ "PaaS",
2020
+ "PCI",
2021
+ "PKI",
2022
+ "PP",
2023
+ "PWA",
2024
+ "PX",
2025
+ "QA",
2026
+ "RAID",
2027
+ "RAM",
2028
+ "RDS",
2029
+ "REST",
2030
+ "RHS",
2031
+ "RPC",
2032
+ "RPA",
2033
+ "RUM",
2034
+ "RSS",
2035
+ "SAN",
2036
+ "SASE",
2037
+ "SDLC",
2038
+ "SDK",
2039
+ "SEO",
2040
+ "SFTP",
2041
+ "SIEM",
2042
+ "SLA",
2043
+ "SMB",
2044
+ "SMTP",
2045
+ "SOAP",
2046
+ "SOC",
2047
+ "SOA",
2048
+ "SPDY",
2049
+ "SPF",
2050
+ "SQL",
2051
+ "SRV",
2052
+ "SRE",
2053
+ "SSH",
2054
+ "SSDL",
2055
+ "SSO",
2056
+ "SSL",
2057
+ "SSR",
2058
+ "TDD",
2059
+ "TLD",
2060
+ "TLS",
2061
+ "TLS1.3",
2062
+ "TOTP",
2063
+ "TRPC",
2064
+ "TTL",
2065
+ "UDP",
2066
+ "UI",
2067
+ "UID",
2068
+ "URI",
2069
+ "URL",
2070
+ "UTF",
2071
+ "UUID",
2072
+ "UX",
2073
+ "VM",
2074
+ "VLAN",
2075
+ "VPN",
2076
+ "VR",
2077
+ "WAF",
2078
+ "WAN",
2079
+ "WLAN",
2080
+ "WPA",
2081
+ "XACML",
2082
+ "XML",
2083
+ "XSRF",
2084
+ "XSS",
2085
+ "XR",
2086
+ "YAML",
2087
+ "ZTA"
2088
+ ];
2089
+ ACRONYMS.reduce(
2090
+ (ret, acronym) => {
2091
+ ret[acronym.toLowerCase()] = acronym;
2092
+ return ret;
2093
+ },
2094
+ {
2095
+ cspell: "CSpell",
2096
+ eslint: "ESLint",
2097
+ nx: "Nx"
2098
+ }
2099
+ );
2100
+
2101
+ // src/utilities/changelog-utils.ts
2102
+ function generateChangelogTitle(version, project, workspaceConfig) {
2103
+ if (!workspaceConfig?.name || !project) {
2104
+ return version;
2105
+ }
2106
+ return `[${version}](https://github.com/${typeof workspaceConfig.organization === "string" ? workspaceConfig.organization : workspaceConfig.organization?.name}/${workspaceConfig.name}/releases/tag/${project}%40${version}) (${(/* @__PURE__ */ new Date()).getMonth() + 1}/${(/* @__PURE__ */ new Date()).getDate()}/${(/* @__PURE__ */ new Date()).getFullYear()})`;
2107
+ }
2108
+
2109
+ // src/release/changelog-renderer.ts
2110
+ var StormChangelogRenderer = class extends DefaultChangelogRenderer {
2111
+ /**
2112
+ * The Storm workspace configuration object, which is loaded from the storm-workspace.json file.
2113
+ */
2114
+ workspaceConfig;
2115
+ /**
2116
+ * A ChangelogRenderer class takes in the determined changes and other relevant metadata and returns a string, or a Promise of a string of changelog contents (usually markdown).
2117
+ *
2118
+ * @param config - The configuration object for the ChangelogRenderer
2119
+ */
2120
+ constructor(config) {
2121
+ const resolvedConfig = {
2122
+ entryWhenNoChanges: false,
2123
+ conventionalCommitsConfig: DEFAULT_CONVENTIONAL_COMMITS_CONFIG,
2124
+ ...config
2125
+ };
2126
+ super(resolvedConfig);
2127
+ this.workspaceConfig = config.workspaceConfig;
2128
+ this.remoteReleaseClient = resolvedConfig.remoteReleaseClient;
2129
+ }
2130
+ async render() {
2131
+ if (!this.workspaceConfig) {
2132
+ this.workspaceConfig = await getWorkspaceConfig();
2133
+ }
2134
+ return super.render();
2135
+ }
2136
+ preprocessChanges() {
2137
+ this.relevantChanges = [...this.changes];
2138
+ this.breakingChanges = [];
2139
+ this.additionalChangesForAuthorsSection = [];
2140
+ for (let i = this.relevantChanges.length - 1; i >= 0; i--) {
2141
+ const change = this.relevantChanges[i];
2142
+ if (change && change.type === "revert" && change.revertedHashes) {
2143
+ for (const revertedHash of change.revertedHashes) {
2144
+ const revertedCommitIndex = this.relevantChanges.findIndex(
2145
+ (c) => c.shortHash && revertedHash.startsWith(c.shortHash)
2146
+ );
2147
+ if (revertedCommitIndex !== -1) {
2148
+ this.relevantChanges.splice(revertedCommitIndex, 1);
2149
+ this.relevantChanges.splice(i, 1);
2150
+ i--;
2151
+ break;
2152
+ }
2153
+ }
2154
+ }
2155
+ }
2156
+ if (this.isVersionPlans) {
2157
+ this.conventionalCommitsConfig = {
2158
+ types: {
2159
+ feat: DEFAULT_CONVENTIONAL_COMMITS_CONFIG.types.feat,
2160
+ fix: DEFAULT_CONVENTIONAL_COMMITS_CONFIG.types.fix
2161
+ }
2162
+ };
2163
+ for (let i = this.relevantChanges.length - 1; i >= 0; i--) {
2164
+ if (this.relevantChanges[i]?.isBreaking) {
2165
+ const change = this.relevantChanges[i];
2166
+ if (change) {
2167
+ this.additionalChangesForAuthorsSection.push(change);
2168
+ const line = this.formatChange(change);
2169
+ this.breakingChanges.push(line);
2170
+ this.relevantChanges.splice(i, 1);
2171
+ }
2172
+ }
2173
+ }
2174
+ } else {
2175
+ for (const change of this.relevantChanges) {
2176
+ if (change.isBreaking) {
2177
+ const breakingChangeExplanation = change.body ? this.extractBreakingChangeExplanation(change.body) : "";
2178
+ this.breakingChanges.push(
2179
+ breakingChangeExplanation ? `- ${change.scope ? `**${change.scope.trim()}:** ` : ""}${breakingChangeExplanation}` : this.formatChange(change)
2180
+ );
2181
+ }
2182
+ }
2183
+ }
2184
+ }
2185
+ /**
2186
+ * Determines if the changelog entry should be rendered as empty. This is the case when there are no relevant changes, breaking changes, or dependency bumps.
2187
+ */
2188
+ // protected override shouldRenderEmptyEntry(): boolean {
2189
+ // return true;
2190
+ // }
2191
+ renderVersionTitle() {
2192
+ const isMajorVersion = `${major(this.changelogEntryVersion)}.0.0` === this.changelogEntryVersion.replace(/^v/, "");
2193
+ return isMajorVersion ? `# ${generateChangelogTitle(
2194
+ this.changelogEntryVersion,
2195
+ this.project,
2196
+ this.workspaceConfig
2197
+ )}` : `## ${generateChangelogTitle(
2198
+ this.changelogEntryVersion,
2199
+ this.project,
2200
+ this.workspaceConfig
2201
+ )}`;
2202
+ }
2203
+ renderBreakingChanges() {
2204
+ return [
2205
+ "### Breaking Changes",
2206
+ "",
2207
+ ...Array.from(new Set(this.breakingChanges))
2208
+ ];
2209
+ }
2210
+ renderDependencyBumps() {
2211
+ const markdownLines = ["", "### Updated Dependencies", ""];
2212
+ this.dependencyBumps?.forEach(({ dependencyName, newVersion }) => {
2213
+ const markdownLine = `- Updated **${dependencyName}** to **v${newVersion}**`;
2214
+ if (!markdownLines.includes(markdownLine)) {
2215
+ markdownLines.push(markdownLine);
2216
+ }
2217
+ });
2218
+ return markdownLines;
2219
+ }
2220
+ async renderAuthors() {
2221
+ const markdownLines = [];
2222
+ const _authors = /* @__PURE__ */ new Map();
2223
+ for (const change of [
2224
+ ...this.relevantChanges,
2225
+ ...this.additionalChangesForAuthorsSection
2226
+ ]) {
2227
+ if (!change.authors) {
2228
+ continue;
2229
+ }
2230
+ for (const author of change.authors) {
2231
+ const name = this.formatName(author.name);
2232
+ if (!name || name.includes("[bot]") || name === this.workspaceConfig?.bot.name) {
2233
+ continue;
2234
+ }
2235
+ if (_authors.has(name)) {
2236
+ const entry = _authors.get(name);
2237
+ entry?.email.add(author.email);
2238
+ } else {
2239
+ _authors.set(name, { email: /* @__PURE__ */ new Set([author.email]) });
2240
+ }
2241
+ }
2242
+ }
2243
+ if (this.changelogRenderOptions.mapAuthorsToGitHubUsernames) {
2244
+ await Promise.all(
2245
+ [..._authors.keys()].map(async (authorName) => {
2246
+ const meta = _authors.get(authorName);
2247
+ if (!meta) {
2248
+ return;
2249
+ }
2250
+ for (const email of meta.email) {
2251
+ if (email?.endsWith("@users.noreply.github.com")) {
2252
+ const match = email?.match(
2253
+ /^(\d+\+)?([^@]+)@users\.noreply\.github\.com$/
2254
+ );
2255
+ if (match && match[2]) {
2256
+ meta.github = match[2];
2257
+ break;
2258
+ }
2259
+ }
2260
+ const { data } = await axios2.get(`https://ungh.cc/users/find/${email}`).catch(() => ({ data: { user: null } }));
2261
+ if (data?.user) {
2262
+ meta.github = data.user.username;
2263
+ break;
2264
+ }
2265
+ }
2266
+ })
2267
+ );
2268
+ }
2269
+ const authors = [..._authors.entries()].map((e) => ({
2270
+ name: e[0],
2271
+ ...e[1]
2272
+ }));
2273
+ if (authors.length > 0) {
2274
+ markdownLines.push(
2275
+ "",
2276
+ "### \u2764\uFE0F Thank You",
2277
+ "",
2278
+ ...authors.sort((a, b) => a.name.localeCompare(b.name)).map((i) => {
2279
+ const github = i.github ? ` @${i.github}` : "";
2280
+ return `- ${i.name}${github}`;
2281
+ })
2282
+ );
2283
+ }
2284
+ return markdownLines;
2285
+ }
2286
+ formatChange(change) {
2287
+ let description = change.description || "";
2288
+ let extraLines = [];
2289
+ let extraLinesStr = "";
2290
+ if (description.includes("\n")) {
2291
+ const lines = description.split("\n");
2292
+ if (lines.length > 1) {
2293
+ description = lines[0];
2294
+ extraLines = lines.slice(1);
2295
+ }
2296
+ const indentation = " ";
2297
+ extraLinesStr = extraLines.filter((l) => l.trim().length > 0).map((l) => `${indentation}${l}`).join("\n");
2298
+ }
2299
+ let changeLine = "- " + (!this.isVersionPlans && change.scope ? `**${change.scope.trim()}:** ` : "") + description;
2300
+ if (change.githubReferences) {
2301
+ changeLine += this.remoteReleaseClient.formatReferences(
2302
+ change.githubReferences
2303
+ );
2304
+ }
2305
+ if (extraLinesStr) {
2306
+ changeLine += "\n\n" + extraLinesStr;
2307
+ }
2308
+ return changeLine;
2309
+ }
2310
+ };
2311
+
2312
+ // src/release/config.ts
2313
+ var DEFAULT_CONVENTIONAL_COMMITS_CONFIG2 = {
2314
+ questions: DEFAULT_MONOREPO_COMMIT_QUESTIONS,
2315
+ types: DEFAULT_COMMIT_TYPES
2316
+ };
2317
+ var DEFAULT_RELEASE_TAG_PATTERN = "{projectName}@{version}";
2318
+ var DEFAULT_RELEASE_GROUP_CONFIG = {
2319
+ projectsRelationship: "independent",
2320
+ changelog: {
2321
+ createRelease: "github",
2322
+ entryWhenNoChanges: false,
2323
+ file: false,
2324
+ renderOptions: {
2325
+ authors: false,
2326
+ commitReferences: true,
2327
+ versionTitleDate: true
2328
+ }
2329
+ },
2330
+ version: {
2331
+ currentVersionResolver: "git-tag",
2332
+ specifierSource: "conventional-commits",
2333
+ groupPreVersionCommand: "pnpm build"
2334
+ },
2335
+ releaseTag: { pattern: DEFAULT_RELEASE_TAG_PATTERN }
2336
+ };
2337
+ var DEFAULT_JS_RELEASE_GROUP_CONFIG = {
2338
+ ...DEFAULT_RELEASE_GROUP_CONFIG,
2339
+ projects: ["packages/*"],
2340
+ version: {
2341
+ ...DEFAULT_RELEASE_GROUP_CONFIG.version,
2342
+ versionActions: "@storm-software/workspace-tools/release/js-version-actions",
2343
+ versionActionsOptions: {
2344
+ currentVersionResolver: "git-tag",
2345
+ specifierSource: "conventional-commits"
2346
+ },
2347
+ manifestRootsToUpdate: [
2348
+ "{projectRoot}",
2349
+ {
2350
+ path: "dist/{projectRoot}",
2351
+ preserveLocalDependencyProtocols: false
2352
+ }
2353
+ ]
2354
+ }
2355
+ };
2356
+ var DEFAULT_RUST_RELEASE_GROUP_CONFIG = {
2357
+ ...DEFAULT_RELEASE_GROUP_CONFIG,
2358
+ projects: ["crates/*"],
2359
+ version: {
2360
+ ...DEFAULT_RELEASE_GROUP_CONFIG.version,
2361
+ versionActions: "@storm-software/workspace-tools/release/rust-version-actions",
2362
+ versionActionsOptions: {
2363
+ currentVersionResolver: "git-tag",
2364
+ specifierSource: "conventional-commits"
2365
+ },
2366
+ manifestRootsToUpdate: ["{projectRoot}"]
2367
+ }
2368
+ };
2369
+ var DEFAULT_RELEASE_CONFIG = {
2370
+ conventionalCommits: DEFAULT_CONVENTIONAL_COMMITS_CONFIG2,
2371
+ groups: {
2372
+ packages: DEFAULT_JS_RELEASE_GROUP_CONFIG,
2373
+ crates: DEFAULT_RUST_RELEASE_GROUP_CONFIG
2374
+ },
2375
+ changelog: {
2376
+ automaticFromRef: true,
2377
+ workspaceChangelog: false,
2378
+ projectChangelogs: true
2379
+ },
2380
+ releaseTag: { pattern: DEFAULT_RELEASE_TAG_PATTERN }
2381
+ };
2382
+ function getReleaseGroupConfig(releaseConfig, workspaceConfig) {
2383
+ return !releaseConfig?.groups || Object.keys(releaseConfig.groups).length === 0 ? {} : Object.fromEntries(
2384
+ Object.entries(releaseConfig.groups).map(([name, group]) => {
2385
+ const config = defu(
2386
+ {
2387
+ ...omit(DEFAULT_RELEASE_GROUP_CONFIG, ["changelog"]),
2388
+ ...group
2389
+ },
2390
+ {
2391
+ changelog: {
2392
+ ...DEFAULT_RELEASE_GROUP_CONFIG.changelog,
2393
+ renderer: StormChangelogRenderer,
2394
+ renderOptions: {
2395
+ ...DEFAULT_RELEASE_GROUP_CONFIG.changelog.renderOptions,
2396
+ workspaceConfig
2397
+ }
2398
+ }
2399
+ }
2400
+ );
2401
+ if (workspaceConfig?.workspaceRoot) {
2402
+ if (config.changelog?.renderer && typeof config.changelog?.renderer === "string" && config.changelog?.renderer?.toString().startsWith("./")) {
2403
+ config.changelog.renderer = joinPaths(
2404
+ workspaceConfig.workspaceRoot,
2405
+ config.changelog.renderer
2406
+ );
2407
+ }
2408
+ if (config.version?.versionActions && config.version.versionActions.startsWith("./")) {
2409
+ config.version.versionActions = joinPaths(
2410
+ workspaceConfig.workspaceRoot,
2411
+ config.version?.versionActions
2412
+ );
2413
+ }
2414
+ }
2415
+ return [name, config];
2416
+ })
2417
+ );
2418
+ }
2419
+
2420
+ export { DEFAULT_CONVENTIONAL_COMMITS_CONFIG2 as DEFAULT_CONVENTIONAL_COMMITS_CONFIG, DEFAULT_JS_RELEASE_GROUP_CONFIG, DEFAULT_RELEASE_CONFIG, DEFAULT_RELEASE_GROUP_CONFIG, DEFAULT_RELEASE_TAG_PATTERN, DEFAULT_RUST_RELEASE_GROUP_CONFIG, getReleaseGroupConfig };