@storm-software/git-tools 2.115.1 → 2.115.3

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.
@@ -1,1965 +0,0 @@
1
- import chalk from 'chalk';
2
- import * as z from 'zod/mini';
3
- import { loadConfig } from 'c12';
4
- import { existsSync } from 'node:fs';
5
- import { join } from 'node:path';
6
- import { readFile } from 'node:fs/promises';
7
-
8
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
9
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
10
- }) : x)(function(x) {
11
- if (typeof require !== "undefined") return require.apply(this, arguments);
12
- throw Error('Dynamic require of "' + x + '" is not supported');
13
- });
14
-
15
- // ../config-tools/src/types.ts
16
- var LogLevel = {
17
- SILENT: 0,
18
- FATAL: 10,
19
- ERROR: 20,
20
- WARN: 30,
21
- SUCCESS: 35,
22
- INFO: 40,
23
- DEBUG: 60,
24
- TRACE: 70,
25
- ALL: 100
26
- };
27
- var LogLevelLabel = {
28
- SILENT: "silent",
29
- FATAL: "fatal",
30
- ERROR: "error",
31
- WARN: "warn",
32
- SUCCESS: "success",
33
- INFO: "info",
34
- DEBUG: "debug",
35
- TRACE: "trace",
36
- ALL: "all"
37
- };
38
-
39
- // ../config-tools/src/utilities/colors.ts
40
- var DEFAULT_COLOR_CONFIG = {
41
- dark: {
42
- brand: "#2dd4bf",
43
- success: "#10b981",
44
- info: "#58a6ff",
45
- warning: "#f3d371",
46
- danger: "#D8314A",
47
- fatal: "#a40e26"}
48
- };
49
- var chalkDefault = {
50
- hex: (_) => (message) => message,
51
- bgHex: (_) => ({
52
- whiteBright: (message) => message,
53
- white: (message) => message
54
- }),
55
- white: (message) => message,
56
- whiteBright: (message) => message,
57
- gray: (message) => message,
58
- bold: {
59
- hex: (_) => (message) => message,
60
- bgHex: (_) => ({
61
- whiteBright: (message) => message,
62
- white: (message) => message
63
- }),
64
- whiteBright: (message) => message,
65
- white: (message) => message
66
- },
67
- dim: {
68
- hex: (_) => (message) => message,
69
- gray: (message) => message
70
- }
71
- };
72
- var getChalk = () => {
73
- let _chalk = chalk;
74
- if (!_chalk?.hex || !_chalk?.bold?.hex || !_chalk?.bgHex || !_chalk?.whiteBright || !_chalk?.white) {
75
- _chalk = chalkDefault;
76
- }
77
- return _chalk;
78
- };
79
-
80
- // ../config-tools/src/logger/is-unicode-supported.ts
81
- function isUnicodeSupported() {
82
- if (process.platform !== "win32") {
83
- return process.env.TERM !== "linux";
84
- }
85
- return Boolean(process.env.WT_SESSION) || // Windows Terminal
86
- Boolean(process.env.TERMINUS_SUBLIME) || // Terminus (<0.2.27)
87
- process.env.ConEmuTask === "{cmd::Cmder}" || // ConEmu and cmder
88
- 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";
89
- }
90
-
91
- // ../config-tools/src/logger/console-icons.ts
92
- var useIcon = (c, fallback) => isUnicodeSupported() ? c : fallback;
93
- var CONSOLE_ICONS = {
94
- [LogLevelLabel.ERROR]: useIcon("\u2718", "\xD7"),
95
- [LogLevelLabel.FATAL]: useIcon("\u{1F480}", "\xD7"),
96
- [LogLevelLabel.WARN]: useIcon("\u26A0", "\u203C"),
97
- [LogLevelLabel.INFO]: useIcon("\u2139", "i"),
98
- [LogLevelLabel.SUCCESS]: useIcon("\u2714", "\u221A"),
99
- [LogLevelLabel.DEBUG]: useIcon("\u{1F6E0}", "D"),
100
- [LogLevelLabel.TRACE]: useIcon("\u{1F6E0}", "T"),
101
- [LogLevelLabel.ALL]: useIcon("\u2709", "\u2192")
102
- };
103
-
104
- // ../config-tools/src/logger/format-timestamp.ts
105
- var formatTimestamp = (date = /* @__PURE__ */ new Date()) => {
106
- return `${date.toLocaleDateString()} ${date.toLocaleTimeString()}`;
107
- };
108
-
109
- // ../config-tools/src/logger/get-log-level.ts
110
- var getLogLevel = (label) => {
111
- switch (label) {
112
- case "all":
113
- return LogLevel.ALL;
114
- case "trace":
115
- return LogLevel.TRACE;
116
- case "debug":
117
- return LogLevel.DEBUG;
118
- case "info":
119
- return LogLevel.INFO;
120
- case "warn":
121
- return LogLevel.WARN;
122
- case "error":
123
- return LogLevel.ERROR;
124
- case "fatal":
125
- return LogLevel.FATAL;
126
- case "silent":
127
- return LogLevel.SILENT;
128
- default:
129
- return LogLevel.INFO;
130
- }
131
- };
132
- var getLogLevelLabel = (logLevel = LogLevel.INFO) => {
133
- if (logLevel >= LogLevel.ALL) {
134
- return LogLevelLabel.ALL;
135
- }
136
- if (logLevel >= LogLevel.TRACE) {
137
- return LogLevelLabel.TRACE;
138
- }
139
- if (logLevel >= LogLevel.DEBUG) {
140
- return LogLevelLabel.DEBUG;
141
- }
142
- if (logLevel >= LogLevel.INFO) {
143
- return LogLevelLabel.INFO;
144
- }
145
- if (logLevel >= LogLevel.WARN) {
146
- return LogLevelLabel.WARN;
147
- }
148
- if (logLevel >= LogLevel.ERROR) {
149
- return LogLevelLabel.ERROR;
150
- }
151
- if (logLevel >= LogLevel.FATAL) {
152
- return LogLevelLabel.FATAL;
153
- }
154
- if (logLevel <= LogLevel.SILENT) {
155
- return LogLevelLabel.SILENT;
156
- }
157
- return LogLevelLabel.INFO;
158
- };
159
- var isVerbose = (label = LogLevelLabel.SILENT) => {
160
- const logLevel = typeof label === "string" ? getLogLevel(label) : label;
161
- return logLevel >= LogLevel.DEBUG;
162
- };
163
-
164
- // ../config-tools/src/logger/console.ts
165
- var getLogFn = (logLevel = LogLevel.INFO, config = {}, _chalk = getChalk()) => {
166
- 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;
167
- const configLogLevel = config.logLevel || process.env.STORM_LOG_LEVEL || LogLevelLabel.INFO;
168
- if (logLevel > getLogLevel(configLogLevel) || logLevel <= LogLevel.SILENT || getLogLevel(configLogLevel) <= LogLevel.SILENT) {
169
- return (_) => {
170
- };
171
- }
172
- if (typeof logLevel === "number" && LogLevel.FATAL >= logLevel) {
173
- return (message) => {
174
- console.error(
175
- `
176
- ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.fatal ?? DEFAULT_COLOR_CONFIG.dark.fatal)(`[${CONSOLE_ICONS[LogLevelLabel.FATAL]} Fatal] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
177
- `
178
- );
179
- };
180
- }
181
- if (typeof logLevel === "number" && LogLevel.ERROR >= logLevel) {
182
- return (message) => {
183
- console.error(
184
- `
185
- ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.danger ?? DEFAULT_COLOR_CONFIG.dark.danger)(`[${CONSOLE_ICONS[LogLevelLabel.ERROR]} Error] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
186
- `
187
- );
188
- };
189
- }
190
- if (typeof logLevel === "number" && LogLevel.WARN >= logLevel) {
191
- return (message) => {
192
- console.warn(
193
- `
194
- ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.warning ?? DEFAULT_COLOR_CONFIG.dark.warning)(`[${CONSOLE_ICONS[LogLevelLabel.WARN]} Warn] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
195
- `
196
- );
197
- };
198
- }
199
- if (typeof logLevel === "number" && LogLevel.SUCCESS >= logLevel) {
200
- return (message) => {
201
- console.info(
202
- `
203
- ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.success ?? DEFAULT_COLOR_CONFIG.dark.success)(`[${CONSOLE_ICONS[LogLevelLabel.SUCCESS]} Success] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
204
- `
205
- );
206
- };
207
- }
208
- if (typeof logLevel === "number" && LogLevel.INFO >= logLevel) {
209
- return (message) => {
210
- console.info(
211
- `
212
- ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.info ?? DEFAULT_COLOR_CONFIG.dark.info)(`[${CONSOLE_ICONS[LogLevelLabel.INFO]} Info] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
213
- `
214
- );
215
- };
216
- }
217
- if (typeof logLevel === "number" && LogLevel.DEBUG >= logLevel) {
218
- return (message) => {
219
- console.debug(
220
- `
221
- ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.info ?? DEFAULT_COLOR_CONFIG.dark.info)(`[${CONSOLE_ICONS[LogLevelLabel.DEBUG]} Debug] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
222
- `
223
- );
224
- };
225
- }
226
- if (typeof logLevel === "number" && LogLevel.TRACE >= logLevel) {
227
- return (message) => {
228
- console.debug(
229
- `
230
- ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.info ?? DEFAULT_COLOR_CONFIG.dark.info)(`[${CONSOLE_ICONS[LogLevelLabel.TRACE]} Trace] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
231
- `
232
- );
233
- };
234
- }
235
- return (message) => {
236
- console.log(
237
- `
238
- ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.brand ?? DEFAULT_COLOR_CONFIG.dark.brand)(`[${CONSOLE_ICONS[LogLevelLabel.ALL]} System] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
239
- `
240
- );
241
- };
242
- };
243
- var writeFatal = (message, config) => getLogFn(LogLevel.FATAL, config)(message);
244
- var writeError = (message, config) => getLogFn(LogLevel.ERROR, config)(message);
245
- var writeWarning = (message, config) => getLogFn(LogLevel.WARN, config)(message);
246
- var writeInfo = (message, config) => getLogFn(LogLevel.INFO, config)(message);
247
- var writeSuccess = (message, config) => getLogFn(LogLevel.SUCCESS, config)(message);
248
- var writeDebug = (message, config) => getLogFn(LogLevel.DEBUG, config)(message);
249
- var writeTrace = (message, config) => getLogFn(LogLevel.TRACE, config)(message);
250
- var MAX_DEPTH = 4;
251
- var formatLogMessage = (message, options = {}, depth2 = 0) => {
252
- if (depth2 > MAX_DEPTH) {
253
- return "<max depth>";
254
- }
255
- const prefix = options.prefix ?? "-";
256
- const skip = options.skip ?? [];
257
- return typeof message === "undefined" || message === null || !message && typeof message !== "boolean" ? "<none>" : typeof message === "string" ? message : Array.isArray(message) ? `
258
- ${message.map((item, index) => ` ${prefix}> #${index} = ${formatLogMessage(item, { prefix: `${prefix}-`, skip }, depth2 + 1)}`).join("\n")}` : typeof message === "object" ? `
259
- ${Object.keys(message).filter((key) => !skip.includes(key)).map(
260
- (key) => ` ${prefix}> ${key} = ${_isFunction(message[key]) ? "<function>" : typeof message[key] === "object" ? formatLogMessage(
261
- message[key],
262
- { prefix: `${prefix}-`, skip },
263
- depth2 + 1
264
- ) : message[key]}`
265
- ).join("\n")}` : message;
266
- };
267
- var _isFunction = (value) => {
268
- try {
269
- return value instanceof Function || typeof value === "function" || !!(value?.constructor && value?.call && value?.apply);
270
- } catch {
271
- return false;
272
- }
273
- };
274
-
275
- // ../config-tools/src/utilities/process-handler.ts
276
- var exitWithError = (config) => {
277
- writeFatal("Exiting script with an error status...", config);
278
- process.exit(1);
279
- };
280
- var exitWithSuccess = (config) => {
281
- writeSuccess("Script completed successfully. Exiting...", config);
282
- process.exit(0);
283
- };
284
- var handleProcess = (config) => {
285
- writeTrace(
286
- `Using the following arguments to process the script: ${process.argv.join(", ")}`,
287
- config
288
- );
289
- process.on("unhandledRejection", (error) => {
290
- writeError(
291
- `An Unhandled Rejection occurred while running the program: ${error}`,
292
- config
293
- );
294
- exitWithError(config);
295
- });
296
- process.on("uncaughtException", (error) => {
297
- writeError(
298
- `An Uncaught Exception occurred while running the program: ${error.message}
299
- Stacktrace: ${error.stack}`,
300
- config
301
- );
302
- exitWithError(config);
303
- });
304
- process.on("SIGTERM", (signal) => {
305
- writeError(`The program terminated with signal code: ${signal}`, config);
306
- exitWithError(config);
307
- });
308
- process.on("SIGINT", (signal) => {
309
- writeError(`The program terminated with signal code: ${signal}`, config);
310
- exitWithError(config);
311
- });
312
- process.on("SIGHUP", (signal) => {
313
- writeError(`The program terminated with signal code: ${signal}`, config);
314
- exitWithError(config);
315
- });
316
- };
317
-
318
- // ../config/src/constants.ts
319
- var STORM_DEFAULT_DOCS = "https://docs.stormsoftware.com";
320
- var STORM_DEFAULT_HOMEPAGE = "https://stormsoftware.com";
321
- var STORM_DEFAULT_LICENSING = "https://stormsoftware.com/license";
322
- var STORM_DEFAULT_LICENSE = "Apache-2.0";
323
- var STORM_DEFAULT_ERROR_CODES_FILE = "tools/errors/codes.json";
324
- var STORM_DEFAULT_BANNER_ALT = "The workspace's banner image";
325
-
326
- // ../config/src/schema.ts
327
- var schemaRegistry = z.registry();
328
- var colorSchema = z.string().check(
329
- z.length(7),
330
- z.toLowerCase(),
331
- z.regex(/^#([0-9a-f]{3}){1,2}$/i),
332
- z.trim()
333
- );
334
- schemaRegistry.add(colorSchema, {
335
- description: "A base schema for describing the format of colors"
336
- });
337
- var darkColorSchema = z._default(colorSchema, "#151718");
338
- schemaRegistry.add(darkColorSchema, {
339
- description: "The dark background color of the workspace"
340
- });
341
- var lightColorSchema = z._default(colorSchema, "#cbd5e1");
342
- schemaRegistry.add(lightColorSchema, {
343
- description: "The light background color of the workspace"
344
- });
345
- var brandColorSchema = z._default(colorSchema, "#1fb2a6");
346
- schemaRegistry.add(brandColorSchema, {
347
- description: "The primary brand specific color of the workspace"
348
- });
349
- var alternateColorSchema = z.optional(colorSchema);
350
- schemaRegistry.add(alternateColorSchema, {
351
- description: "The alternate brand specific color of the workspace"
352
- });
353
- var accentColorSchema = z.optional(colorSchema);
354
- schemaRegistry.add(accentColorSchema, {
355
- description: "The secondary brand specific color of the workspace"
356
- });
357
- var linkColorSchema = z._default(colorSchema, "#3fa6ff");
358
- schemaRegistry.add(linkColorSchema, {
359
- description: "The color used to display hyperlink text"
360
- });
361
- var helpColorSchema = z._default(colorSchema, "#818cf8");
362
- schemaRegistry.add(helpColorSchema, {
363
- description: "The second brand specific color of the workspace"
364
- });
365
- var successColorSchema = z._default(colorSchema, "#45b27e");
366
- schemaRegistry.add(successColorSchema, {
367
- description: "The success color of the workspace"
368
- });
369
- var infoColorSchema = z._default(colorSchema, "#38bdf8");
370
- schemaRegistry.add(infoColorSchema, {
371
- description: "The informational color of the workspace"
372
- });
373
- var warningColorSchema = z._default(colorSchema, "#f3d371");
374
- schemaRegistry.add(warningColorSchema, {
375
- description: "The warning color of the workspace"
376
- });
377
- var dangerColorSchema = z._default(colorSchema, "#d8314a");
378
- schemaRegistry.add(dangerColorSchema, {
379
- description: "The danger color of the workspace"
380
- });
381
- var fatalColorSchema = z.optional(colorSchema);
382
- schemaRegistry.add(fatalColorSchema, {
383
- description: "The fatal color of the workspace"
384
- });
385
- var positiveColorSchema = z._default(colorSchema, "#4ade80");
386
- schemaRegistry.add(positiveColorSchema, {
387
- description: "The positive number color of the workspace"
388
- });
389
- var negativeColorSchema = z._default(colorSchema, "#ef4444");
390
- schemaRegistry.add(negativeColorSchema, {
391
- description: "The negative number color of the workspace"
392
- });
393
- var gradientStopsSchema = z.optional(z.array(colorSchema));
394
- schemaRegistry.add(gradientStopsSchema, {
395
- description: "The color stops for the base gradient color pattern used in the workspace"
396
- });
397
- var darkColorsSchema = z.object({
398
- foreground: lightColorSchema,
399
- background: darkColorSchema,
400
- brand: brandColorSchema,
401
- alternate: alternateColorSchema,
402
- accent: accentColorSchema,
403
- link: linkColorSchema,
404
- help: helpColorSchema,
405
- success: successColorSchema,
406
- info: infoColorSchema,
407
- warning: warningColorSchema,
408
- danger: dangerColorSchema,
409
- fatal: fatalColorSchema,
410
- positive: positiveColorSchema,
411
- negative: negativeColorSchema,
412
- gradient: gradientStopsSchema
413
- });
414
- var lightColorsSchema = z.object({
415
- foreground: darkColorSchema,
416
- background: lightColorSchema,
417
- brand: brandColorSchema,
418
- alternate: alternateColorSchema,
419
- accent: accentColorSchema,
420
- link: linkColorSchema,
421
- help: helpColorSchema,
422
- success: successColorSchema,
423
- info: infoColorSchema,
424
- warning: warningColorSchema,
425
- danger: dangerColorSchema,
426
- fatal: fatalColorSchema,
427
- positive: positiveColorSchema,
428
- negative: negativeColorSchema,
429
- gradient: gradientStopsSchema
430
- });
431
- var multiColorsSchema = z.object({
432
- dark: darkColorsSchema,
433
- light: lightColorsSchema
434
- });
435
- var singleColorsSchema = z.object({
436
- dark: darkColorSchema,
437
- light: lightColorSchema,
438
- brand: brandColorSchema,
439
- alternate: alternateColorSchema,
440
- accent: accentColorSchema,
441
- link: linkColorSchema,
442
- help: helpColorSchema,
443
- success: successColorSchema,
444
- info: infoColorSchema,
445
- warning: warningColorSchema,
446
- danger: dangerColorSchema,
447
- fatal: fatalColorSchema,
448
- positive: positiveColorSchema,
449
- negative: negativeColorSchema,
450
- gradient: gradientStopsSchema
451
- });
452
- var registryUrlConfigSchema = z.optional(z.url());
453
- schemaRegistry.add(registryUrlConfigSchema, {
454
- description: "A remote registry URL used to publish distributable packages"
455
- });
456
- var registrySchema = z._default(
457
- z.object({
458
- github: registryUrlConfigSchema,
459
- npm: registryUrlConfigSchema,
460
- cargo: registryUrlConfigSchema,
461
- cyclone: registryUrlConfigSchema,
462
- container: registryUrlConfigSchema
463
- }),
464
- {}
465
- );
466
- schemaRegistry.add(registrySchema, {
467
- description: "A list of remote registry URLs used by Storm Software"
468
- });
469
- var colorsSchema = z.union([singleColorsSchema, multiColorsSchema]);
470
- schemaRegistry.add(colorsSchema, {
471
- description: "Colors used for various workspace elements"
472
- });
473
- var themeColorsSchema = z.record(
474
- z.union([z.union([z.literal("base"), z.string()]), z.string()]),
475
- colorsSchema
476
- );
477
- schemaRegistry.add(themeColorsSchema, {
478
- description: "Storm theme config values used for styling various package elements"
479
- });
480
- var extendsSchema = z.optional(
481
- z.union([z.string().check(z.trim()), z.array(z.string().check(z.trim()))])
482
- );
483
- schemaRegistry.add(extendsSchema, {
484
- 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."
485
- });
486
- var workspaceBotNameSchema = z.string().check(z.trim());
487
- schemaRegistry.add(workspaceBotNameSchema, {
488
- description: "The workspace bot user's name (this is the bot that will be used to perform various tasks)"
489
- });
490
- var workspaceBotEmailSchema = z.string().check(z.trim());
491
- schemaRegistry.add(workspaceBotEmailSchema, {
492
- description: "The email of the workspace bot"
493
- });
494
- var workspaceBotSchema = z.object({
495
- name: workspaceBotNameSchema,
496
- email: workspaceBotEmailSchema
497
- });
498
- schemaRegistry.add(workspaceBotSchema, {
499
- description: "The workspace's bot user's config used to automated various operations tasks"
500
- });
501
- var workspaceReleaseBannerUrlSchema = z.optional(
502
- z.string().check(z.trim(), z.url())
503
- );
504
- schemaRegistry.add(workspaceReleaseBannerUrlSchema, {
505
- description: "A URL to a banner image used to display the workspace's release"
506
- });
507
- var workspaceReleaseBannerAltSchema = z._default(
508
- z.string().check(z.trim()),
509
- STORM_DEFAULT_BANNER_ALT
510
- );
511
- schemaRegistry.add(workspaceReleaseBannerAltSchema, {
512
- description: "The alt text for the workspace's release banner image"
513
- });
514
- var workspaceReleaseBannerSchema = z.object({
515
- url: workspaceReleaseBannerUrlSchema,
516
- alt: workspaceReleaseBannerAltSchema
517
- });
518
- schemaRegistry.add(workspaceReleaseBannerSchema, {
519
- description: "The workspace's banner image used during the release process"
520
- });
521
- var workspaceReleaseHeaderSchema = z.optional(
522
- z.string().check(z.trim())
523
- );
524
- schemaRegistry.add(workspaceReleaseHeaderSchema, {
525
- description: "A header message appended to the start of the workspace's release notes"
526
- });
527
- var workspaceReleaseFooterSchema = z.optional(
528
- z.string().check(z.trim())
529
- );
530
- schemaRegistry.add(workspaceReleaseFooterSchema, {
531
- description: "A footer message appended to the end of the workspace's release notes"
532
- });
533
- var workspaceReleaseSchema = z.object({
534
- banner: z.union([
535
- workspaceReleaseBannerSchema,
536
- z.string().check(z.trim(), z.url())
537
- ]),
538
- header: workspaceReleaseHeaderSchema,
539
- footer: workspaceReleaseFooterSchema
540
- });
541
- schemaRegistry.add(workspaceReleaseSchema, {
542
- description: "The workspace's release config used during the release process"
543
- });
544
- var workspaceSocialsTwitterSchema = z.optional(
545
- z.string().check(z.trim())
546
- );
547
- schemaRegistry.add(workspaceSocialsTwitterSchema, {
548
- description: "A Twitter/X account associated with the organization/project"
549
- });
550
- var workspaceSocialsDiscordSchema = z.optional(
551
- z.string().check(z.trim())
552
- );
553
- schemaRegistry.add(workspaceSocialsDiscordSchema, {
554
- description: "A Discord account associated with the organization/project"
555
- });
556
- var workspaceSocialsTelegramSchema = z.optional(
557
- z.string().check(z.trim())
558
- );
559
- schemaRegistry.add(workspaceSocialsTelegramSchema, {
560
- description: "A Telegram account associated with the organization/project"
561
- });
562
- var workspaceSocialsSlackSchema = z.optional(
563
- z.string().check(z.trim())
564
- );
565
- schemaRegistry.add(workspaceSocialsSlackSchema, {
566
- description: "A Slack account associated with the organization/project"
567
- });
568
- var workspaceSocialsMediumSchema = z.optional(
569
- z.string().check(z.trim())
570
- );
571
- schemaRegistry.add(workspaceSocialsMediumSchema, {
572
- description: "A Medium account associated with the organization/project"
573
- });
574
- var workspaceSocialsGithubSchema = z.optional(
575
- z.string().check(z.trim())
576
- );
577
- schemaRegistry.add(workspaceSocialsGithubSchema, {
578
- description: "A GitHub account associated with the organization/project"
579
- });
580
- var workspaceSocialsSchema = z.object({
581
- twitter: workspaceSocialsTwitterSchema,
582
- discord: workspaceSocialsDiscordSchema,
583
- telegram: workspaceSocialsTelegramSchema,
584
- slack: workspaceSocialsSlackSchema,
585
- medium: workspaceSocialsMediumSchema,
586
- github: workspaceSocialsGithubSchema
587
- });
588
- schemaRegistry.add(workspaceSocialsSchema, {
589
- description: "The workspace's account config used to store various social media links"
590
- });
591
- var workspaceDirectoryCacheSchema = z.optional(
592
- z.string().check(z.trim())
593
- );
594
- schemaRegistry.add(workspaceDirectoryCacheSchema, {
595
- description: "The directory used to store the environment's cached file data"
596
- });
597
- var workspaceDirectoryDataSchema = z.optional(
598
- z.string().check(z.trim())
599
- );
600
- schemaRegistry.add(workspaceDirectoryDataSchema, {
601
- description: "The directory used to store the environment's data files"
602
- });
603
- var workspaceDirectoryConfigSchema = z.optional(
604
- z.string().check(z.trim())
605
- );
606
- schemaRegistry.add(workspaceDirectoryConfigSchema, {
607
- description: "The directory used to store the environment's configuration files"
608
- });
609
- var workspaceDirectoryTempSchema = z.optional(
610
- z.string().check(z.trim())
611
- );
612
- schemaRegistry.add(workspaceDirectoryTempSchema, {
613
- description: "The directory used to store the environment's temp files"
614
- });
615
- var workspaceDirectoryLogSchema = z.optional(
616
- z.string().check(z.trim())
617
- );
618
- schemaRegistry.add(workspaceDirectoryLogSchema, {
619
- description: "The directory used to store the environment's log files"
620
- });
621
- var workspaceDirectoryBuildSchema = z._default(
622
- z.string().check(z.trim()),
623
- "dist"
624
- );
625
- schemaRegistry.add(workspaceDirectoryBuildSchema, {
626
- description: "The directory used to store the workspace's distributable files after a build (relative to the workspace root)"
627
- });
628
- var workspaceDirectorySchema = z.object({
629
- cache: workspaceDirectoryCacheSchema,
630
- data: workspaceDirectoryDataSchema,
631
- config: workspaceDirectoryConfigSchema,
632
- temp: workspaceDirectoryTempSchema,
633
- log: workspaceDirectoryLogSchema,
634
- build: workspaceDirectoryBuildSchema
635
- });
636
- schemaRegistry.add(workspaceDirectorySchema, {
637
- description: "Various directories used by the workspace to store data, cache, and configuration files"
638
- });
639
- var errorCodesFileSchema = z._default(
640
- z.string().check(z.trim()),
641
- STORM_DEFAULT_ERROR_CODES_FILE
642
- );
643
- schemaRegistry.add(errorCodesFileSchema, {
644
- description: "The path to the workspace's error codes JSON file"
645
- });
646
- var errorUrlSchema = z.optional(z.url());
647
- schemaRegistry.add(errorUrlSchema, {
648
- description: "A URL to a page that looks up the workspace's error messages given a specific error code"
649
- });
650
- var errorSchema = z.object({
651
- codesFile: errorCodesFileSchema,
652
- url: errorUrlSchema
653
- });
654
- schemaRegistry.add(errorSchema, {
655
- description: "The workspace's error config used when creating error details during a system error"
656
- });
657
- var organizationNameSchema = z.optional(
658
- z.string().check(z.trim(), z.toLowerCase())
659
- );
660
- schemaRegistry.add(organizationNameSchema, {
661
- description: "The name of the organization"
662
- });
663
- var organizationDescriptionSchema = z.optional(
664
- z.string().check(z.trim())
665
- );
666
- schemaRegistry.add(organizationDescriptionSchema, {
667
- description: "A description of the organization"
668
- });
669
- var organizationLogoSchema = z.optional(z.url());
670
- schemaRegistry.add(organizationLogoSchema, {
671
- description: "A URL to the organization's logo image"
672
- });
673
- var organizationIconSchema = z.optional(z.url());
674
- schemaRegistry.add(organizationIconSchema, {
675
- description: "A URL to the organization's icon image"
676
- });
677
- var organizationUrlSchema = z.optional(z.url());
678
- schemaRegistry.add(organizationUrlSchema, {
679
- description: "A URL to a page that provides more information about the organization"
680
- });
681
- var organizationSchema = z.object({
682
- name: organizationNameSchema,
683
- description: organizationDescriptionSchema,
684
- logo: organizationLogoSchema,
685
- icon: organizationIconSchema,
686
- url: organizationUrlSchema
687
- });
688
- schemaRegistry.add(organizationSchema, {
689
- description: "The workspace's organization details"
690
- });
691
- var schemaNameSchema = z._default(
692
- z.string().check(z.trim(), z.toLowerCase()),
693
- "https://public.storm-cdn.com/schemas/storm-workspace.schema.json"
694
- );
695
- schemaRegistry.add(schemaNameSchema, {
696
- description: "The URL or file path to the JSON schema file that describes the Storm configuration file"
697
- });
698
- var nameSchema = z.string().check(z.trim(), z.toLowerCase());
699
- schemaRegistry.add(nameSchema, {
700
- description: "The name of the workspace/project/service/package/scope using this configuration"
701
- });
702
- var namespaceSchema = z.string().check(z.trim(), z.toLowerCase());
703
- schemaRegistry.add(namespaceSchema, {
704
- description: "The namespace of the workspace/project/service/package/scope using this configuration"
705
- });
706
- var orgSchema = z.union([
707
- organizationSchema,
708
- z.string().check(z.trim(), z.toLowerCase())
709
- ]);
710
- schemaRegistry.add(orgSchema, {
711
- description: "The organization of the workspace. This can be a string or an object containing the organization's details"
712
- });
713
- var repositorySchema = z.string().check(z.trim(), z.toLowerCase());
714
- schemaRegistry.add(repositorySchema, {
715
- description: "The repo URL of the workspace (i.e. the GitHub repository URL)"
716
- });
717
- var licenseSchema = z._default(
718
- z.string().check(z.trim()),
719
- "Apache-2.0"
720
- );
721
- schemaRegistry.add(licenseSchema, {
722
- description: "The license type of the package"
723
- });
724
- var homepageSchema = z.optional(z.url());
725
- schemaRegistry.add(homepageSchema, {
726
- description: "The homepage of the workspace"
727
- });
728
- var docsSchema = z.optional(z.url());
729
- schemaRegistry.add(docsSchema, {
730
- description: "The documentation site for the workspace"
731
- });
732
- var portalSchema = z.optional(z.url());
733
- schemaRegistry.add(portalSchema, {
734
- description: "The development portal site for the workspace"
735
- });
736
- var licensingSchema = z.optional(z.url());
737
- schemaRegistry.add(licensingSchema, {
738
- description: "The licensing site for the workspace"
739
- });
740
- var contactSchema = z.optional(z.url());
741
- schemaRegistry.add(contactSchema, {
742
- description: "The contact site for the workspace"
743
- });
744
- var supportSchema = z.optional(z.url());
745
- schemaRegistry.add(supportSchema, {
746
- description: "The support site for the workspace. If not provided, this is defaulted to the `contact` config value"
747
- });
748
- var branchSchema = z._default(
749
- z.string().check(z.trim(), z.toLowerCase()),
750
- "main"
751
- );
752
- schemaRegistry.add(branchSchema, {
753
- description: "The branch of the workspace"
754
- });
755
- var preidSchema = z.optional(
756
- z.string().check(z.trim(), z.toLowerCase())
757
- );
758
- schemaRegistry.add(preidSchema, {
759
- description: "A tag specifying the version pre-release identifier"
760
- });
761
- var ownerSchema = z.optional(
762
- z.string().check(z.trim(), z.toLowerCase())
763
- );
764
- schemaRegistry.add(ownerSchema, {
765
- description: "The owner of the package"
766
- });
767
- var modeSchema = z._default(
768
- z.enum(["development", "staging", "production"]).check(z.trim(), z.toLowerCase()),
769
- "production"
770
- );
771
- schemaRegistry.add(modeSchema, {
772
- description: "The current runtime environment mode for the package"
773
- });
774
- var workspaceRootSchema = z.string().check(z.trim(), z.toLowerCase());
775
- schemaRegistry.add(workspaceRootSchema, {
776
- description: "The root directory of the workspace"
777
- });
778
- var skipCacheSchema = z._default(z.boolean(), false);
779
- schemaRegistry.add(skipCacheSchema, {
780
- description: "Should all known types of workspace caching be skipped?"
781
- });
782
- var packageManagerSchema = z._default(
783
- z.enum(["npm", "yarn", "pnpm", "bun"]),
784
- "npm"
785
- );
786
- schemaRegistry.add(packageManagerSchema, {
787
- description: "The JavaScript/TypeScript package manager used by the repository"
788
- });
789
- var timezoneSchema = z._default(
790
- z.string().check(z.trim(), z.toLowerCase()),
791
- "America/New_York"
792
- );
793
- schemaRegistry.add(timezoneSchema, {
794
- description: "The default timezone of the workspace"
795
- });
796
- var localeSchema = z._default(
797
- z.string().check(z.trim(), z.toLowerCase()),
798
- "en-US"
799
- );
800
- schemaRegistry.add(localeSchema, {
801
- description: "The default locale of the workspace"
802
- });
803
- var logLevelSchema = z._default(
804
- z.enum([
805
- "silent",
806
- "fatal",
807
- "error",
808
- "warn",
809
- "success",
810
- "info",
811
- "debug",
812
- "trace",
813
- "all"
814
- ]),
815
- "info"
816
- );
817
- schemaRegistry.add(logLevelSchema, {
818
- 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`)."
819
- });
820
- var skipConfigLoggingSchema = z._default(z.boolean(), true);
821
- schemaRegistry.add(skipConfigLoggingSchema, {
822
- description: "Should the logging of the current Storm Workspace configuration be skipped?"
823
- });
824
- var configFileSchema = z._default(
825
- z.nullable(z.string().check(z.trim())),
826
- null
827
- );
828
- schemaRegistry.add(configFileSchema, {
829
- description: "The filepath of the Storm config. When this field is null, no config file was found in the current workspace."
830
- });
831
- var extensionsSchema = z._default(z.record(z.string(), z.any()), {});
832
- schemaRegistry.add(extensionsSchema, {
833
- description: "Configuration of each used extension"
834
- });
835
- var workspaceConfigSchema = z.object({
836
- $schema: schemaNameSchema,
837
- extends: extendsSchema,
838
- name: nameSchema,
839
- namespace: namespaceSchema,
840
- organization: orgSchema,
841
- repository: repositorySchema,
842
- license: licenseSchema,
843
- homepage: homepageSchema,
844
- docs: docsSchema,
845
- portal: portalSchema,
846
- licensing: licensingSchema,
847
- contact: contactSchema,
848
- support: supportSchema,
849
- branch: branchSchema,
850
- preid: preidSchema,
851
- owner: ownerSchema,
852
- bot: workspaceBotSchema,
853
- release: workspaceReleaseSchema,
854
- socials: workspaceSocialsSchema,
855
- error: errorSchema,
856
- mode: modeSchema,
857
- workspaceRoot: workspaceRootSchema,
858
- skipCache: skipCacheSchema,
859
- directories: workspaceDirectorySchema,
860
- packageManager: packageManagerSchema,
861
- timezone: timezoneSchema,
862
- locale: localeSchema,
863
- logLevel: logLevelSchema,
864
- skipConfigLogging: skipConfigLoggingSchema,
865
- registry: registrySchema,
866
- configFile: configFileSchema,
867
- colors: z.union([colorsSchema, themeColorsSchema]),
868
- extensions: extensionsSchema
869
- });
870
- schemaRegistry.add(extensionsSchema, {
871
- 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."
872
- });
873
-
874
- // ../../node_modules/.pnpm/defu@6.1.4/node_modules/defu/dist/defu.mjs
875
- function isPlainObject(value) {
876
- if (value === null || typeof value !== "object") {
877
- return false;
878
- }
879
- const prototype = Object.getPrototypeOf(value);
880
- if (prototype !== null && prototype !== Object.prototype && Object.getPrototypeOf(prototype) !== null) {
881
- return false;
882
- }
883
- if (Symbol.iterator in value) {
884
- return false;
885
- }
886
- if (Symbol.toStringTag in value) {
887
- return Object.prototype.toString.call(value) === "[object Module]";
888
- }
889
- return true;
890
- }
891
- function _defu(baseObject, defaults, namespace = ".", merger) {
892
- if (!isPlainObject(defaults)) {
893
- return _defu(baseObject, {}, namespace, merger);
894
- }
895
- const object2 = Object.assign({}, defaults);
896
- for (const key in baseObject) {
897
- if (key === "__proto__" || key === "constructor") {
898
- continue;
899
- }
900
- const value = baseObject[key];
901
- if (value === null || value === void 0) {
902
- continue;
903
- }
904
- if (merger && merger(object2, key, value, namespace)) {
905
- continue;
906
- }
907
- if (Array.isArray(value) && Array.isArray(object2[key])) {
908
- object2[key] = [...value, ...object2[key]];
909
- } else if (isPlainObject(value) && isPlainObject(object2[key])) {
910
- object2[key] = _defu(
911
- value,
912
- object2[key],
913
- (namespace ? `${namespace}.` : "") + key.toString(),
914
- merger
915
- );
916
- } else {
917
- object2[key] = value;
918
- }
919
- }
920
- return object2;
921
- }
922
- function createDefu(merger) {
923
- return (...arguments_) => (
924
- // eslint-disable-next-line unicorn/no-array-reduce
925
- arguments_.reduce((p, c) => _defu(p, c, "", merger), {})
926
- );
927
- }
928
- var defu = createDefu();
929
-
930
- // ../config-tools/src/utilities/correct-paths.ts
931
- var _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
932
- function normalizeWindowsPath(input = "") {
933
- if (!input) {
934
- return input;
935
- }
936
- return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
937
- }
938
- var _UNC_REGEX = /^[/\\]{2}/;
939
- var _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
940
- var _DRIVE_LETTER_RE = /^[A-Za-z]:$/;
941
- var correctPaths = function(path) {
942
- if (!path || path.length === 0) {
943
- return ".";
944
- }
945
- path = normalizeWindowsPath(path);
946
- const isUNCPath = path.match(_UNC_REGEX);
947
- const isPathAbsolute = isAbsolute(path);
948
- const trailingSeparator = path[path.length - 1] === "/";
949
- path = normalizeString(path, !isPathAbsolute);
950
- if (path.length === 0) {
951
- if (isPathAbsolute) {
952
- return "/";
953
- }
954
- return trailingSeparator ? "./" : ".";
955
- }
956
- if (trailingSeparator) {
957
- path += "/";
958
- }
959
- if (_DRIVE_LETTER_RE.test(path)) {
960
- path += "/";
961
- }
962
- if (isUNCPath) {
963
- if (!isPathAbsolute) {
964
- return `//./${path}`;
965
- }
966
- return `//${path}`;
967
- }
968
- return isPathAbsolute && !isAbsolute(path) ? `/${path}` : path;
969
- };
970
- var joinPaths = function(...segments) {
971
- let path = "";
972
- for (const seg of segments) {
973
- if (!seg) {
974
- continue;
975
- }
976
- if (path.length > 0) {
977
- const pathTrailing = path[path.length - 1] === "/";
978
- const segLeading = seg[0] === "/";
979
- const both = pathTrailing && segLeading;
980
- if (both) {
981
- path += seg.slice(1);
982
- } else {
983
- path += pathTrailing || segLeading ? seg : `/${seg}`;
984
- }
985
- } else {
986
- path += seg;
987
- }
988
- }
989
- return correctPaths(path);
990
- };
991
- function normalizeString(path, allowAboveRoot) {
992
- let res = "";
993
- let lastSegmentLength = 0;
994
- let lastSlash = -1;
995
- let dots = 0;
996
- let char = null;
997
- for (let index = 0; index <= path.length; ++index) {
998
- if (index < path.length) {
999
- char = path[index];
1000
- } else if (char === "/") {
1001
- break;
1002
- } else {
1003
- char = "/";
1004
- }
1005
- if (char === "/") {
1006
- if (lastSlash === index - 1 || dots === 1) ; else if (dots === 2) {
1007
- if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
1008
- if (res.length > 2) {
1009
- const lastSlashIndex = res.lastIndexOf("/");
1010
- if (lastSlashIndex === -1) {
1011
- res = "";
1012
- lastSegmentLength = 0;
1013
- } else {
1014
- res = res.slice(0, lastSlashIndex);
1015
- lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
1016
- }
1017
- lastSlash = index;
1018
- dots = 0;
1019
- continue;
1020
- } else if (res.length > 0) {
1021
- res = "";
1022
- lastSegmentLength = 0;
1023
- lastSlash = index;
1024
- dots = 0;
1025
- continue;
1026
- }
1027
- }
1028
- if (allowAboveRoot) {
1029
- res += res.length > 0 ? "/.." : "..";
1030
- lastSegmentLength = 2;
1031
- }
1032
- } else {
1033
- if (res.length > 0) {
1034
- res += `/${path.slice(lastSlash + 1, index)}`;
1035
- } else {
1036
- res = path.slice(lastSlash + 1, index);
1037
- }
1038
- lastSegmentLength = index - lastSlash - 1;
1039
- }
1040
- lastSlash = index;
1041
- dots = 0;
1042
- } else if (char === "." && dots !== -1) {
1043
- ++dots;
1044
- } else {
1045
- dots = -1;
1046
- }
1047
- }
1048
- return res;
1049
- }
1050
- var isAbsolute = function(p) {
1051
- return _IS_ABSOLUTE_RE.test(p);
1052
- };
1053
- var MAX_PATH_SEARCH_DEPTH = 30;
1054
- var depth = 0;
1055
- function findFolderUp(startPath, endFileNames = [], endDirectoryNames = []) {
1056
- const _startPath = startPath ?? process.cwd();
1057
- if (endDirectoryNames.some(
1058
- (endDirName) => existsSync(join(_startPath, endDirName))
1059
- )) {
1060
- return _startPath;
1061
- }
1062
- if (endFileNames.some(
1063
- (endFileName) => existsSync(join(_startPath, endFileName))
1064
- )) {
1065
- return _startPath;
1066
- }
1067
- if (_startPath !== "/" && depth++ < MAX_PATH_SEARCH_DEPTH) {
1068
- const parent = join(_startPath, "..");
1069
- return findFolderUp(parent, endFileNames, endDirectoryNames);
1070
- }
1071
- return void 0;
1072
- }
1073
-
1074
- // ../config-tools/src/utilities/find-workspace-root.ts
1075
- var rootFiles = [
1076
- "storm-workspace.json",
1077
- "storm-workspace.yaml",
1078
- "storm-workspace.yml",
1079
- "storm-workspace.js",
1080
- "storm-workspace.ts",
1081
- ".storm-workspace.json",
1082
- ".storm-workspace.yaml",
1083
- ".storm-workspace.yml",
1084
- ".storm-workspace.js",
1085
- ".storm-workspace.ts",
1086
- "lerna.json",
1087
- "nx.json",
1088
- "turbo.json",
1089
- "npm-workspace.json",
1090
- "yarn-workspace.json",
1091
- "pnpm-workspace.json",
1092
- "npm-workspace.yaml",
1093
- "yarn-workspace.yaml",
1094
- "pnpm-workspace.yaml",
1095
- "npm-workspace.yml",
1096
- "yarn-workspace.yml",
1097
- "pnpm-workspace.yml",
1098
- "npm-lock.json",
1099
- "yarn-lock.json",
1100
- "pnpm-lock.json",
1101
- "npm-lock.yaml",
1102
- "yarn-lock.yaml",
1103
- "pnpm-lock.yaml",
1104
- "npm-lock.yml",
1105
- "yarn-lock.yml",
1106
- "pnpm-lock.yml",
1107
- "bun.lockb"
1108
- ];
1109
- var rootDirectories = [
1110
- ".storm-workspace",
1111
- ".nx",
1112
- ".github",
1113
- ".vscode",
1114
- ".verdaccio"
1115
- ];
1116
- function findWorkspaceRootSafe(pathInsideMonorepo) {
1117
- if (process.env.STORM_WORKSPACE_ROOT || process.env.NX_WORKSPACE_ROOT_PATH) {
1118
- return correctPaths(
1119
- process.env.STORM_WORKSPACE_ROOT ?? process.env.NX_WORKSPACE_ROOT_PATH
1120
- );
1121
- }
1122
- return correctPaths(
1123
- findFolderUp(
1124
- pathInsideMonorepo ?? process.cwd(),
1125
- rootFiles,
1126
- rootDirectories
1127
- )
1128
- );
1129
- }
1130
- function findWorkspaceRoot(pathInsideMonorepo) {
1131
- const result = findWorkspaceRootSafe(pathInsideMonorepo);
1132
- if (!result) {
1133
- throw new Error(
1134
- `Cannot find workspace root upwards from known path. Files search list includes:
1135
- ${rootFiles.join(
1136
- "\n"
1137
- )}
1138
- Path: ${pathInsideMonorepo ? pathInsideMonorepo : process.cwd()}`
1139
- );
1140
- }
1141
- return result;
1142
- }
1143
-
1144
- // ../config/src/types.ts
1145
- var COLOR_KEYS = [
1146
- "dark",
1147
- "light",
1148
- "base",
1149
- "brand",
1150
- "alternate",
1151
- "accent",
1152
- "link",
1153
- "success",
1154
- "help",
1155
- "info",
1156
- "warning",
1157
- "danger",
1158
- "fatal",
1159
- "positive",
1160
- "negative"
1161
- ];
1162
- async function getPackageJsonConfig(root) {
1163
- let license = STORM_DEFAULT_LICENSE;
1164
- let homepage = void 0;
1165
- let support = void 0;
1166
- let name = void 0;
1167
- let namespace = void 0;
1168
- let repository = void 0;
1169
- const workspaceRoot = findWorkspaceRoot(root);
1170
- if (existsSync(join(workspaceRoot, "package.json"))) {
1171
- const file = await readFile(
1172
- joinPaths(workspaceRoot, "package.json"),
1173
- "utf8"
1174
- );
1175
- if (file) {
1176
- const packageJson = JSON.parse(file);
1177
- if (packageJson.name) {
1178
- name = packageJson.name;
1179
- }
1180
- if (packageJson.namespace) {
1181
- namespace = packageJson.namespace;
1182
- }
1183
- if (packageJson.repository) {
1184
- if (typeof packageJson.repository === "string") {
1185
- repository = packageJson.repository;
1186
- } else if (packageJson.repository.url) {
1187
- repository = packageJson.repository.url;
1188
- }
1189
- }
1190
- if (packageJson.license) {
1191
- license = packageJson.license;
1192
- }
1193
- if (packageJson.homepage) {
1194
- homepage = packageJson.homepage;
1195
- }
1196
- if (packageJson.bugs) {
1197
- if (typeof packageJson.bugs === "string") {
1198
- support = packageJson.bugs;
1199
- } else if (packageJson.bugs.url) {
1200
- support = packageJson.bugs.url;
1201
- }
1202
- }
1203
- }
1204
- }
1205
- return {
1206
- workspaceRoot,
1207
- name,
1208
- namespace,
1209
- repository,
1210
- license,
1211
- homepage,
1212
- support
1213
- };
1214
- }
1215
- function applyDefaultConfig(config) {
1216
- if (!config.support && config.contact) {
1217
- config.support = config.contact;
1218
- }
1219
- if (!config.contact && config.support) {
1220
- config.contact = config.support;
1221
- }
1222
- if (config.homepage) {
1223
- if (!config.docs) {
1224
- config.docs = `${config.homepage}/docs`;
1225
- }
1226
- if (!config.license) {
1227
- config.license = `${config.homepage}/license`;
1228
- }
1229
- if (!config.support) {
1230
- config.support = `${config.homepage}/support`;
1231
- }
1232
- if (!config.contact) {
1233
- config.contact = `${config.homepage}/contact`;
1234
- }
1235
- if (!config.error?.codesFile || !config?.error?.url) {
1236
- config.error ??= { codesFile: STORM_DEFAULT_ERROR_CODES_FILE };
1237
- if (config.homepage) {
1238
- config.error.url ??= `${config.homepage}/errors`;
1239
- }
1240
- }
1241
- }
1242
- return config;
1243
- }
1244
-
1245
- // ../config-tools/src/config-file/get-config-file.ts
1246
- var getConfigFileByName = async (fileName, filePath, options = {}) => {
1247
- const workspacePath = filePath || findWorkspaceRoot(filePath);
1248
- const configs = await Promise.all([
1249
- loadConfig({
1250
- cwd: workspacePath,
1251
- packageJson: true,
1252
- name: fileName,
1253
- envName: fileName?.toUpperCase(),
1254
- jitiOptions: {
1255
- debug: false,
1256
- fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : joinPaths(
1257
- process.env.STORM_CACHE_DIR || "node_modules/.cache/storm",
1258
- "jiti"
1259
- )
1260
- },
1261
- ...options
1262
- }),
1263
- loadConfig({
1264
- cwd: workspacePath,
1265
- packageJson: true,
1266
- name: fileName,
1267
- envName: fileName?.toUpperCase(),
1268
- jitiOptions: {
1269
- debug: false,
1270
- fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : joinPaths(
1271
- process.env.STORM_CACHE_DIR || "node_modules/.cache/storm",
1272
- "jiti"
1273
- )
1274
- },
1275
- configFile: fileName,
1276
- ...options
1277
- })
1278
- ]);
1279
- return defu(configs[0] ?? {}, configs[1] ?? {});
1280
- };
1281
- var getConfigFile = async (filePath, additionalFileNames = []) => {
1282
- const workspacePath = filePath ? filePath : findWorkspaceRoot(filePath);
1283
- const result = await getConfigFileByName("storm-workspace", workspacePath);
1284
- let config = result.config;
1285
- const configFile = result.configFile;
1286
- if (config && configFile && Object.keys(config).length > 0 && !config.skipConfigLogging) {
1287
- writeTrace(
1288
- `Found Storm configuration file "${configFile.includes(`${workspacePath}/`) ? configFile.replace(`${workspacePath}/`, "") : configFile}" at "${workspacePath}"`,
1289
- {
1290
- logLevel: "all"
1291
- }
1292
- );
1293
- }
1294
- if (additionalFileNames && additionalFileNames.length > 0) {
1295
- const results = await Promise.all(
1296
- additionalFileNames.map(
1297
- (fileName) => getConfigFileByName(fileName, workspacePath)
1298
- )
1299
- );
1300
- for (const result2 of results) {
1301
- if (result2?.config && result2?.configFile && Object.keys(result2.config).length > 0) {
1302
- if (!config.skipConfigLogging && !result2.config.skipConfigLogging) {
1303
- writeTrace(
1304
- `Found alternative configuration file "${result2.configFile.includes(`${workspacePath}/`) ? result2.configFile.replace(`${workspacePath}/`, "") : result2.configFile}" at "${workspacePath}"`,
1305
- {
1306
- logLevel: "all"
1307
- }
1308
- );
1309
- }
1310
- config = defu(result2.config ?? {}, config ?? {});
1311
- }
1312
- }
1313
- }
1314
- if (!config || Object.keys(config).length === 0) {
1315
- return void 0;
1316
- }
1317
- config.configFile = configFile;
1318
- return config;
1319
- };
1320
- var getConfigEnv = () => {
1321
- const prefix = "STORM_";
1322
- let config = {
1323
- extends: process.env[`${prefix}EXTENDS`] || void 0,
1324
- name: process.env[`${prefix}NAME`] || void 0,
1325
- namespace: process.env[`${prefix}NAMESPACE`] || void 0,
1326
- owner: process.env[`${prefix}OWNER`] || void 0,
1327
- bot: {
1328
- name: process.env[`${prefix}BOT_NAME`] || void 0,
1329
- email: process.env[`${prefix}BOT_EMAIL`] || void 0
1330
- },
1331
- release: {
1332
- banner: {
1333
- url: process.env[`${prefix}RELEASE_BANNER_URL`] || void 0,
1334
- alt: process.env[`${prefix}RELEASE_BANNER_ALT`] || void 0
1335
- },
1336
- header: process.env[`${prefix}RELEASE_HEADER`] || void 0,
1337
- footer: process.env[`${prefix}RELEASE_FOOTER`] || void 0
1338
- },
1339
- error: {
1340
- codesFile: process.env[`${prefix}ERROR_CODES_FILE`] || void 0,
1341
- url: process.env[`${prefix}ERROR_URL`] || void 0
1342
- },
1343
- socials: {
1344
- twitter: process.env[`${prefix}SOCIAL_TWITTER`] || void 0,
1345
- discord: process.env[`${prefix}SOCIAL_DISCORD`] || void 0,
1346
- telegram: process.env[`${prefix}SOCIAL_TELEGRAM`] || void 0,
1347
- slack: process.env[`${prefix}SOCIAL_SLACK`] || void 0,
1348
- medium: process.env[`${prefix}SOCIAL_MEDIUM`] || void 0,
1349
- github: process.env[`${prefix}SOCIAL_GITHUB`] || void 0
1350
- },
1351
- 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`] ? {
1352
- name: process.env[`${prefix}ORG`] || process.env[`${prefix}ORGANIZATION`] || process.env[`${prefix}ORG_NAME`] || process.env[`${prefix}ORGANIZATION_NAME`],
1353
- description: process.env[`${prefix}ORG_DESCRIPTION`] || process.env[`${prefix}ORGANIZATION_DESCRIPTION`] || void 0,
1354
- url: process.env[`${prefix}ORG_URL`] || process.env[`${prefix}ORGANIZATION_URL`] || void 0,
1355
- logo: process.env[`${prefix}ORG_LOGO`] || process.env[`${prefix}ORGANIZATION_LOGO`] || void 0,
1356
- icon: process.env[`${prefix}ORG_ICON`] || process.env[`${prefix}ORGANIZATION_ICON`] || void 0
1357
- } : process.env[`${prefix}ORG`] || process.env[`${prefix}ORGANIZATION`] || process.env[`${prefix}ORG_NAME`] || process.env[`${prefix}ORGANIZATION_NAME`] : void 0,
1358
- packageManager: process.env[`${prefix}PACKAGE_MANAGER`] || void 0,
1359
- license: process.env[`${prefix}LICENSE`] || void 0,
1360
- homepage: process.env[`${prefix}HOMEPAGE`] || void 0,
1361
- docs: process.env[`${prefix}DOCS`] || void 0,
1362
- portal: process.env[`${prefix}PORTAL`] || void 0,
1363
- licensing: process.env[`${prefix}LICENSING`] || void 0,
1364
- contact: process.env[`${prefix}CONTACT`] || void 0,
1365
- support: process.env[`${prefix}SUPPORT`] || void 0,
1366
- timezone: process.env[`${prefix}TIMEZONE`] || process.env.TZ || void 0,
1367
- locale: process.env[`${prefix}LOCALE`] || process.env.LOCALE || void 0,
1368
- configFile: process.env[`${prefix}CONFIG_FILE`] ? correctPaths(process.env[`${prefix}CONFIG_FILE`]) : void 0,
1369
- workspaceRoot: process.env[`${prefix}WORKSPACE_ROOT`] ? correctPaths(process.env[`${prefix}WORKSPACE_ROOT`]) : void 0,
1370
- directories: {
1371
- 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,
1372
- 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,
1373
- 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,
1374
- 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,
1375
- 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,
1376
- 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
1377
- },
1378
- skipCache: process.env[`${prefix}SKIP_CACHE`] !== void 0 ? Boolean(process.env[`${prefix}SKIP_CACHE`]) : void 0,
1379
- mode: (process.env[`${prefix}MODE`] ?? process.env.NODE_ENV ?? process.env.ENVIRONMENT) || void 0,
1380
- // ci:
1381
- // process.env[`${prefix}CI`] !== undefined
1382
- // ? Boolean(
1383
- // process.env[`${prefix}CI`] ??
1384
- // process.env.CI ??
1385
- // process.env.CONTINUOUS_INTEGRATION
1386
- // )
1387
- // : undefined,
1388
- repository: process.env[`${prefix}REPOSITORY`] || void 0,
1389
- branch: process.env[`${prefix}BRANCH`] || void 0,
1390
- preid: process.env[`${prefix}PRE_ID`] || void 0,
1391
- registry: {
1392
- github: process.env[`${prefix}REGISTRY_GITHUB`] || void 0,
1393
- npm: process.env[`${prefix}REGISTRY_NPM`] || void 0,
1394
- cargo: process.env[`${prefix}REGISTRY_CARGO`] || void 0,
1395
- cyclone: process.env[`${prefix}REGISTRY_CYCLONE`] || void 0,
1396
- container: process.env[`${prefix}REGISTRY_CONTAINER`] || void 0
1397
- },
1398
- logLevel: process.env[`${prefix}LOG_LEVEL`] !== null && process.env[`${prefix}LOG_LEVEL`] !== void 0 ? process.env[`${prefix}LOG_LEVEL`] && Number.isSafeInteger(
1399
- Number.parseInt(process.env[`${prefix}LOG_LEVEL`])
1400
- ) ? getLogLevelLabel(
1401
- Number.parseInt(process.env[`${prefix}LOG_LEVEL`])
1402
- ) : process.env[`${prefix}LOG_LEVEL`] : void 0,
1403
- skipConfigLogging: process.env[`${prefix}SKIP_CONFIG_LOGGING`] !== void 0 ? Boolean(process.env[`${prefix}SKIP_CONFIG_LOGGING`]) : void 0
1404
- };
1405
- const themeNames = Object.keys(process.env).filter(
1406
- (envKey) => envKey.startsWith(`${prefix}COLOR_`) && COLOR_KEYS.every(
1407
- (colorKey) => !envKey.startsWith(`${prefix}COLOR_LIGHT_${colorKey}`) && !envKey.startsWith(`${prefix}COLOR_DARK_${colorKey}`)
1408
- )
1409
- );
1410
- config.colors = themeNames.length > 0 ? themeNames.reduce(
1411
- (ret, themeName) => {
1412
- ret[themeName] = getThemeColorsEnv(prefix, themeName);
1413
- return ret;
1414
- },
1415
- {}
1416
- ) : getThemeColorsEnv(prefix);
1417
- if (config.docs === STORM_DEFAULT_DOCS) {
1418
- if (config.homepage === STORM_DEFAULT_HOMEPAGE) {
1419
- config.docs = `${STORM_DEFAULT_HOMEPAGE}/projects/${config.name}/docs`;
1420
- } else {
1421
- config.docs = `${config.homepage}/docs`;
1422
- }
1423
- }
1424
- if (config.licensing === STORM_DEFAULT_LICENSING) {
1425
- if (config.homepage === STORM_DEFAULT_HOMEPAGE) {
1426
- config.licensing = `${STORM_DEFAULT_HOMEPAGE}/projects/${config.name}/licensing`;
1427
- } else {
1428
- config.licensing = `${config.homepage}/docs`;
1429
- }
1430
- }
1431
- const serializedConfig = process.env[`${prefix}CONFIG`];
1432
- if (serializedConfig) {
1433
- const parsed = JSON.parse(serializedConfig);
1434
- config = {
1435
- ...config,
1436
- ...parsed,
1437
- colors: { ...config.colors, ...parsed.colors },
1438
- extensions: { ...config.extensions, ...parsed.extensions }
1439
- };
1440
- }
1441
- return config;
1442
- };
1443
- var getThemeColorsEnv = (prefix, theme) => {
1444
- const themeName = `COLOR_${theme && theme !== "base" ? `${theme}_` : ""}`.toUpperCase();
1445
- return process.env[`${prefix}${themeName}LIGHT_BRAND`] || process.env[`${prefix}${themeName}DARK_BRAND`] ? getMultiThemeColorsEnv(prefix + themeName) : getSingleThemeColorsEnv(prefix + themeName);
1446
- };
1447
- var getSingleThemeColorsEnv = (prefix) => {
1448
- const gradient = [];
1449
- if (process.env[`${prefix}GRADIENT_START`] && process.env[`${prefix}GRADIENT_END`]) {
1450
- gradient.push(
1451
- process.env[`${prefix}GRADIENT_START`],
1452
- process.env[`${prefix}GRADIENT_END`]
1453
- );
1454
- } else if (process.env[`${prefix}GRADIENT_0`] || process.env[`${prefix}GRADIENT_1`]) {
1455
- let index = process.env[`${prefix}GRADIENT_0`] ? 0 : 1;
1456
- while (process.env[`${prefix}GRADIENT_${index}`]) {
1457
- gradient.push(process.env[`${prefix}GRADIENT_${index}`]);
1458
- index++;
1459
- }
1460
- }
1461
- return {
1462
- dark: process.env[`${prefix}DARK`],
1463
- light: process.env[`${prefix}LIGHT`],
1464
- brand: process.env[`${prefix}BRAND`],
1465
- alternate: process.env[`${prefix}ALTERNATE`],
1466
- accent: process.env[`${prefix}ACCENT`],
1467
- link: process.env[`${prefix}LINK`],
1468
- help: process.env[`${prefix}HELP`],
1469
- success: process.env[`${prefix}SUCCESS`],
1470
- info: process.env[`${prefix}INFO`],
1471
- warning: process.env[`${prefix}WARNING`],
1472
- danger: process.env[`${prefix}DANGER`],
1473
- fatal: process.env[`${prefix}FATAL`],
1474
- positive: process.env[`${prefix}POSITIVE`],
1475
- negative: process.env[`${prefix}NEGATIVE`],
1476
- gradient
1477
- };
1478
- };
1479
- var getMultiThemeColorsEnv = (prefix) => {
1480
- return {
1481
- light: getBaseThemeColorsEnv(`${prefix}_LIGHT_`),
1482
- dark: getBaseThemeColorsEnv(`${prefix}_DARK_`)
1483
- };
1484
- };
1485
- var getBaseThemeColorsEnv = (prefix) => {
1486
- const gradient = [];
1487
- if (process.env[`${prefix}GRADIENT_START`] && process.env[`${prefix}GRADIENT_END`]) {
1488
- gradient.push(
1489
- process.env[`${prefix}GRADIENT_START`],
1490
- process.env[`${prefix}GRADIENT_END`]
1491
- );
1492
- } else if (process.env[`${prefix}GRADIENT_0`] || process.env[`${prefix}GRADIENT_1`]) {
1493
- let index = process.env[`${prefix}GRADIENT_0`] ? 0 : 1;
1494
- while (process.env[`${prefix}GRADIENT_${index}`]) {
1495
- gradient.push(process.env[`${prefix}GRADIENT_${index}`]);
1496
- index++;
1497
- }
1498
- }
1499
- return {
1500
- foreground: process.env[`${prefix}FOREGROUND`],
1501
- background: process.env[`${prefix}BACKGROUND`],
1502
- brand: process.env[`${prefix}BRAND`],
1503
- alternate: process.env[`${prefix}ALTERNATE`],
1504
- accent: process.env[`${prefix}ACCENT`],
1505
- link: process.env[`${prefix}LINK`],
1506
- help: process.env[`${prefix}HELP`],
1507
- success: process.env[`${prefix}SUCCESS`],
1508
- info: process.env[`${prefix}INFO`],
1509
- warning: process.env[`${prefix}WARNING`],
1510
- danger: process.env[`${prefix}DANGER`],
1511
- fatal: process.env[`${prefix}FATAL`],
1512
- positive: process.env[`${prefix}POSITIVE`],
1513
- negative: process.env[`${prefix}NEGATIVE`],
1514
- gradient
1515
- };
1516
- };
1517
-
1518
- // ../config-tools/src/env/set-env.ts
1519
- var setExtensionEnv = (extensionName, extension) => {
1520
- for (const key of Object.keys(extension ?? {})) {
1521
- if (extension[key]) {
1522
- const result = key?.replace(
1523
- /([A-Z])+/g,
1524
- (input) => input ? input[0]?.toUpperCase() + input.slice(1) : ""
1525
- ).split(/(?=[A-Z])|[.\-\s_]/).map((x) => x.toLowerCase()) ?? [];
1526
- let extensionKey;
1527
- if (result.length === 0) {
1528
- return;
1529
- }
1530
- if (result.length === 1) {
1531
- extensionKey = result[0]?.toUpperCase() ?? "";
1532
- } else {
1533
- extensionKey = result.reduce((ret, part) => {
1534
- return `${ret}_${part.toLowerCase()}`;
1535
- });
1536
- }
1537
- process.env[`STORM_EXTENSION_${extensionName.toUpperCase()}_${extensionKey.toUpperCase()}`] = extension[key];
1538
- }
1539
- }
1540
- };
1541
- var setConfigEnv = (config) => {
1542
- const prefix = "STORM_";
1543
- if (config.extends) {
1544
- process.env[`${prefix}EXTENDS`] = Array.isArray(config.extends) ? JSON.stringify(config.extends) : config.extends;
1545
- }
1546
- if (config.name) {
1547
- process.env[`${prefix}NAME`] = config.name;
1548
- }
1549
- if (config.namespace) {
1550
- process.env[`${prefix}NAMESPACE`] = config.namespace;
1551
- }
1552
- if (config.owner) {
1553
- process.env[`${prefix}OWNER`] = config.owner;
1554
- }
1555
- if (config.bot) {
1556
- process.env[`${prefix}BOT_NAME`] = config.bot.name;
1557
- process.env[`${prefix}BOT_EMAIL`] = config.bot.email;
1558
- }
1559
- if (config.error) {
1560
- process.env[`${prefix}ERROR_CODES_FILE`] = config.error.codesFile;
1561
- process.env[`${prefix}ERROR_URL`] = config.error.url;
1562
- }
1563
- if (config.release) {
1564
- if (config.release.banner) {
1565
- if (typeof config.release.banner === "string") {
1566
- process.env[`${prefix}RELEASE_BANNER`] = config.release.banner;
1567
- process.env[`${prefix}RELEASE_BANNER_URL`] = config.release.banner;
1568
- } else {
1569
- process.env[`${prefix}RELEASE_BANNER`] = config.release.banner.url;
1570
- process.env[`${prefix}RELEASE_BANNER_URL`] = config.release.banner.url;
1571
- process.env[`${prefix}RELEASE_BANNER_ALT`] = config.release.banner.alt;
1572
- }
1573
- }
1574
- process.env[`${prefix}RELEASE_HEADER`] = config.release.header;
1575
- process.env[`${prefix}RELEASE_FOOTER`] = config.release.footer;
1576
- }
1577
- if (config.socials) {
1578
- if (config.socials.twitter) {
1579
- process.env[`${prefix}SOCIAL_TWITTER`] = config.socials.twitter;
1580
- }
1581
- if (config.socials.discord) {
1582
- process.env[`${prefix}SOCIAL_DISCORD`] = config.socials.discord;
1583
- }
1584
- if (config.socials.telegram) {
1585
- process.env[`${prefix}SOCIAL_TELEGRAM`] = config.socials.telegram;
1586
- }
1587
- if (config.socials.slack) {
1588
- process.env[`${prefix}SOCIAL_SLACK`] = config.socials.slack;
1589
- }
1590
- if (config.socials.medium) {
1591
- process.env[`${prefix}SOCIAL_MEDIUM`] = config.socials.medium;
1592
- }
1593
- if (config.socials.github) {
1594
- process.env[`${prefix}SOCIAL_GITHUB`] = config.socials.github;
1595
- }
1596
- }
1597
- if (config.organization) {
1598
- if (typeof config.organization === "string") {
1599
- process.env[`${prefix}ORG`] = config.organization;
1600
- process.env[`${prefix}ORG_NAME`] = config.organization;
1601
- process.env[`${prefix}ORGANIZATION`] = config.organization;
1602
- process.env[`${prefix}ORGANIZATION_NAME`] = config.organization;
1603
- } else {
1604
- process.env[`${prefix}ORG`] = config.organization.name;
1605
- process.env[`${prefix}ORG_NAME`] = config.organization.name;
1606
- process.env[`${prefix}ORGANIZATION`] = config.organization.name;
1607
- process.env[`${prefix}ORGANIZATION_NAME`] = config.organization.name;
1608
- if (config.organization.url) {
1609
- process.env[`${prefix}ORG_URL`] = config.organization.url;
1610
- process.env[`${prefix}ORGANIZATION_URL`] = config.organization.url;
1611
- }
1612
- if (config.organization.description) {
1613
- process.env[`${prefix}ORG_DESCRIPTION`] = config.organization.description;
1614
- process.env[`${prefix}ORGANIZATION_DESCRIPTION`] = config.organization.description;
1615
- }
1616
- if (config.organization.logo) {
1617
- process.env[`${prefix}ORG_LOGO`] = config.organization.logo;
1618
- process.env[`${prefix}ORGANIZATION_LOGO`] = config.organization.logo;
1619
- }
1620
- if (config.organization.icon) {
1621
- process.env[`${prefix}ORG_ICON`] = config.organization.icon;
1622
- process.env[`${prefix}ORGANIZATION_ICON`] = config.organization.icon;
1623
- }
1624
- }
1625
- }
1626
- if (config.packageManager) {
1627
- process.env[`${prefix}PACKAGE_MANAGER`] = config.packageManager;
1628
- }
1629
- if (config.license) {
1630
- process.env[`${prefix}LICENSE`] = config.license;
1631
- }
1632
- if (config.homepage) {
1633
- process.env[`${prefix}HOMEPAGE`] = config.homepage;
1634
- }
1635
- if (config.docs) {
1636
- process.env[`${prefix}DOCS`] = config.docs;
1637
- }
1638
- if (config.portal) {
1639
- process.env[`${prefix}PORTAL`] = config.portal;
1640
- }
1641
- if (config.licensing) {
1642
- process.env[`${prefix}LICENSING`] = config.licensing;
1643
- }
1644
- if (config.contact) {
1645
- process.env[`${prefix}CONTACT`] = config.contact;
1646
- }
1647
- if (config.support) {
1648
- process.env[`${prefix}SUPPORT`] = config.support;
1649
- }
1650
- if (config.timezone) {
1651
- process.env[`${prefix}TIMEZONE`] = config.timezone;
1652
- process.env.TZ = config.timezone;
1653
- process.env.DEFAULT_TIMEZONE = config.timezone;
1654
- process.env.TIMEZONE = config.timezone;
1655
- }
1656
- if (config.locale) {
1657
- process.env[`${prefix}LOCALE`] = config.locale;
1658
- process.env.DEFAULT_LOCALE = config.locale;
1659
- process.env.LOCALE = config.locale;
1660
- process.env.LANG = config.locale ? `${config.locale.replaceAll("-", "_")}.UTF-8` : "en_US.UTF-8";
1661
- }
1662
- if (config.configFile) {
1663
- process.env[`${prefix}CONFIG_FILE`] = correctPaths(config.configFile);
1664
- }
1665
- if (config.workspaceRoot) {
1666
- process.env[`${prefix}WORKSPACE_ROOT`] = correctPaths(config.workspaceRoot);
1667
- process.env.NX_WORKSPACE_ROOT = correctPaths(config.workspaceRoot);
1668
- process.env.NX_WORKSPACE_ROOT_PATH = correctPaths(config.workspaceRoot);
1669
- }
1670
- if (config.directories) {
1671
- if (!config.skipCache && config.directories.cache) {
1672
- process.env[`${prefix}CACHE_DIR`] = correctPaths(
1673
- config.directories.cache
1674
- );
1675
- process.env[`${prefix}CACHE_DIRECTORY`] = process.env[`${prefix}CACHE_DIR`];
1676
- }
1677
- if (config.directories.data) {
1678
- process.env[`${prefix}DATA_DIR`] = correctPaths(config.directories.data);
1679
- process.env[`${prefix}DATA_DIRECTORY`] = process.env[`${prefix}DATA_DIR`];
1680
- }
1681
- if (config.directories.config) {
1682
- process.env[`${prefix}CONFIG_DIR`] = correctPaths(
1683
- config.directories.config
1684
- );
1685
- process.env[`${prefix}CONFIG_DIRECTORY`] = process.env[`${prefix}CONFIG_DIR`];
1686
- }
1687
- if (config.directories.temp) {
1688
- process.env[`${prefix}TEMP_DIR`] = correctPaths(config.directories.temp);
1689
- process.env[`${prefix}TEMP_DIRECTORY`] = process.env[`${prefix}TEMP_DIR`];
1690
- }
1691
- if (config.directories.log) {
1692
- process.env[`${prefix}LOG_DIR`] = correctPaths(config.directories.log);
1693
- process.env[`${prefix}LOG_DIRECTORY`] = process.env[`${prefix}LOG_DIR`];
1694
- }
1695
- if (config.directories.build) {
1696
- process.env[`${prefix}BUILD_DIR`] = correctPaths(
1697
- config.directories.build
1698
- );
1699
- process.env[`${prefix}BUILD_DIRECTORY`] = process.env[`${prefix}BUILD_DIR`];
1700
- }
1701
- }
1702
- if (config.skipCache !== void 0) {
1703
- process.env[`${prefix}SKIP_CACHE`] = String(config.skipCache);
1704
- if (config.skipCache) {
1705
- process.env.NX_SKIP_NX_CACHE ??= String(config.skipCache);
1706
- process.env.NX_CACHE_PROJECT_GRAPH ??= String(config.skipCache);
1707
- }
1708
- }
1709
- if (config.mode) {
1710
- process.env[`${prefix}MODE`] = config.mode;
1711
- process.env.NODE_ENV = config.mode;
1712
- process.env.ENVIRONMENT = config.mode;
1713
- }
1714
- if (config.colors?.base?.light || config.colors?.base?.dark) {
1715
- for (const key of Object.keys(config.colors)) {
1716
- setThemeColorsEnv(`${prefix}COLOR_${key}_`, config.colors[key]);
1717
- }
1718
- } else {
1719
- setThemeColorsEnv(
1720
- `${prefix}COLOR_`,
1721
- config.colors
1722
- );
1723
- }
1724
- if (config.repository) {
1725
- process.env[`${prefix}REPOSITORY`] = config.repository;
1726
- }
1727
- if (config.branch) {
1728
- process.env[`${prefix}BRANCH`] = config.branch;
1729
- }
1730
- if (config.preid) {
1731
- process.env[`${prefix}PRE_ID`] = String(config.preid);
1732
- }
1733
- if (config.registry) {
1734
- if (config.registry.github) {
1735
- process.env[`${prefix}REGISTRY_GITHUB`] = String(config.registry.github);
1736
- }
1737
- if (config.registry.npm) {
1738
- process.env[`${prefix}REGISTRY_NPM`] = String(config.registry.npm);
1739
- }
1740
- if (config.registry.cargo) {
1741
- process.env[`${prefix}REGISTRY_CARGO`] = String(config.registry.cargo);
1742
- }
1743
- if (config.registry.cyclone) {
1744
- process.env[`${prefix}REGISTRY_CYCLONE`] = String(
1745
- config.registry.cyclone
1746
- );
1747
- }
1748
- if (config.registry.container) {
1749
- process.env[`${prefix}REGISTRY_CONTAINER`] = String(
1750
- config.registry.container
1751
- );
1752
- }
1753
- }
1754
- if (config.logLevel) {
1755
- process.env[`${prefix}LOG_LEVEL`] = String(config.logLevel);
1756
- process.env.LOG_LEVEL = String(config.logLevel);
1757
- process.env.NX_VERBOSE_LOGGING = String(
1758
- getLogLevel(config.logLevel) >= LogLevel.DEBUG ? true : false
1759
- );
1760
- process.env.RUST_BACKTRACE = getLogLevel(config.logLevel) >= LogLevel.DEBUG ? "full" : "none";
1761
- }
1762
- if (config.skipConfigLogging !== void 0) {
1763
- process.env[`${prefix}SKIP_CONFIG_LOGGING`] = String(
1764
- config.skipConfigLogging
1765
- );
1766
- }
1767
- process.env[`${prefix}CONFIG`] = JSON.stringify(config);
1768
- for (const key of Object.keys(config.extensions ?? {})) {
1769
- if (config.extensions[key] && Object.keys(config.extensions[key])) {
1770
- setExtensionEnv(key, config.extensions[key]);
1771
- }
1772
- }
1773
- };
1774
- var setThemeColorsEnv = (prefix, config) => {
1775
- return config?.light?.brand || config?.dark?.brand ? setMultiThemeColorsEnv(prefix, config) : setSingleThemeColorsEnv(prefix, config);
1776
- };
1777
- var setSingleThemeColorsEnv = (prefix, config) => {
1778
- if (config.dark) {
1779
- process.env[`${prefix}DARK`] = config.dark;
1780
- }
1781
- if (config.light) {
1782
- process.env[`${prefix}LIGHT`] = config.light;
1783
- }
1784
- if (config.brand) {
1785
- process.env[`${prefix}BRAND`] = config.brand;
1786
- }
1787
- if (config.alternate) {
1788
- process.env[`${prefix}ALTERNATE`] = config.alternate;
1789
- }
1790
- if (config.accent) {
1791
- process.env[`${prefix}ACCENT`] = config.accent;
1792
- }
1793
- if (config.link) {
1794
- process.env[`${prefix}LINK`] = config.link;
1795
- }
1796
- if (config.help) {
1797
- process.env[`${prefix}HELP`] = config.help;
1798
- }
1799
- if (config.success) {
1800
- process.env[`${prefix}SUCCESS`] = config.success;
1801
- }
1802
- if (config.info) {
1803
- process.env[`${prefix}INFO`] = config.info;
1804
- }
1805
- if (config.warning) {
1806
- process.env[`${prefix}WARNING`] = config.warning;
1807
- }
1808
- if (config.danger) {
1809
- process.env[`${prefix}DANGER`] = config.danger;
1810
- }
1811
- if (config.fatal) {
1812
- process.env[`${prefix}FATAL`] = config.fatal;
1813
- }
1814
- if (config.positive) {
1815
- process.env[`${prefix}POSITIVE`] = config.positive;
1816
- }
1817
- if (config.negative) {
1818
- process.env[`${prefix}NEGATIVE`] = config.negative;
1819
- }
1820
- if (config.gradient) {
1821
- for (let i = 0; i < config.gradient.length; i++) {
1822
- process.env[`${prefix}GRADIENT_${i}`] = config.gradient[i];
1823
- }
1824
- }
1825
- };
1826
- var setMultiThemeColorsEnv = (prefix, config) => {
1827
- return {
1828
- light: setBaseThemeColorsEnv(`${prefix}LIGHT_`, config.light),
1829
- dark: setBaseThemeColorsEnv(`${prefix}DARK_`, config.dark)
1830
- };
1831
- };
1832
- var setBaseThemeColorsEnv = (prefix, config) => {
1833
- if (config.foreground) {
1834
- process.env[`${prefix}FOREGROUND`] = config.foreground;
1835
- }
1836
- if (config.background) {
1837
- process.env[`${prefix}BACKGROUND`] = config.background;
1838
- }
1839
- if (config.brand) {
1840
- process.env[`${prefix}BRAND`] = config.brand;
1841
- }
1842
- if (config.alternate) {
1843
- process.env[`${prefix}ALTERNATE`] = config.alternate;
1844
- }
1845
- if (config.accent) {
1846
- process.env[`${prefix}ACCENT`] = config.accent;
1847
- }
1848
- if (config.link) {
1849
- process.env[`${prefix}LINK`] = config.link;
1850
- }
1851
- if (config.help) {
1852
- process.env[`${prefix}HELP`] = config.help;
1853
- }
1854
- if (config.success) {
1855
- process.env[`${prefix}SUCCESS`] = config.success;
1856
- }
1857
- if (config.info) {
1858
- process.env[`${prefix}INFO`] = config.info;
1859
- }
1860
- if (config.warning) {
1861
- process.env[`${prefix}WARNING`] = config.warning;
1862
- }
1863
- if (config.danger) {
1864
- process.env[`${prefix}DANGER`] = config.danger;
1865
- }
1866
- if (config.fatal) {
1867
- process.env[`${prefix}FATAL`] = config.fatal;
1868
- }
1869
- if (config.positive) {
1870
- process.env[`${prefix}POSITIVE`] = config.positive;
1871
- }
1872
- if (config.negative) {
1873
- process.env[`${prefix}NEGATIVE`] = config.negative;
1874
- }
1875
- if (config.gradient) {
1876
- for (let i = 0; i < config.gradient.length; i++) {
1877
- process.env[`${prefix}GRADIENT_${i}`] = config.gradient[i];
1878
- }
1879
- }
1880
- };
1881
- var _static_cache = void 0;
1882
- var createStormWorkspaceConfig = async (extensionName, schema, workspaceRoot, skipLogs = false, useDefault = true) => {
1883
- let result;
1884
- if (!_static_cache?.data || !_static_cache?.timestamp || _static_cache.timestamp < Date.now() - 8e3) {
1885
- let _workspaceRoot = workspaceRoot;
1886
- if (!_workspaceRoot) {
1887
- _workspaceRoot = findWorkspaceRoot();
1888
- }
1889
- const configEnv = getConfigEnv();
1890
- const configFile = await getConfigFile(_workspaceRoot);
1891
- if (!configFile) {
1892
- if (!skipLogs) {
1893
- writeWarning(
1894
- "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",
1895
- { logLevel: "all" }
1896
- );
1897
- }
1898
- if (useDefault === false) {
1899
- return void 0;
1900
- }
1901
- }
1902
- const defaultConfig = await getPackageJsonConfig(_workspaceRoot);
1903
- const configInput = defu(
1904
- configEnv,
1905
- configFile,
1906
- defaultConfig
1907
- );
1908
- try {
1909
- result = applyDefaultConfig(
1910
- await workspaceConfigSchema.parseAsync(configInput)
1911
- );
1912
- result.workspaceRoot ??= _workspaceRoot;
1913
- } catch (error) {
1914
- throw new Error(
1915
- `Failed to parse Storm Workspace configuration${error?.message ? `: ${error.message}` : ""}
1916
-
1917
- Please ensure your configuration file is valid JSON and matches the expected schema. The current workspace configuration input is: ${formatLogMessage(
1918
- configInput
1919
- )}`,
1920
- {
1921
- cause: error
1922
- }
1923
- );
1924
- }
1925
- } else {
1926
- result = _static_cache.data;
1927
- }
1928
- _static_cache = {
1929
- timestamp: Date.now(),
1930
- data: result
1931
- };
1932
- return result;
1933
- };
1934
- var loadStormWorkspaceConfig = async (workspaceRoot, skipLogs = false) => {
1935
- const config = await createStormWorkspaceConfig(
1936
- void 0,
1937
- void 0,
1938
- workspaceRoot,
1939
- skipLogs,
1940
- true
1941
- );
1942
- setConfigEnv(config);
1943
- if (!skipLogs && !config.skipConfigLogging) {
1944
- writeTrace(
1945
- `\u2699\uFE0F Using Storm Workspace configuration:
1946
- ${formatLogMessage(config)}`,
1947
- config
1948
- );
1949
- }
1950
- return config;
1951
- };
1952
-
1953
- // ../config-tools/src/get-config.ts
1954
- var getConfig = (workspaceRoot, skipLogs = false) => {
1955
- return loadStormWorkspaceConfig(workspaceRoot, skipLogs);
1956
- };
1957
- var getWorkspaceConfig = (skipLogs = true, options = {}) => {
1958
- let workspaceRoot = options.workspaceRoot;
1959
- if (!workspaceRoot) {
1960
- workspaceRoot = findWorkspaceRoot(options.cwd);
1961
- }
1962
- return getConfig(workspaceRoot, skipLogs);
1963
- };
1964
-
1965
- export { __require, defu, exitWithError, exitWithSuccess, findWorkspaceRootSafe, getConfig, getWorkspaceConfig, handleProcess, isVerbose, joinPaths, writeDebug, writeError, writeFatal, writeInfo, writeSuccess, writeTrace, writeWarning };