@storm-software/git-tools 2.113.23 → 2.113.30

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,11 +1,11 @@
1
1
  'use strict';
2
2
 
3
+ var chalk = require('chalk');
3
4
  var z = require('zod');
5
+ var c12 = require('c12');
4
6
  var fs = require('fs');
5
- var promises = require('fs/promises');
6
7
  var path = require('path');
7
- var chalk = require('chalk');
8
- var c12 = require('c12');
8
+ var promises = require('fs/promises');
9
9
 
10
10
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
11
11
 
@@ -27,8 +27,8 @@ function _interopNamespace(e) {
27
27
  return Object.freeze(n);
28
28
  }
29
29
 
30
- var z__namespace = /*#__PURE__*/_interopNamespace(z);
31
30
  var chalk__default = /*#__PURE__*/_interopDefault(chalk);
31
+ var z__namespace = /*#__PURE__*/_interopNamespace(z);
32
32
 
33
33
  var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
34
34
  get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
@@ -61,878 +61,923 @@ var LogLevelLabel = {
61
61
  ALL: "all"
62
62
  };
63
63
 
64
- // ../config/src/constants.ts
65
- var STORM_DEFAULT_DOCS = "https://docs.stormsoftware.com";
66
- var STORM_DEFAULT_HOMEPAGE = "https://stormsoftware.com";
67
- var STORM_DEFAULT_LICENSING = "https://stormsoftware.com/license";
68
- var STORM_DEFAULT_LICENSE = "Apache-2.0";
69
- var STORM_DEFAULT_SOCIAL_TWITTER = "StormSoftwareHQ";
70
- var STORM_DEFAULT_SOCIAL_DISCORD = "https://discord.gg/MQ6YVzakM5";
71
- var STORM_DEFAULT_SOCIAL_TELEGRAM = "https://t.me/storm_software";
72
- var STORM_DEFAULT_SOCIAL_SLACK = "https://join.slack.com/t/storm-software/shared_invite/zt-2gsmk04hs-i6yhK_r6urq0dkZYAwq2pA";
73
- var STORM_DEFAULT_SOCIAL_MEDIUM = "https://medium.com/storm-software";
74
- var STORM_DEFAULT_SOCIAL_GITHUB = "https://github.com/storm-software";
75
- var STORM_DEFAULT_ERROR_CODES_FILE = "tools/errors/codes.json";
76
- var DarkColorSchema = z__namespace.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#1d1e22").describe("The dark background color of the workspace");
77
- var LightColorSchema = z__namespace.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#f4f4f5").describe("The light background color of the workspace");
78
- var BrandColorSchema = z__namespace.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#1fb2a6").describe("The primary brand specific color of the workspace");
79
- var AlternateColorSchema = z__namespace.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).optional().describe("The alternate brand specific color of the workspace");
80
- var AccentColorSchema = z__namespace.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).optional().describe("The secondary brand specific color of the workspace");
81
- var LinkColorSchema = z__namespace.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).optional().describe("The color used to display hyperlink text");
82
- var HelpColorSchema = z__namespace.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#8256D0").describe("The second brand specific color of the workspace");
83
- var SuccessColorSchema = z__namespace.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#12B66A").describe("The success color of the workspace");
84
- var InfoColorSchema = z__namespace.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#0070E0").describe("The informational color of the workspace");
85
- var WarningColorSchema = z__namespace.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#fcc419").describe("The warning color of the workspace");
86
- var DangerColorSchema = z__namespace.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#D8314A").describe("The danger color of the workspace");
87
- var FatalColorSchema = z__namespace.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).optional().describe("The fatal color of the workspace");
88
- var PositiveColorSchema = z__namespace.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#4ade80").describe("The positive number color of the workspace");
89
- var NegativeColorSchema = z__namespace.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#ef4444").describe("The negative number color of the workspace");
90
- var DarkThemeColorConfigSchema = z__namespace.object({
91
- foreground: LightColorSchema,
92
- background: DarkColorSchema,
93
- brand: BrandColorSchema,
94
- alternate: AlternateColorSchema,
95
- accent: AccentColorSchema,
96
- link: LinkColorSchema,
97
- help: HelpColorSchema,
98
- success: SuccessColorSchema,
99
- info: InfoColorSchema,
100
- warning: WarningColorSchema,
101
- danger: DangerColorSchema,
102
- fatal: FatalColorSchema,
103
- positive: PositiveColorSchema,
104
- negative: NegativeColorSchema
105
- });
106
- var LightThemeColorConfigSchema = z__namespace.object({
107
- foreground: DarkColorSchema,
108
- background: LightColorSchema,
109
- brand: BrandColorSchema,
110
- alternate: AlternateColorSchema,
111
- accent: AccentColorSchema,
112
- link: LinkColorSchema,
113
- help: HelpColorSchema,
114
- success: SuccessColorSchema,
115
- info: InfoColorSchema,
116
- warning: WarningColorSchema,
117
- danger: DangerColorSchema,
118
- fatal: FatalColorSchema,
119
- positive: PositiveColorSchema,
120
- negative: NegativeColorSchema
121
- });
122
- var MultiThemeColorConfigSchema = z__namespace.object({
123
- dark: DarkThemeColorConfigSchema,
124
- light: LightThemeColorConfigSchema
125
- });
126
- var SingleThemeColorConfigSchema = z__namespace.object({
127
- dark: DarkColorSchema,
128
- light: LightColorSchema,
129
- brand: BrandColorSchema,
130
- alternate: AlternateColorSchema,
131
- accent: AccentColorSchema,
132
- link: LinkColorSchema,
133
- help: HelpColorSchema,
134
- success: SuccessColorSchema,
135
- info: InfoColorSchema,
136
- warning: WarningColorSchema,
137
- danger: DangerColorSchema,
138
- fatal: FatalColorSchema,
139
- positive: PositiveColorSchema,
140
- negative: NegativeColorSchema
141
- });
142
- var RegistryUrlConfigSchema = z__namespace.url().optional().describe("A remote registry URL used to publish distributable packages");
143
- var RegistryConfigSchema = z__namespace.object({
144
- github: RegistryUrlConfigSchema,
145
- npm: RegistryUrlConfigSchema,
146
- cargo: RegistryUrlConfigSchema,
147
- cyclone: RegistryUrlConfigSchema,
148
- container: RegistryUrlConfigSchema
149
- }).default({}).describe("A list of remote registry URLs used by Storm Software");
150
- var ColorConfigSchema = SingleThemeColorConfigSchema.or(
151
- MultiThemeColorConfigSchema
152
- ).describe("Colors used for various workspace elements");
153
- var ColorConfigMapSchema = z__namespace.record(
154
- z__namespace.union([z__namespace.literal("base"), z__namespace.string()]),
155
- ColorConfigSchema
156
- );
157
- var ExtendsItemSchema = z__namespace.string().trim().describe(
158
- "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."
159
- );
160
- var ExtendsSchema = ExtendsItemSchema.or(
161
- z__namespace.array(ExtendsItemSchema)
162
- ).describe(
163
- "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."
164
- );
165
- var WorkspaceBotConfigSchema = z__namespace.object({
166
- name: z__namespace.string().trim().default("stormie-bot").describe(
167
- "The workspace bot user's name (this is the bot that will be used to perform various tasks)"
168
- ),
169
- email: z__namespace.email().default("bot@stormsoftware.com").describe("The email of the workspace bot")
170
- }).describe(
171
- "The workspace's bot user's config used to automated various operations tasks"
172
- );
173
- var WorkspaceReleaseConfigSchema = z__namespace.object({
174
- banner: z__namespace.string().trim().optional().describe(
175
- "A URL to a banner image used to display the workspace's release"
176
- ),
177
- header: z__namespace.string().trim().optional().describe(
178
- "A header message appended to the start of the workspace's release notes"
179
- ),
180
- footer: z__namespace.string().trim().optional().describe(
181
- "A footer message appended to the end of the workspace's release notes"
182
- )
183
- }).describe("The workspace's release config used during the release process");
184
- var WorkspaceSocialsConfigSchema = z__namespace.object({
185
- twitter: z__namespace.string().trim().default(STORM_DEFAULT_SOCIAL_TWITTER).describe("A Twitter/X account associated with the organization/project"),
186
- discord: z__namespace.string().trim().default(STORM_DEFAULT_SOCIAL_DISCORD).describe("A Discord account associated with the organization/project"),
187
- telegram: z__namespace.string().trim().default(STORM_DEFAULT_SOCIAL_TELEGRAM).describe("A Telegram account associated with the organization/project"),
188
- slack: z__namespace.string().trim().default(STORM_DEFAULT_SOCIAL_SLACK).describe("A Slack account associated with the organization/project"),
189
- medium: z__namespace.string().trim().default(STORM_DEFAULT_SOCIAL_MEDIUM).describe("A Medium account associated with the organization/project"),
190
- github: z__namespace.string().trim().default(STORM_DEFAULT_SOCIAL_GITHUB).describe("A GitHub account associated with the organization/project")
191
- }).describe(
192
- "The workspace's account config used to store various social media links"
193
- );
194
- var WorkspaceDirectoryConfigSchema = z__namespace.object({
195
- cache: z__namespace.string().trim().optional().describe(
196
- "The directory used to store the environment's cached file data"
197
- ),
198
- data: z__namespace.string().trim().optional().describe("The directory used to store the environment's data files"),
199
- config: z__namespace.string().trim().optional().describe(
200
- "The directory used to store the environment's configuration files"
201
- ),
202
- temp: z__namespace.string().trim().optional().describe("The directory used to store the environment's temp files"),
203
- log: z__namespace.string().trim().optional().describe("The directory used to store the environment's temp files"),
204
- build: z__namespace.string().trim().default("dist").describe(
205
- "The directory used to store the workspace's distributable files after a build (relative to the workspace root)"
206
- )
207
- }).describe(
208
- "Various directories used by the workspace to store data, cache, and configuration files"
209
- );
210
- var errorConfigSchema = z__namespace.object({
211
- codesFile: z__namespace.string().trim().default(STORM_DEFAULT_ERROR_CODES_FILE).describe("The path to the workspace's error codes JSON file"),
212
- url: z__namespace.url().optional().describe(
213
- "A URL to a page that looks up the workspace's error messages given a specific error code"
214
- )
215
- }).describe("The workspace's error config used during the error process");
216
- var organizationConfigSchema = z__namespace.object({
217
- name: z__namespace.string().trim().describe("The name of the organization"),
218
- description: z__namespace.string().trim().optional().describe("A description of the organization"),
219
- logo: z__namespace.url().optional().describe("A URL to the organization's logo image"),
220
- icon: z__namespace.url().optional().describe("A URL to the organization's icon image"),
221
- url: z__namespace.url().optional().describe(
222
- "A URL to a page that provides more information about the organization"
223
- )
224
- }).describe("The workspace's organization details");
225
- var stormWorkspaceConfigSchema = z__namespace.object({
226
- $schema: z__namespace.string().trim().default(
227
- "https://public.storm-cdn.com/schemas/storm-workspace.schema.json"
228
- ).describe(
229
- "The URL or file path to the JSON schema file that describes the Storm configuration file"
230
- ),
231
- extends: ExtendsSchema.optional(),
232
- name: z__namespace.string().trim().toLowerCase().optional().describe(
233
- "The name of the service/package/scope using this configuration"
234
- ),
235
- namespace: z__namespace.string().trim().toLowerCase().optional().describe("The namespace of the package"),
236
- organization: organizationConfigSchema.or(z__namespace.string().trim().describe("The organization of the workspace")).optional().describe(
237
- "The organization of the workspace. This can be a string or an object containing the organization's details"
238
- ),
239
- repository: z__namespace.string().trim().optional().describe("The repo URL of the workspace (i.e. GitHub)"),
240
- license: z__namespace.string().trim().default("Apache-2.0").describe("The license type of the package"),
241
- homepage: z__namespace.url().optional().describe("The homepage of the workspace"),
242
- docs: z__namespace.url().optional().describe("The documentation site for the workspace"),
243
- portal: z__namespace.url().optional().describe("The development portal site for the workspace"),
244
- licensing: z__namespace.url().optional().describe("The licensing site for the workspace"),
245
- contact: z__namespace.url().optional().describe("The contact site for the workspace"),
246
- support: z__namespace.url().optional().describe(
247
- "The support site for the workspace. If not provided, this is defaulted to the `contact` config value"
248
- ),
249
- branch: z__namespace.string().trim().default("main").describe("The branch of the workspace"),
250
- preid: z__namespace.string().optional().describe("A tag specifying the version pre-release identifier"),
251
- owner: z__namespace.string().trim().default("@storm-software/admin").describe("The owner of the package"),
252
- bot: WorkspaceBotConfigSchema,
253
- release: WorkspaceReleaseConfigSchema,
254
- socials: WorkspaceSocialsConfigSchema,
255
- error: errorConfigSchema,
256
- mode: z__namespace.string().trim().default("production").describe("The current runtime environment mode for the package"),
257
- workspaceRoot: z__namespace.string().trim().describe("The root directory of the workspace"),
258
- skipCache: z__namespace.boolean().default(false).describe("Should all known types of workspace caching be skipped?"),
259
- directories: WorkspaceDirectoryConfigSchema,
260
- packageManager: z__namespace.enum(["npm", "yarn", "pnpm", "bun"]).default("npm").describe(
261
- "The JavaScript/TypeScript package manager used by the repository"
262
- ),
263
- timezone: z__namespace.string().trim().default("America/New_York").describe("The default timezone of the workspace"),
264
- locale: z__namespace.string().trim().default("en-US").describe("The default locale of the workspace"),
265
- logLevel: z__namespace.enum([
266
- "silent",
267
- "fatal",
268
- "error",
269
- "warn",
270
- "success",
271
- "info",
272
- "debug",
273
- "trace",
274
- "all"
275
- ]).default("info").describe(
276
- "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`)."
277
- ),
278
- skipConfigLogging: z__namespace.boolean().optional().describe(
279
- "Should the logging of the current Storm Workspace configuration be skipped?"
280
- ),
281
- registry: RegistryConfigSchema,
282
- configFile: z__namespace.string().trim().nullable().default(null).describe(
283
- "The filepath of the Storm config. When this field is null, no config file was found in the current workspace."
284
- ),
285
- colors: ColorConfigSchema.or(ColorConfigMapSchema).describe(
286
- "Storm theme config values used for styling various package elements"
287
- ),
288
- extensions: z__namespace.record(z__namespace.string(), z__namespace.any()).optional().default({}).describe("Configuration of each used extension")
289
- }).describe(
290
- "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."
291
- );
64
+ // ../config-tools/src/utilities/colors.ts
65
+ var DEFAULT_COLOR_CONFIG = {
66
+ dark: {
67
+ brand: "#2dd4bf",
68
+ success: "#10b981",
69
+ info: "#58a6ff",
70
+ warning: "#f3d371",
71
+ danger: "#D8314A",
72
+ fatal: "#a40e26"}
73
+ };
74
+ var chalkDefault = {
75
+ hex: (_) => (message) => message,
76
+ bgHex: (_) => ({
77
+ whiteBright: (message) => message,
78
+ white: (message) => message
79
+ }),
80
+ white: (message) => message,
81
+ whiteBright: (message) => message,
82
+ gray: (message) => message,
83
+ bold: {
84
+ hex: (_) => (message) => message,
85
+ bgHex: (_) => ({
86
+ whiteBright: (message) => message,
87
+ white: (message) => message
88
+ }),
89
+ whiteBright: (message) => message,
90
+ white: (message) => message
91
+ },
92
+ dim: {
93
+ hex: (_) => (message) => message,
94
+ gray: (message) => message
95
+ }
96
+ };
97
+ var getChalk = () => {
98
+ let _chalk = chalk__default.default;
99
+ if (!_chalk?.hex || !_chalk?.bold?.hex || !_chalk?.bgHex || !_chalk?.whiteBright || !_chalk?.white) {
100
+ _chalk = chalkDefault;
101
+ }
102
+ return _chalk;
103
+ };
292
104
 
293
- // ../config/src/types.ts
294
- var COLOR_KEYS = [
295
- "dark",
296
- "light",
297
- "base",
298
- "brand",
299
- "alternate",
300
- "accent",
301
- "link",
302
- "success",
303
- "help",
304
- "info",
305
- "warning",
306
- "danger",
307
- "fatal",
308
- "positive",
309
- "negative"
310
- ];
311
-
312
- // ../config-tools/src/utilities/correct-paths.ts
313
- var _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
314
- function normalizeWindowsPath(input = "") {
315
- if (!input) {
316
- return input;
105
+ // ../config-tools/src/logger/is-unicode-supported.ts
106
+ function isUnicodeSupported() {
107
+ if (process.platform !== "win32") {
108
+ return process.env.TERM !== "linux";
317
109
  }
318
- return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
110
+ return Boolean(process.env.WT_SESSION) || // Windows Terminal
111
+ Boolean(process.env.TERMINUS_SUBLIME) || // Terminus (<0.2.27)
112
+ process.env.ConEmuTask === "{cmd::Cmder}" || // ConEmu and cmder
113
+ 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";
319
114
  }
320
- var _UNC_REGEX = /^[/\\]{2}/;
321
- var _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
322
- var _DRIVE_LETTER_RE = /^[A-Za-z]:$/;
323
- var correctPaths = function(path) {
324
- if (!path || path.length === 0) {
325
- return ".";
115
+
116
+ // ../config-tools/src/logger/console-icons.ts
117
+ var useIcon = (c, fallback) => isUnicodeSupported() ? c : fallback;
118
+ var CONSOLE_ICONS = {
119
+ [LogLevelLabel.ERROR]: useIcon("\u2718", "\xD7"),
120
+ [LogLevelLabel.FATAL]: useIcon("\u{1F480}", "\xD7"),
121
+ [LogLevelLabel.WARN]: useIcon("\u26A0", "\u203C"),
122
+ [LogLevelLabel.INFO]: useIcon("\u2139", "i"),
123
+ [LogLevelLabel.SUCCESS]: useIcon("\u2714", "\u221A"),
124
+ [LogLevelLabel.DEBUG]: useIcon("\u{1F6E0}", "D"),
125
+ [LogLevelLabel.TRACE]: useIcon("\u{1F6E0}", "T"),
126
+ [LogLevelLabel.ALL]: useIcon("\u2709", "\u2192")
127
+ };
128
+
129
+ // ../config-tools/src/logger/format-timestamp.ts
130
+ var formatTimestamp = (date = /* @__PURE__ */ new Date()) => {
131
+ return `${date.toLocaleDateString()} ${date.toLocaleTimeString()}`;
132
+ };
133
+
134
+ // ../config-tools/src/logger/get-log-level.ts
135
+ var getLogLevel = (label) => {
136
+ switch (label) {
137
+ case "all":
138
+ return LogLevel.ALL;
139
+ case "trace":
140
+ return LogLevel.TRACE;
141
+ case "debug":
142
+ return LogLevel.DEBUG;
143
+ case "info":
144
+ return LogLevel.INFO;
145
+ case "warn":
146
+ return LogLevel.WARN;
147
+ case "error":
148
+ return LogLevel.ERROR;
149
+ case "fatal":
150
+ return LogLevel.FATAL;
151
+ case "silent":
152
+ return LogLevel.SILENT;
153
+ default:
154
+ return LogLevel.INFO;
326
155
  }
327
- path = normalizeWindowsPath(path);
328
- const isUNCPath = path.match(_UNC_REGEX);
329
- const isPathAbsolute = isAbsolute(path);
330
- const trailingSeparator = path[path.length - 1] === "/";
331
- path = normalizeString(path, !isPathAbsolute);
332
- if (path.length === 0) {
333
- if (isPathAbsolute) {
334
- return "/";
335
- }
336
- return trailingSeparator ? "./" : ".";
156
+ };
157
+ var getLogLevelLabel = (logLevel = LogLevel.INFO) => {
158
+ if (logLevel >= LogLevel.ALL) {
159
+ return LogLevelLabel.ALL;
337
160
  }
338
- if (trailingSeparator) {
339
- path += "/";
161
+ if (logLevel >= LogLevel.TRACE) {
162
+ return LogLevelLabel.TRACE;
340
163
  }
341
- if (_DRIVE_LETTER_RE.test(path)) {
342
- path += "/";
164
+ if (logLevel >= LogLevel.DEBUG) {
165
+ return LogLevelLabel.DEBUG;
343
166
  }
344
- if (isUNCPath) {
345
- if (!isPathAbsolute) {
346
- return `//./${path}`;
347
- }
348
- return `//${path}`;
167
+ if (logLevel >= LogLevel.INFO) {
168
+ return LogLevelLabel.INFO;
349
169
  }
350
- return isPathAbsolute && !isAbsolute(path) ? `/${path}` : path;
351
- };
352
- var joinPaths = function(...segments) {
353
- let path = "";
354
- for (const seg of segments) {
355
- if (!seg) {
356
- continue;
357
- }
358
- if (path.length > 0) {
359
- const pathTrailing = path[path.length - 1] === "/";
360
- const segLeading = seg[0] === "/";
361
- const both = pathTrailing && segLeading;
362
- if (both) {
363
- path += seg.slice(1);
364
- } else {
365
- path += pathTrailing || segLeading ? seg : `/${seg}`;
366
- }
367
- } else {
368
- path += seg;
369
- }
170
+ if (logLevel >= LogLevel.WARN) {
171
+ return LogLevelLabel.WARN;
370
172
  }
371
- return correctPaths(path);
372
- };
373
- function normalizeString(path, allowAboveRoot) {
374
- let res = "";
375
- let lastSegmentLength = 0;
376
- let lastSlash = -1;
377
- let dots = 0;
378
- let char = null;
379
- for (let index = 0; index <= path.length; ++index) {
380
- if (index < path.length) {
381
- char = path[index];
382
- } else if (char === "/") {
383
- break;
384
- } else {
385
- char = "/";
386
- }
387
- if (char === "/") {
388
- if (lastSlash === index - 1 || dots === 1) ; else if (dots === 2) {
389
- if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
390
- if (res.length > 2) {
391
- const lastSlashIndex = res.lastIndexOf("/");
392
- if (lastSlashIndex === -1) {
393
- res = "";
394
- lastSegmentLength = 0;
395
- } else {
396
- res = res.slice(0, lastSlashIndex);
397
- lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
398
- }
399
- lastSlash = index;
400
- dots = 0;
401
- continue;
402
- } else if (res.length > 0) {
403
- res = "";
404
- lastSegmentLength = 0;
405
- lastSlash = index;
406
- dots = 0;
407
- continue;
408
- }
409
- }
410
- if (allowAboveRoot) {
411
- res += res.length > 0 ? "/.." : "..";
412
- lastSegmentLength = 2;
413
- }
414
- } else {
415
- if (res.length > 0) {
416
- res += `/${path.slice(lastSlash + 1, index)}`;
417
- } else {
418
- res = path.slice(lastSlash + 1, index);
419
- }
420
- lastSegmentLength = index - lastSlash - 1;
421
- }
422
- lastSlash = index;
423
- dots = 0;
424
- } else if (char === "." && dots !== -1) {
425
- ++dots;
426
- } else {
427
- dots = -1;
428
- }
173
+ if (logLevel >= LogLevel.ERROR) {
174
+ return LogLevelLabel.ERROR;
429
175
  }
430
- return res;
431
- }
432
- var isAbsolute = function(p) {
433
- return _IS_ABSOLUTE_RE.test(p);
176
+ if (logLevel >= LogLevel.FATAL) {
177
+ return LogLevelLabel.FATAL;
178
+ }
179
+ if (logLevel <= LogLevel.SILENT) {
180
+ return LogLevelLabel.SILENT;
181
+ }
182
+ return LogLevelLabel.INFO;
434
183
  };
435
- var MAX_PATH_SEARCH_DEPTH = 30;
436
- var depth = 0;
437
- function findFolderUp(startPath, endFileNames = [], endDirectoryNames = []) {
438
- const _startPath = startPath ?? process.cwd();
439
- if (endDirectoryNames.some(
440
- (endDirName) => fs.existsSync(path.join(_startPath, endDirName))
441
- )) {
442
- return _startPath;
184
+ var isVerbose = (label = LogLevelLabel.SILENT) => {
185
+ const logLevel = typeof label === "string" ? getLogLevel(label) : label;
186
+ return logLevel >= LogLevel.DEBUG;
187
+ };
188
+
189
+ // ../config-tools/src/logger/console.ts
190
+ var getLogFn = (logLevel = LogLevel.INFO, config = {}, _chalk = getChalk()) => {
191
+ 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;
192
+ const configLogLevel = config.logLevel || process.env.STORM_LOG_LEVEL || LogLevelLabel.INFO;
193
+ if (logLevel > getLogLevel(configLogLevel) || logLevel <= LogLevel.SILENT || getLogLevel(configLogLevel) <= LogLevel.SILENT) {
194
+ return (_) => {
195
+ };
443
196
  }
444
- if (endFileNames.some(
445
- (endFileName) => fs.existsSync(path.join(_startPath, endFileName))
446
- )) {
447
- return _startPath;
197
+ if (typeof logLevel === "number" && LogLevel.FATAL >= logLevel) {
198
+ return (message) => {
199
+ console.error(
200
+ `
201
+ ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.fatal ?? DEFAULT_COLOR_CONFIG.dark.fatal)(`[${CONSOLE_ICONS[LogLevelLabel.FATAL]} Fatal] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
202
+ `
203
+ );
204
+ };
448
205
  }
449
- if (_startPath !== "/" && depth++ < MAX_PATH_SEARCH_DEPTH) {
450
- const parent = path.join(_startPath, "..");
451
- return findFolderUp(parent, endFileNames, endDirectoryNames);
206
+ if (typeof logLevel === "number" && LogLevel.ERROR >= logLevel) {
207
+ return (message) => {
208
+ console.error(
209
+ `
210
+ ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.danger ?? DEFAULT_COLOR_CONFIG.dark.danger)(`[${CONSOLE_ICONS[LogLevelLabel.ERROR]} Error] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
211
+ `
212
+ );
213
+ };
452
214
  }
453
- return void 0;
454
- }
455
-
456
- // ../config-tools/src/utilities/find-workspace-root.ts
457
- var rootFiles = [
458
- "storm-workspace.json",
459
- "storm-workspace.json",
460
- "storm-workspace.yaml",
461
- "storm-workspace.yml",
462
- "storm-workspace.js",
463
- "storm-workspace.ts",
464
- ".storm-workspace.json",
465
- ".storm-workspace.yaml",
466
- ".storm-workspace.yml",
467
- ".storm-workspace.js",
468
- ".storm-workspace.ts",
469
- "lerna.json",
470
- "nx.json",
471
- "turbo.json",
472
- "npm-workspace.json",
473
- "yarn-workspace.json",
474
- "pnpm-workspace.json",
475
- "npm-workspace.yaml",
476
- "yarn-workspace.yaml",
477
- "pnpm-workspace.yaml",
478
- "npm-workspace.yml",
479
- "yarn-workspace.yml",
480
- "pnpm-workspace.yml",
481
- "npm-lock.json",
482
- "yarn-lock.json",
483
- "pnpm-lock.json",
484
- "npm-lock.yaml",
485
- "yarn-lock.yaml",
486
- "pnpm-lock.yaml",
487
- "npm-lock.yml",
488
- "yarn-lock.yml",
489
- "pnpm-lock.yml",
490
- "bun.lockb"
491
- ];
492
- var rootDirectories = [
493
- ".storm-workspace",
494
- ".nx",
495
- ".github",
496
- ".vscode",
497
- ".verdaccio"
498
- ];
499
- function findWorkspaceRootSafe(pathInsideMonorepo) {
500
- if (process.env.STORM_WORKSPACE_ROOT || process.env.NX_WORKSPACE_ROOT_PATH) {
501
- return correctPaths(
502
- process.env.STORM_WORKSPACE_ROOT ?? process.env.NX_WORKSPACE_ROOT_PATH
503
- );
504
- }
505
- return correctPaths(
506
- findFolderUp(
507
- pathInsideMonorepo ?? process.cwd(),
508
- rootFiles,
509
- rootDirectories
510
- )
511
- );
512
- }
513
- function findWorkspaceRoot(pathInsideMonorepo) {
514
- const result = findWorkspaceRootSafe(pathInsideMonorepo);
515
- if (!result) {
516
- throw new Error(
517
- `Cannot find workspace root upwards from known path. Files search list includes:
518
- ${rootFiles.join(
519
- "\n"
520
- )}
521
- Path: ${pathInsideMonorepo ? pathInsideMonorepo : process.cwd()}`
522
- );
523
- }
524
- return result;
525
- }
526
-
527
- // ../config-tools/src/utilities/get-default-config.ts
528
- var DEFAULT_COLOR_CONFIG = {
529
- };
530
- async function getPackageJsonConfig(root) {
531
- let license = STORM_DEFAULT_LICENSE;
532
- let homepage = void 0;
533
- let support = void 0;
534
- let name = void 0;
535
- let namespace = void 0;
536
- let repository = void 0;
537
- const workspaceRoot = findWorkspaceRoot(root);
538
- if (fs.existsSync(path.join(workspaceRoot, "package.json"))) {
539
- const file = await promises.readFile(
540
- joinPaths(workspaceRoot, "package.json"),
541
- "utf8"
542
- );
543
- if (file) {
544
- const packageJson = JSON.parse(file);
545
- if (packageJson.name) {
546
- name = packageJson.name;
547
- }
548
- if (packageJson.namespace) {
549
- namespace = packageJson.namespace;
550
- }
551
- if (packageJson.repository) {
552
- if (typeof packageJson.repository === "string") {
553
- repository = packageJson.repository;
554
- } else if (packageJson.repository.url) {
555
- repository = packageJson.repository.url;
556
- }
557
- }
558
- if (packageJson.license) {
559
- license = packageJson.license;
560
- }
561
- if (packageJson.homepage) {
562
- homepage = packageJson.homepage;
563
- }
564
- if (packageJson.bugs) {
565
- if (typeof packageJson.bugs === "string") {
566
- support = packageJson.bugs;
567
- } else if (packageJson.bugs.url) {
568
- support = packageJson.bugs.url;
569
- }
570
- }
571
- }
215
+ if (typeof logLevel === "number" && LogLevel.WARN >= logLevel) {
216
+ return (message) => {
217
+ console.warn(
218
+ `
219
+ ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.warning ?? DEFAULT_COLOR_CONFIG.dark.warning)(`[${CONSOLE_ICONS[LogLevelLabel.WARN]} Warn] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
220
+ `
221
+ );
222
+ };
572
223
  }
573
- return {
574
- workspaceRoot,
575
- name,
576
- namespace,
577
- repository,
578
- license,
579
- homepage,
580
- support
581
- };
582
- }
583
- function applyDefaultConfig(config) {
584
- if (!config.support && config.contact) {
585
- config.support = config.contact;
224
+ if (typeof logLevel === "number" && LogLevel.SUCCESS >= logLevel) {
225
+ return (message) => {
226
+ console.info(
227
+ `
228
+ ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.success ?? DEFAULT_COLOR_CONFIG.dark.success)(`[${CONSOLE_ICONS[LogLevelLabel.SUCCESS]} Success] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
229
+ `
230
+ );
231
+ };
586
232
  }
587
- if (!config.contact && config.support) {
588
- config.contact = config.support;
233
+ if (typeof logLevel === "number" && LogLevel.INFO >= logLevel) {
234
+ return (message) => {
235
+ console.info(
236
+ `
237
+ ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.info ?? DEFAULT_COLOR_CONFIG.dark.info)(`[${CONSOLE_ICONS[LogLevelLabel.INFO]} Info] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
238
+ `
239
+ );
240
+ };
589
241
  }
590
- if (config.homepage) {
591
- if (!config.docs) {
592
- config.docs = `${config.homepage}/docs`;
593
- }
594
- if (!config.license) {
595
- config.license = `${config.homepage}/license`;
596
- }
597
- if (!config.support) {
598
- config.support = `${config.homepage}/support`;
599
- }
600
- if (!config.contact) {
601
- config.contact = `${config.homepage}/contact`;
602
- }
603
- if (!config.error?.codesFile || !config?.error?.url) {
604
- config.error ??= { codesFile: STORM_DEFAULT_ERROR_CODES_FILE };
605
- if (config.homepage) {
606
- config.error.url ??= `${config.homepage}/errors`;
607
- }
608
- }
242
+ if (typeof logLevel === "number" && LogLevel.DEBUG >= logLevel) {
243
+ return (message) => {
244
+ console.debug(
245
+ `
246
+ ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.info ?? DEFAULT_COLOR_CONFIG.dark.info)(`[${CONSOLE_ICONS[LogLevelLabel.DEBUG]} Debug] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
247
+ `
248
+ );
249
+ };
609
250
  }
610
- return config;
611
- }
612
- var chalkDefault = {
613
- hex: (_) => (message) => message,
614
- bgHex: (_) => ({
615
- whiteBright: (message) => message,
616
- white: (message) => message
617
- }),
618
- white: (message) => message,
619
- whiteBright: (message) => message,
620
- gray: (message) => message,
621
- bold: {
622
- hex: (_) => (message) => message,
623
- bgHex: (_) => ({
624
- whiteBright: (message) => message,
625
- white: (message) => message
626
- }),
627
- whiteBright: (message) => message,
628
- white: (message) => message
629
- },
630
- dim: {
631
- hex: (_) => (message) => message,
632
- gray: (message) => message
251
+ if (typeof logLevel === "number" && LogLevel.TRACE >= logLevel) {
252
+ return (message) => {
253
+ console.debug(
254
+ `
255
+ ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.info ?? DEFAULT_COLOR_CONFIG.dark.info)(`[${CONSOLE_ICONS[LogLevelLabel.TRACE]} Trace] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
256
+ `
257
+ );
258
+ };
633
259
  }
260
+ return (message) => {
261
+ console.log(
262
+ `
263
+ ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.brand ?? DEFAULT_COLOR_CONFIG.dark.brand)(`[${CONSOLE_ICONS[LogLevelLabel.ALL]} System] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
264
+ `
265
+ );
266
+ };
634
267
  };
635
- var getChalk = () => {
636
- let _chalk = chalk__default.default;
637
- if (!_chalk?.hex || !_chalk?.bold?.hex || !_chalk?.bgHex || !_chalk?.whiteBright || !_chalk?.white) {
638
- _chalk = chalkDefault;
268
+ var writeFatal = (message, config) => getLogFn(LogLevel.FATAL, config)(message);
269
+ var writeError = (message, config) => getLogFn(LogLevel.ERROR, config)(message);
270
+ var writeWarning = (message, config) => getLogFn(LogLevel.WARN, config)(message);
271
+ var writeInfo = (message, config) => getLogFn(LogLevel.INFO, config)(message);
272
+ var writeSuccess = (message, config) => getLogFn(LogLevel.SUCCESS, config)(message);
273
+ var writeDebug = (message, config) => getLogFn(LogLevel.DEBUG, config)(message);
274
+ var writeTrace = (message, config) => getLogFn(LogLevel.TRACE, config)(message);
275
+ var MAX_DEPTH = 4;
276
+ var formatLogMessage = (message, options = {}, depth2 = 0) => {
277
+ if (depth2 > MAX_DEPTH) {
278
+ return "<max depth>";
639
279
  }
640
- return _chalk;
280
+ const prefix = options.prefix ?? "-";
281
+ const skip = options.skip ?? [];
282
+ return typeof message === "undefined" || message === null || !message && typeof message !== "boolean" ? "<none>" : typeof message === "string" ? message : Array.isArray(message) ? `
283
+ ${message.map((item, index) => ` ${prefix}> #${index} = ${formatLogMessage(item, { prefix: `${prefix}-`, skip }, depth2 + 1)}`).join("\n")}` : typeof message === "object" ? `
284
+ ${Object.keys(message).filter((key) => !skip.includes(key)).map(
285
+ (key) => ` ${prefix}> ${key} = ${_isFunction(message[key]) ? "<function>" : typeof message[key] === "object" ? formatLogMessage(
286
+ message[key],
287
+ { prefix: `${prefix}-`, skip },
288
+ depth2 + 1
289
+ ) : message[key]}`
290
+ ).join("\n")}` : message;
641
291
  };
642
-
643
- // ../config-tools/src/logger/is-unicode-supported.ts
644
- function isUnicodeSupported() {
645
- if (process.platform !== "win32") {
646
- return process.env.TERM !== "linux";
292
+ var _isFunction = (value) => {
293
+ try {
294
+ return value instanceof Function || typeof value === "function" || !!(value?.constructor && value?.call && value?.apply);
295
+ } catch {
296
+ return false;
647
297
  }
648
- return Boolean(process.env.WT_SESSION) || // Windows Terminal
649
- Boolean(process.env.TERMINUS_SUBLIME) || // Terminus (<0.2.27)
650
- process.env.ConEmuTask === "{cmd::Cmder}" || // ConEmu and cmder
651
- 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";
652
- }
653
-
654
- // ../config-tools/src/logger/console-icons.ts
655
- var useIcon = (c, fallback) => isUnicodeSupported() ? c : fallback;
656
- var CONSOLE_ICONS = {
657
- [LogLevelLabel.ERROR]: useIcon("\u2718", "\xD7"),
658
- [LogLevelLabel.FATAL]: useIcon("\u{1F480}", "\xD7"),
659
- [LogLevelLabel.WARN]: useIcon("\u26A0", "\u203C"),
660
- [LogLevelLabel.INFO]: useIcon("\u2139", "i"),
661
- [LogLevelLabel.SUCCESS]: useIcon("\u2714", "\u221A"),
662
- [LogLevelLabel.DEBUG]: useIcon("\u{1F6E0}", "D"),
663
- [LogLevelLabel.TRACE]: useIcon("\u{1F6E0}", "T"),
664
- [LogLevelLabel.ALL]: useIcon("\u2709", "\u2192")
665
- };
666
-
667
- // ../config-tools/src/logger/format-timestamp.ts
668
- var formatTimestamp = (date = /* @__PURE__ */ new Date()) => {
669
- return `${date.toLocaleDateString()} ${date.toLocaleTimeString()}`;
670
298
  };
671
299
 
672
- // ../config-tools/src/logger/get-log-level.ts
673
- var getLogLevel = (label) => {
674
- switch (label) {
675
- case "all":
676
- return LogLevel.ALL;
677
- case "trace":
678
- return LogLevel.TRACE;
679
- case "debug":
680
- return LogLevel.DEBUG;
681
- case "info":
682
- return LogLevel.INFO;
683
- case "warn":
684
- return LogLevel.WARN;
685
- case "error":
686
- return LogLevel.ERROR;
687
- case "fatal":
688
- return LogLevel.FATAL;
689
- case "silent":
690
- return LogLevel.SILENT;
691
- default:
692
- return LogLevel.INFO;
693
- }
300
+ // ../config-tools/src/utilities/process-handler.ts
301
+ var exitWithError = (config) => {
302
+ writeFatal("Exiting script with an error status...", config);
303
+ process.exit(1);
694
304
  };
695
- var getLogLevelLabel = (logLevel = LogLevel.INFO) => {
696
- if (logLevel >= LogLevel.ALL) {
697
- return LogLevelLabel.ALL;
305
+ var exitWithSuccess = (config) => {
306
+ writeSuccess("Script completed successfully. Exiting...", config);
307
+ process.exit(0);
308
+ };
309
+ var handleProcess = (config) => {
310
+ writeTrace(
311
+ `Using the following arguments to process the script: ${process.argv.join(", ")}`,
312
+ config
313
+ );
314
+ process.on("unhandledRejection", (error) => {
315
+ writeError(
316
+ `An Unhandled Rejection occurred while running the program: ${error}`,
317
+ config
318
+ );
319
+ exitWithError(config);
320
+ });
321
+ process.on("uncaughtException", (error) => {
322
+ writeError(
323
+ `An Uncaught Exception occurred while running the program: ${error.message}
324
+ Stacktrace: ${error.stack}`,
325
+ config
326
+ );
327
+ exitWithError(config);
328
+ });
329
+ process.on("SIGTERM", (signal) => {
330
+ writeError(`The program terminated with signal code: ${signal}`, config);
331
+ exitWithError(config);
332
+ });
333
+ process.on("SIGINT", (signal) => {
334
+ writeError(`The program terminated with signal code: ${signal}`, config);
335
+ exitWithError(config);
336
+ });
337
+ process.on("SIGHUP", (signal) => {
338
+ writeError(`The program terminated with signal code: ${signal}`, config);
339
+ exitWithError(config);
340
+ });
341
+ };
342
+
343
+ // ../config/src/constants.ts
344
+ var STORM_DEFAULT_DOCS = "https://docs.stormsoftware.com";
345
+ var STORM_DEFAULT_HOMEPAGE = "https://stormsoftware.com";
346
+ var STORM_DEFAULT_LICENSING = "https://stormsoftware.com/license";
347
+ var STORM_DEFAULT_LICENSE = "Apache-2.0";
348
+ var STORM_DEFAULT_SOCIAL_TWITTER = "StormSoftwareHQ";
349
+ var STORM_DEFAULT_SOCIAL_DISCORD = "https://discord.gg/MQ6YVzakM5";
350
+ var STORM_DEFAULT_SOCIAL_TELEGRAM = "https://t.me/storm_software";
351
+ var STORM_DEFAULT_SOCIAL_SLACK = "https://join.slack.com/t/storm-software/shared_invite/zt-2gsmk04hs-i6yhK_r6urq0dkZYAwq2pA";
352
+ var STORM_DEFAULT_SOCIAL_MEDIUM = "https://medium.com/storm-software";
353
+ var STORM_DEFAULT_SOCIAL_GITHUB = "https://github.com/storm-software";
354
+ var STORM_DEFAULT_ERROR_CODES_FILE = "tools/errors/codes.json";
355
+
356
+ // ../config/src/schema.ts
357
+ var ColorSchema = z__namespace.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7);
358
+ var DarkColorSchema = ColorSchema.default("#151718").describe(
359
+ "The dark background color of the workspace"
360
+ );
361
+ var LightColorSchema = ColorSchema.default("#cbd5e1").describe(
362
+ "The light background color of the workspace"
363
+ );
364
+ var BrandColorSchema = ColorSchema.default("#1fb2a6").describe(
365
+ "The primary brand specific color of the workspace"
366
+ );
367
+ var AlternateColorSchema = ColorSchema.optional().describe(
368
+ "The alternate brand specific color of the workspace"
369
+ );
370
+ var AccentColorSchema = ColorSchema.optional().describe(
371
+ "The secondary brand specific color of the workspace"
372
+ );
373
+ var LinkColorSchema = ColorSchema.default("#3fa6ff").describe(
374
+ "The color used to display hyperlink text"
375
+ );
376
+ var HelpColorSchema = ColorSchema.default("#818cf8").describe(
377
+ "The second brand specific color of the workspace"
378
+ );
379
+ var SuccessColorSchema = ColorSchema.default("#45b27e").describe(
380
+ "The success color of the workspace"
381
+ );
382
+ var InfoColorSchema = ColorSchema.default("#38bdf8").describe(
383
+ "The informational color of the workspace"
384
+ );
385
+ var WarningColorSchema = ColorSchema.default("#f3d371").describe(
386
+ "The warning color of the workspace"
387
+ );
388
+ var DangerColorSchema = ColorSchema.default("#d8314a").describe(
389
+ "The danger color of the workspace"
390
+ );
391
+ var FatalColorSchema = ColorSchema.optional().describe(
392
+ "The fatal color of the workspace"
393
+ );
394
+ var PositiveColorSchema = ColorSchema.default("#4ade80").describe(
395
+ "The positive number color of the workspace"
396
+ );
397
+ var NegativeColorSchema = ColorSchema.default("#ef4444").describe(
398
+ "The negative number color of the workspace"
399
+ );
400
+ var GradientStopsSchema = z__namespace.array(ColorSchema).optional().describe(
401
+ "The color stops for the base gradient color pattern used in the workspace"
402
+ );
403
+ var DarkThemeColorConfigSchema = z__namespace.object({
404
+ foreground: LightColorSchema,
405
+ background: DarkColorSchema,
406
+ brand: BrandColorSchema,
407
+ alternate: AlternateColorSchema,
408
+ accent: AccentColorSchema,
409
+ link: LinkColorSchema,
410
+ help: HelpColorSchema,
411
+ success: SuccessColorSchema,
412
+ info: InfoColorSchema,
413
+ warning: WarningColorSchema,
414
+ danger: DangerColorSchema,
415
+ fatal: FatalColorSchema,
416
+ positive: PositiveColorSchema,
417
+ negative: NegativeColorSchema,
418
+ gradient: GradientStopsSchema
419
+ });
420
+ var LightThemeColorConfigSchema = z__namespace.object({
421
+ foreground: DarkColorSchema,
422
+ background: LightColorSchema,
423
+ brand: BrandColorSchema,
424
+ alternate: AlternateColorSchema,
425
+ accent: AccentColorSchema,
426
+ link: LinkColorSchema,
427
+ help: HelpColorSchema,
428
+ success: SuccessColorSchema,
429
+ info: InfoColorSchema,
430
+ warning: WarningColorSchema,
431
+ danger: DangerColorSchema,
432
+ fatal: FatalColorSchema,
433
+ positive: PositiveColorSchema,
434
+ negative: NegativeColorSchema,
435
+ gradient: GradientStopsSchema
436
+ });
437
+ var MultiThemeColorConfigSchema = z__namespace.object({
438
+ dark: DarkThemeColorConfigSchema,
439
+ light: LightThemeColorConfigSchema
440
+ });
441
+ var SingleThemeColorConfigSchema = z__namespace.object({
442
+ dark: DarkColorSchema,
443
+ light: LightColorSchema,
444
+ brand: BrandColorSchema,
445
+ alternate: AlternateColorSchema,
446
+ accent: AccentColorSchema,
447
+ link: LinkColorSchema,
448
+ help: HelpColorSchema,
449
+ success: SuccessColorSchema,
450
+ info: InfoColorSchema,
451
+ warning: WarningColorSchema,
452
+ danger: DangerColorSchema,
453
+ fatal: FatalColorSchema,
454
+ positive: PositiveColorSchema,
455
+ negative: NegativeColorSchema,
456
+ gradient: GradientStopsSchema
457
+ });
458
+ var RegistryUrlConfigSchema = z__namespace.url().optional().describe("A remote registry URL used to publish distributable packages");
459
+ var RegistryConfigSchema = z__namespace.object({
460
+ github: RegistryUrlConfigSchema,
461
+ npm: RegistryUrlConfigSchema,
462
+ cargo: RegistryUrlConfigSchema,
463
+ cyclone: RegistryUrlConfigSchema,
464
+ container: RegistryUrlConfigSchema
465
+ }).default({}).describe("A list of remote registry URLs used by Storm Software");
466
+ var ColorConfigSchema = SingleThemeColorConfigSchema.or(
467
+ MultiThemeColorConfigSchema
468
+ ).describe("Colors used for various workspace elements");
469
+ var ColorConfigMapSchema = z__namespace.record(
470
+ z__namespace.union([z__namespace.literal("base"), z__namespace.string()]),
471
+ ColorConfigSchema
472
+ );
473
+ var ExtendsItemSchema = z__namespace.string().trim().describe(
474
+ "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."
475
+ );
476
+ var ExtendsSchema = ExtendsItemSchema.or(
477
+ z__namespace.array(ExtendsItemSchema)
478
+ ).describe(
479
+ "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."
480
+ );
481
+ var WorkspaceBotConfigSchema = z__namespace.object({
482
+ name: z__namespace.string().trim().default("stormie-bot").describe(
483
+ "The workspace bot user's name (this is the bot that will be used to perform various tasks)"
484
+ ),
485
+ email: z__namespace.email().default("bot@stormsoftware.com").describe("The email of the workspace bot")
486
+ }).describe(
487
+ "The workspace's bot user's config used to automated various operations tasks"
488
+ );
489
+ var WorkspaceReleaseConfigSchema = z__namespace.object({
490
+ banner: z__namespace.string().trim().optional().describe(
491
+ "A URL to a banner image used to display the workspace's release"
492
+ ),
493
+ header: z__namespace.string().trim().optional().describe(
494
+ "A header message appended to the start of the workspace's release notes"
495
+ ),
496
+ footer: z__namespace.string().trim().optional().describe(
497
+ "A footer message appended to the end of the workspace's release notes"
498
+ )
499
+ }).describe("The workspace's release config used during the release process");
500
+ var WorkspaceSocialsConfigSchema = z__namespace.object({
501
+ twitter: z__namespace.string().trim().default(STORM_DEFAULT_SOCIAL_TWITTER).describe("A Twitter/X account associated with the organization/project"),
502
+ discord: z__namespace.string().trim().default(STORM_DEFAULT_SOCIAL_DISCORD).describe("A Discord account associated with the organization/project"),
503
+ telegram: z__namespace.string().trim().default(STORM_DEFAULT_SOCIAL_TELEGRAM).describe("A Telegram account associated with the organization/project"),
504
+ slack: z__namespace.string().trim().default(STORM_DEFAULT_SOCIAL_SLACK).describe("A Slack account associated with the organization/project"),
505
+ medium: z__namespace.string().trim().default(STORM_DEFAULT_SOCIAL_MEDIUM).describe("A Medium account associated with the organization/project"),
506
+ github: z__namespace.string().trim().default(STORM_DEFAULT_SOCIAL_GITHUB).describe("A GitHub account associated with the organization/project")
507
+ }).describe(
508
+ "The workspace's account config used to store various social media links"
509
+ );
510
+ var WorkspaceDirectoryConfigSchema = z__namespace.object({
511
+ cache: z__namespace.string().trim().optional().describe(
512
+ "The directory used to store the environment's cached file data"
513
+ ),
514
+ data: z__namespace.string().trim().optional().describe("The directory used to store the environment's data files"),
515
+ config: z__namespace.string().trim().optional().describe(
516
+ "The directory used to store the environment's configuration files"
517
+ ),
518
+ temp: z__namespace.string().trim().optional().describe("The directory used to store the environment's temp files"),
519
+ log: z__namespace.string().trim().optional().describe("The directory used to store the environment's temp files"),
520
+ build: z__namespace.string().trim().default("dist").describe(
521
+ "The directory used to store the workspace's distributable files after a build (relative to the workspace root)"
522
+ )
523
+ }).describe(
524
+ "Various directories used by the workspace to store data, cache, and configuration files"
525
+ );
526
+ var errorConfigSchema = z__namespace.object({
527
+ codesFile: z__namespace.string().trim().default(STORM_DEFAULT_ERROR_CODES_FILE).describe("The path to the workspace's error codes JSON file"),
528
+ url: z__namespace.url().optional().describe(
529
+ "A URL to a page that looks up the workspace's error messages given a specific error code"
530
+ )
531
+ }).describe("The workspace's error config used during the error process");
532
+ var organizationConfigSchema = z__namespace.object({
533
+ name: z__namespace.string().trim().describe("The name of the organization"),
534
+ description: z__namespace.string().trim().optional().describe("A description of the organization"),
535
+ logo: z__namespace.url().optional().describe("A URL to the organization's logo image"),
536
+ icon: z__namespace.url().optional().describe("A URL to the organization's icon image"),
537
+ url: z__namespace.url().optional().describe(
538
+ "A URL to a page that provides more information about the organization"
539
+ )
540
+ }).describe("The workspace's organization details");
541
+ var stormWorkspaceConfigSchema = z__namespace.object({
542
+ $schema: z__namespace.string().trim().default(
543
+ "https://public.storm-cdn.com/schemas/storm-workspace.schema.json"
544
+ ).describe(
545
+ "The URL or file path to the JSON schema file that describes the Storm configuration file"
546
+ ),
547
+ extends: ExtendsSchema.optional(),
548
+ name: z__namespace.string().trim().toLowerCase().optional().describe(
549
+ "The name of the service/package/scope using this configuration"
550
+ ),
551
+ namespace: z__namespace.string().trim().toLowerCase().optional().describe("The namespace of the package"),
552
+ organization: organizationConfigSchema.or(z__namespace.string().trim().describe("The organization of the workspace")).optional().describe(
553
+ "The organization of the workspace. This can be a string or an object containing the organization's details"
554
+ ),
555
+ repository: z__namespace.string().trim().optional().describe("The repo URL of the workspace (i.e. GitHub)"),
556
+ license: z__namespace.string().trim().default("Apache-2.0").describe("The license type of the package"),
557
+ homepage: z__namespace.url().optional().describe("The homepage of the workspace"),
558
+ docs: z__namespace.url().optional().describe("The documentation site for the workspace"),
559
+ portal: z__namespace.url().optional().describe("The development portal site for the workspace"),
560
+ licensing: z__namespace.url().optional().describe("The licensing site for the workspace"),
561
+ contact: z__namespace.url().optional().describe("The contact site for the workspace"),
562
+ support: z__namespace.url().optional().describe(
563
+ "The support site for the workspace. If not provided, this is defaulted to the `contact` config value"
564
+ ),
565
+ branch: z__namespace.string().trim().default("main").describe("The branch of the workspace"),
566
+ preid: z__namespace.string().optional().describe("A tag specifying the version pre-release identifier"),
567
+ owner: z__namespace.string().trim().default("@storm-software/admin").describe("The owner of the package"),
568
+ bot: WorkspaceBotConfigSchema,
569
+ release: WorkspaceReleaseConfigSchema,
570
+ socials: WorkspaceSocialsConfigSchema,
571
+ error: errorConfigSchema,
572
+ mode: z__namespace.string().trim().default("production").describe("The current runtime environment mode for the package"),
573
+ workspaceRoot: z__namespace.string().trim().describe("The root directory of the workspace"),
574
+ skipCache: z__namespace.boolean().default(false).describe("Should all known types of workspace caching be skipped?"),
575
+ directories: WorkspaceDirectoryConfigSchema,
576
+ packageManager: z__namespace.enum(["npm", "yarn", "pnpm", "bun"]).default("npm").describe(
577
+ "The JavaScript/TypeScript package manager used by the repository"
578
+ ),
579
+ timezone: z__namespace.string().trim().default("America/New_York").describe("The default timezone of the workspace"),
580
+ locale: z__namespace.string().trim().default("en-US").describe("The default locale of the workspace"),
581
+ logLevel: z__namespace.enum([
582
+ "silent",
583
+ "fatal",
584
+ "error",
585
+ "warn",
586
+ "success",
587
+ "info",
588
+ "debug",
589
+ "trace",
590
+ "all"
591
+ ]).default("info").describe(
592
+ "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`)."
593
+ ),
594
+ skipConfigLogging: z__namespace.boolean().optional().describe(
595
+ "Should the logging of the current Storm Workspace configuration be skipped?"
596
+ ),
597
+ registry: RegistryConfigSchema,
598
+ configFile: z__namespace.string().trim().nullable().default(null).describe(
599
+ "The filepath of the Storm config. When this field is null, no config file was found in the current workspace."
600
+ ),
601
+ colors: ColorConfigSchema.or(ColorConfigMapSchema).describe(
602
+ "Storm theme config values used for styling various package elements"
603
+ ),
604
+ extensions: z__namespace.record(z__namespace.string(), z__namespace.any()).optional().default({}).describe("Configuration of each used extension")
605
+ }).describe(
606
+ "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."
607
+ );
608
+
609
+ // ../../node_modules/.pnpm/defu@6.1.4/node_modules/defu/dist/defu.mjs
610
+ function isPlainObject(value) {
611
+ if (value === null || typeof value !== "object") {
612
+ return false;
698
613
  }
699
- if (logLevel >= LogLevel.TRACE) {
700
- return LogLevelLabel.TRACE;
614
+ const prototype = Object.getPrototypeOf(value);
615
+ if (prototype !== null && prototype !== Object.prototype && Object.getPrototypeOf(prototype) !== null) {
616
+ return false;
617
+ }
618
+ if (Symbol.iterator in value) {
619
+ return false;
620
+ }
621
+ if (Symbol.toStringTag in value) {
622
+ return Object.prototype.toString.call(value) === "[object Module]";
623
+ }
624
+ return true;
625
+ }
626
+ function _defu(baseObject, defaults, namespace = ".", merger) {
627
+ if (!isPlainObject(defaults)) {
628
+ return _defu(baseObject, {}, namespace, merger);
629
+ }
630
+ const object2 = Object.assign({}, defaults);
631
+ for (const key in baseObject) {
632
+ if (key === "__proto__" || key === "constructor") {
633
+ continue;
634
+ }
635
+ const value = baseObject[key];
636
+ if (value === null || value === void 0) {
637
+ continue;
638
+ }
639
+ if (merger && merger(object2, key, value, namespace)) {
640
+ continue;
641
+ }
642
+ if (Array.isArray(value) && Array.isArray(object2[key])) {
643
+ object2[key] = [...value, ...object2[key]];
644
+ } else if (isPlainObject(value) && isPlainObject(object2[key])) {
645
+ object2[key] = _defu(
646
+ value,
647
+ object2[key],
648
+ (namespace ? `${namespace}.` : "") + key.toString(),
649
+ merger
650
+ );
651
+ } else {
652
+ object2[key] = value;
653
+ }
701
654
  }
702
- if (logLevel >= LogLevel.DEBUG) {
703
- return LogLevelLabel.DEBUG;
655
+ return object2;
656
+ }
657
+ function createDefu(merger) {
658
+ return (...arguments_) => (
659
+ // eslint-disable-next-line unicorn/no-array-reduce
660
+ arguments_.reduce((p, c) => _defu(p, c, "", merger), {})
661
+ );
662
+ }
663
+ var defu = createDefu();
664
+
665
+ // ../config-tools/src/utilities/correct-paths.ts
666
+ var _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
667
+ function normalizeWindowsPath(input = "") {
668
+ if (!input) {
669
+ return input;
704
670
  }
705
- if (logLevel >= LogLevel.INFO) {
706
- return LogLevelLabel.INFO;
671
+ return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
672
+ }
673
+ var _UNC_REGEX = /^[/\\]{2}/;
674
+ var _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
675
+ var _DRIVE_LETTER_RE = /^[A-Za-z]:$/;
676
+ var correctPaths = function(path) {
677
+ if (!path || path.length === 0) {
678
+ return ".";
707
679
  }
708
- if (logLevel >= LogLevel.WARN) {
709
- return LogLevelLabel.WARN;
680
+ path = normalizeWindowsPath(path);
681
+ const isUNCPath = path.match(_UNC_REGEX);
682
+ const isPathAbsolute = isAbsolute(path);
683
+ const trailingSeparator = path[path.length - 1] === "/";
684
+ path = normalizeString(path, !isPathAbsolute);
685
+ if (path.length === 0) {
686
+ if (isPathAbsolute) {
687
+ return "/";
688
+ }
689
+ return trailingSeparator ? "./" : ".";
710
690
  }
711
- if (logLevel >= LogLevel.ERROR) {
712
- return LogLevelLabel.ERROR;
691
+ if (trailingSeparator) {
692
+ path += "/";
713
693
  }
714
- if (logLevel >= LogLevel.FATAL) {
715
- return LogLevelLabel.FATAL;
694
+ if (_DRIVE_LETTER_RE.test(path)) {
695
+ path += "/";
716
696
  }
717
- if (logLevel <= LogLevel.SILENT) {
718
- return LogLevelLabel.SILENT;
697
+ if (isUNCPath) {
698
+ if (!isPathAbsolute) {
699
+ return `//./${path}`;
700
+ }
701
+ return `//${path}`;
719
702
  }
720
- return LogLevelLabel.INFO;
721
- };
722
- var isVerbose = (label = LogLevelLabel.SILENT) => {
723
- const logLevel = typeof label === "string" ? getLogLevel(label) : label;
724
- return logLevel >= LogLevel.DEBUG;
703
+ return isPathAbsolute && !isAbsolute(path) ? `/${path}` : path;
725
704
  };
726
-
727
- // ../config-tools/src/logger/console.ts
728
- var getLogFn = (logLevel = LogLevel.INFO, config = {}, _chalk = getChalk()) => {
729
- 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;
730
- const configLogLevel = config.logLevel || process.env.STORM_LOG_LEVEL || LogLevelLabel.INFO;
731
- if (logLevel > getLogLevel(configLogLevel) || logLevel <= LogLevel.SILENT || getLogLevel(configLogLevel) <= LogLevel.SILENT) {
732
- return (_) => {
733
- };
734
- }
735
- if (typeof logLevel === "number" && LogLevel.FATAL >= logLevel) {
736
- return (message) => {
737
- console.error(
738
- `
739
- ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.fatal ?? "#7d1a1a")(`[${CONSOLE_ICONS[LogLevelLabel.FATAL]} Fatal] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
740
- `
741
- );
742
- };
743
- }
744
- if (typeof logLevel === "number" && LogLevel.ERROR >= logLevel) {
745
- return (message) => {
746
- console.error(
747
- `
748
- ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.danger ?? "#f85149")(`[${CONSOLE_ICONS[LogLevelLabel.ERROR]} Error] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
749
- `
750
- );
751
- };
752
- }
753
- if (typeof logLevel === "number" && LogLevel.WARN >= logLevel) {
754
- return (message) => {
755
- console.warn(
756
- `
757
- ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.warning ?? "#e3b341")(`[${CONSOLE_ICONS[LogLevelLabel.WARN]} Warn] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
758
- `
759
- );
760
- };
705
+ var joinPaths = function(...segments) {
706
+ let path = "";
707
+ for (const seg of segments) {
708
+ if (!seg) {
709
+ continue;
710
+ }
711
+ if (path.length > 0) {
712
+ const pathTrailing = path[path.length - 1] === "/";
713
+ const segLeading = seg[0] === "/";
714
+ const both = pathTrailing && segLeading;
715
+ if (both) {
716
+ path += seg.slice(1);
717
+ } else {
718
+ path += pathTrailing || segLeading ? seg : `/${seg}`;
719
+ }
720
+ } else {
721
+ path += seg;
722
+ }
761
723
  }
762
- if (typeof logLevel === "number" && LogLevel.SUCCESS >= logLevel) {
763
- return (message) => {
764
- console.info(
765
- `
766
- ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.success ?? "#56d364")(`[${CONSOLE_ICONS[LogLevelLabel.SUCCESS]} Success] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
767
- `
768
- );
769
- };
724
+ return correctPaths(path);
725
+ };
726
+ function normalizeString(path, allowAboveRoot) {
727
+ let res = "";
728
+ let lastSegmentLength = 0;
729
+ let lastSlash = -1;
730
+ let dots = 0;
731
+ let char = null;
732
+ for (let index = 0; index <= path.length; ++index) {
733
+ if (index < path.length) {
734
+ char = path[index];
735
+ } else if (char === "/") {
736
+ break;
737
+ } else {
738
+ char = "/";
739
+ }
740
+ if (char === "/") {
741
+ if (lastSlash === index - 1 || dots === 1) ; else if (dots === 2) {
742
+ if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
743
+ if (res.length > 2) {
744
+ const lastSlashIndex = res.lastIndexOf("/");
745
+ if (lastSlashIndex === -1) {
746
+ res = "";
747
+ lastSegmentLength = 0;
748
+ } else {
749
+ res = res.slice(0, lastSlashIndex);
750
+ lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
751
+ }
752
+ lastSlash = index;
753
+ dots = 0;
754
+ continue;
755
+ } else if (res.length > 0) {
756
+ res = "";
757
+ lastSegmentLength = 0;
758
+ lastSlash = index;
759
+ dots = 0;
760
+ continue;
761
+ }
762
+ }
763
+ if (allowAboveRoot) {
764
+ res += res.length > 0 ? "/.." : "..";
765
+ lastSegmentLength = 2;
766
+ }
767
+ } else {
768
+ if (res.length > 0) {
769
+ res += `/${path.slice(lastSlash + 1, index)}`;
770
+ } else {
771
+ res = path.slice(lastSlash + 1, index);
772
+ }
773
+ lastSegmentLength = index - lastSlash - 1;
774
+ }
775
+ lastSlash = index;
776
+ dots = 0;
777
+ } else if (char === "." && dots !== -1) {
778
+ ++dots;
779
+ } else {
780
+ dots = -1;
781
+ }
770
782
  }
771
- if (typeof logLevel === "number" && LogLevel.INFO >= logLevel) {
772
- return (message) => {
773
- console.info(
774
- `
775
- ${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.info ?? "#58a6ff")(`[${CONSOLE_ICONS[LogLevelLabel.INFO]} Info] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
776
- `
777
- );
778
- };
783
+ return res;
784
+ }
785
+ var isAbsolute = function(p) {
786
+ return _IS_ABSOLUTE_RE.test(p);
787
+ };
788
+ var MAX_PATH_SEARCH_DEPTH = 30;
789
+ var depth = 0;
790
+ function findFolderUp(startPath, endFileNames = [], endDirectoryNames = []) {
791
+ const _startPath = startPath ?? process.cwd();
792
+ if (endDirectoryNames.some(
793
+ (endDirName) => fs.existsSync(path.join(_startPath, endDirName))
794
+ )) {
795
+ return _startPath;
779
796
  }
780
- if (typeof logLevel === "number" && LogLevel.DEBUG >= logLevel) {
781
- return (message) => {
782
- console.debug(
783
- `
784
- ${_chalk.gray(formatTimestamp())} ${_chalk.hex("#3e9eff")(`[${CONSOLE_ICONS[LogLevelLabel.DEBUG]} Debug] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
785
- `
786
- );
787
- };
797
+ if (endFileNames.some(
798
+ (endFileName) => fs.existsSync(path.join(_startPath, endFileName))
799
+ )) {
800
+ return _startPath;
788
801
  }
789
- if (typeof logLevel === "number" && LogLevel.TRACE >= logLevel) {
790
- return (message) => {
791
- console.debug(
792
- `
793
- ${_chalk.gray(formatTimestamp())} ${_chalk.hex("#0070E0")(`[${CONSOLE_ICONS[LogLevelLabel.TRACE]} Trace] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
794
- `
795
- );
796
- };
802
+ if (_startPath !== "/" && depth++ < MAX_PATH_SEARCH_DEPTH) {
803
+ const parent = path.join(_startPath, "..");
804
+ return findFolderUp(parent, endFileNames, endDirectoryNames);
797
805
  }
798
- return (message) => {
799
- console.log(
800
- `
801
- ${_chalk.gray(formatTimestamp())} ${_chalk.hex("#0356a8")(`[${CONSOLE_ICONS[LogLevelLabel.ALL]} System] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
802
- `
806
+ return void 0;
807
+ }
808
+
809
+ // ../config-tools/src/utilities/find-workspace-root.ts
810
+ var rootFiles = [
811
+ "storm-workspace.json",
812
+ "storm-workspace.yaml",
813
+ "storm-workspace.yml",
814
+ "storm-workspace.js",
815
+ "storm-workspace.ts",
816
+ ".storm-workspace.json",
817
+ ".storm-workspace.yaml",
818
+ ".storm-workspace.yml",
819
+ ".storm-workspace.js",
820
+ ".storm-workspace.ts",
821
+ "lerna.json",
822
+ "nx.json",
823
+ "turbo.json",
824
+ "npm-workspace.json",
825
+ "yarn-workspace.json",
826
+ "pnpm-workspace.json",
827
+ "npm-workspace.yaml",
828
+ "yarn-workspace.yaml",
829
+ "pnpm-workspace.yaml",
830
+ "npm-workspace.yml",
831
+ "yarn-workspace.yml",
832
+ "pnpm-workspace.yml",
833
+ "npm-lock.json",
834
+ "yarn-lock.json",
835
+ "pnpm-lock.json",
836
+ "npm-lock.yaml",
837
+ "yarn-lock.yaml",
838
+ "pnpm-lock.yaml",
839
+ "npm-lock.yml",
840
+ "yarn-lock.yml",
841
+ "pnpm-lock.yml",
842
+ "bun.lockb"
843
+ ];
844
+ var rootDirectories = [
845
+ ".storm-workspace",
846
+ ".nx",
847
+ ".github",
848
+ ".vscode",
849
+ ".verdaccio"
850
+ ];
851
+ function findWorkspaceRootSafe(pathInsideMonorepo) {
852
+ if (process.env.STORM_WORKSPACE_ROOT || process.env.NX_WORKSPACE_ROOT_PATH) {
853
+ return correctPaths(
854
+ process.env.STORM_WORKSPACE_ROOT ?? process.env.NX_WORKSPACE_ROOT_PATH
803
855
  );
804
- };
805
- };
806
- var writeFatal = (message, config) => getLogFn(LogLevel.FATAL, config)(message);
807
- var writeError = (message, config) => getLogFn(LogLevel.ERROR, config)(message);
808
- var writeWarning = (message, config) => getLogFn(LogLevel.WARN, config)(message);
809
- var writeInfo = (message, config) => getLogFn(LogLevel.INFO, config)(message);
810
- var writeSuccess = (message, config) => getLogFn(LogLevel.SUCCESS, config)(message);
811
- var writeDebug = (message, config) => getLogFn(LogLevel.DEBUG, config)(message);
812
- var writeTrace = (message, config) => getLogFn(LogLevel.TRACE, config)(message);
813
- var MAX_DEPTH = 4;
814
- var formatLogMessage = (message, options = {}, depth2 = 0) => {
815
- if (depth2 > MAX_DEPTH) {
816
- return "<max depth>";
817
- }
818
- const prefix = options.prefix ?? "-";
819
- const skip = options.skip ?? [];
820
- return typeof message === "undefined" || message === null || !message && typeof message !== "boolean" ? "<none>" : typeof message === "string" ? message : Array.isArray(message) ? `
821
- ${message.map((item, index) => ` ${prefix}> #${index} = ${formatLogMessage(item, { prefix: `${prefix}-`, skip }, depth2 + 1)}`).join("\n")}` : typeof message === "object" ? `
822
- ${Object.keys(message).filter((key) => !skip.includes(key)).map(
823
- (key) => ` ${prefix}> ${key} = ${_isFunction(message[key]) ? "<function>" : typeof message[key] === "object" ? formatLogMessage(
824
- message[key],
825
- { prefix: `${prefix}-`, skip },
826
- depth2 + 1
827
- ) : message[key]}`
828
- ).join("\n")}` : message;
829
- };
830
- var _isFunction = (value) => {
831
- try {
832
- return value instanceof Function || typeof value === "function" || !!(value?.constructor && value?.call && value?.apply);
833
- } catch (e) {
834
- return false;
835
856
  }
836
- };
837
-
838
- // ../config-tools/src/utilities/process-handler.ts
839
- var exitWithError = (config) => {
840
- writeFatal("Exiting script with an error status...", config);
841
- process.exit(1);
842
- };
843
- var exitWithSuccess = (config) => {
844
- writeSuccess("Script completed successfully. Exiting...", config);
845
- process.exit(0);
846
- };
847
- var handleProcess = (config) => {
848
- writeTrace(
849
- `Using the following arguments to process the script: ${process.argv.join(", ")}`,
850
- config
857
+ return correctPaths(
858
+ findFolderUp(
859
+ pathInsideMonorepo ?? process.cwd(),
860
+ rootFiles,
861
+ rootDirectories
862
+ )
851
863
  );
852
- process.on("unhandledRejection", (error) => {
853
- writeError(
854
- `An Unhandled Rejection occurred while running the program: ${error}`,
855
- config
856
- );
857
- exitWithError(config);
858
- });
859
- process.on("uncaughtException", (error) => {
860
- writeError(
861
- `An Uncaught Exception occurred while running the program: ${error.message}
862
- Stacktrace: ${error.stack}`,
863
- config
864
+ }
865
+ function findWorkspaceRoot(pathInsideMonorepo) {
866
+ const result = findWorkspaceRootSafe(pathInsideMonorepo);
867
+ if (!result) {
868
+ throw new Error(
869
+ `Cannot find workspace root upwards from known path. Files search list includes:
870
+ ${rootFiles.join(
871
+ "\n"
872
+ )}
873
+ Path: ${pathInsideMonorepo ? pathInsideMonorepo : process.cwd()}`
864
874
  );
865
- exitWithError(config);
866
- });
867
- process.on("SIGTERM", (signal) => {
868
- writeError(`The program terminated with signal code: ${signal}`, config);
869
- exitWithError(config);
870
- });
871
- process.on("SIGINT", (signal) => {
872
- writeError(`The program terminated with signal code: ${signal}`, config);
873
- exitWithError(config);
874
- });
875
- process.on("SIGHUP", (signal) => {
876
- writeError(`The program terminated with signal code: ${signal}`, config);
877
- exitWithError(config);
878
- });
879
- };
880
-
881
- // ../../node_modules/.pnpm/defu@6.1.4/node_modules/defu/dist/defu.mjs
882
- function isPlainObject(value) {
883
- if (value === null || typeof value !== "object") {
884
- return false;
885
- }
886
- const prototype = Object.getPrototypeOf(value);
887
- if (prototype !== null && prototype !== Object.prototype && Object.getPrototypeOf(prototype) !== null) {
888
- return false;
889
875
  }
890
- if (Symbol.iterator in value) {
891
- return false;
892
- }
893
- if (Symbol.toStringTag in value) {
894
- return Object.prototype.toString.call(value) === "[object Module]";
876
+ return result;
877
+ }
878
+
879
+ // ../config/src/types.ts
880
+ var COLOR_KEYS = [
881
+ "dark",
882
+ "light",
883
+ "base",
884
+ "brand",
885
+ "alternate",
886
+ "accent",
887
+ "link",
888
+ "success",
889
+ "help",
890
+ "info",
891
+ "warning",
892
+ "danger",
893
+ "fatal",
894
+ "positive",
895
+ "negative"
896
+ ];
897
+ async function getPackageJsonConfig(root) {
898
+ let license = STORM_DEFAULT_LICENSE;
899
+ let homepage = void 0;
900
+ let support = void 0;
901
+ let name = void 0;
902
+ let namespace = void 0;
903
+ let repository = void 0;
904
+ const workspaceRoot = findWorkspaceRoot(root);
905
+ if (fs.existsSync(path.join(workspaceRoot, "package.json"))) {
906
+ const file = await promises.readFile(
907
+ joinPaths(workspaceRoot, "package.json"),
908
+ "utf8"
909
+ );
910
+ if (file) {
911
+ const packageJson = JSON.parse(file);
912
+ if (packageJson.name) {
913
+ name = packageJson.name;
914
+ }
915
+ if (packageJson.namespace) {
916
+ namespace = packageJson.namespace;
917
+ }
918
+ if (packageJson.repository) {
919
+ if (typeof packageJson.repository === "string") {
920
+ repository = packageJson.repository;
921
+ } else if (packageJson.repository.url) {
922
+ repository = packageJson.repository.url;
923
+ }
924
+ }
925
+ if (packageJson.license) {
926
+ license = packageJson.license;
927
+ }
928
+ if (packageJson.homepage) {
929
+ homepage = packageJson.homepage;
930
+ }
931
+ if (packageJson.bugs) {
932
+ if (typeof packageJson.bugs === "string") {
933
+ support = packageJson.bugs;
934
+ } else if (packageJson.bugs.url) {
935
+ support = packageJson.bugs.url;
936
+ }
937
+ }
938
+ }
895
939
  }
896
- return true;
940
+ return {
941
+ workspaceRoot,
942
+ name,
943
+ namespace,
944
+ repository,
945
+ license,
946
+ homepage,
947
+ support
948
+ };
897
949
  }
898
- function _defu(baseObject, defaults, namespace = ".", merger) {
899
- if (!isPlainObject(defaults)) {
900
- return _defu(baseObject, {}, namespace, merger);
950
+ function applyDefaultConfig(config) {
951
+ if (!config.support && config.contact) {
952
+ config.support = config.contact;
901
953
  }
902
- const object2 = Object.assign({}, defaults);
903
- for (const key in baseObject) {
904
- if (key === "__proto__" || key === "constructor") {
905
- continue;
954
+ if (!config.contact && config.support) {
955
+ config.contact = config.support;
956
+ }
957
+ if (config.homepage) {
958
+ if (!config.docs) {
959
+ config.docs = `${config.homepage}/docs`;
906
960
  }
907
- const value = baseObject[key];
908
- if (value === null || value === void 0) {
909
- continue;
961
+ if (!config.license) {
962
+ config.license = `${config.homepage}/license`;
910
963
  }
911
- if (merger && merger(object2, key, value, namespace)) {
912
- continue;
964
+ if (!config.support) {
965
+ config.support = `${config.homepage}/support`;
913
966
  }
914
- if (Array.isArray(value) && Array.isArray(object2[key])) {
915
- object2[key] = [...value, ...object2[key]];
916
- } else if (isPlainObject(value) && isPlainObject(object2[key])) {
917
- object2[key] = _defu(
918
- value,
919
- object2[key],
920
- (namespace ? `${namespace}.` : "") + key.toString(),
921
- merger
922
- );
923
- } else {
924
- object2[key] = value;
967
+ if (!config.contact) {
968
+ config.contact = `${config.homepage}/contact`;
969
+ }
970
+ if (!config.error?.codesFile || !config?.error?.url) {
971
+ config.error ??= { codesFile: STORM_DEFAULT_ERROR_CODES_FILE };
972
+ if (config.homepage) {
973
+ config.error.url ??= `${config.homepage}/errors`;
974
+ }
925
975
  }
926
976
  }
927
- return object2;
928
- }
929
- function createDefu(merger) {
930
- return (...arguments_) => (
931
- // eslint-disable-next-line unicorn/no-array-reduce
932
- arguments_.reduce((p, c) => _defu(p, c, "", merger), {})
933
- );
977
+ return config;
934
978
  }
935
- var defu = createDefu();
979
+
980
+ // ../config-tools/src/config-file/get-config-file.ts
936
981
  var getConfigFileByName = async (fileName, filePath, options = {}) => {
937
982
  const workspacePath = filePath || findWorkspaceRoot(filePath);
938
983
  const configs = await Promise.all([
@@ -1132,6 +1177,19 @@ var getThemeColorConfigEnv = (prefix, theme) => {
1132
1177
  return process.env[`${prefix}${themeName}LIGHT_BRAND`] || process.env[`${prefix}${themeName}DARK_BRAND`] ? getMultiThemeColorConfigEnv(prefix + themeName) : getSingleThemeColorConfigEnv(prefix + themeName);
1133
1178
  };
1134
1179
  var getSingleThemeColorConfigEnv = (prefix) => {
1180
+ const gradient = [];
1181
+ if (process.env[`${prefix}GRADIENT_START`] && process.env[`${prefix}GRADIENT_END`]) {
1182
+ gradient.push(
1183
+ process.env[`${prefix}GRADIENT_START`],
1184
+ process.env[`${prefix}GRADIENT_END`]
1185
+ );
1186
+ } else if (process.env[`${prefix}GRADIENT_0`] || process.env[`${prefix}GRADIENT_1`]) {
1187
+ let index = process.env[`${prefix}GRADIENT_0`] ? 0 : 1;
1188
+ while (process.env[`${prefix}GRADIENT_${index}`]) {
1189
+ gradient.push(process.env[`${prefix}GRADIENT_${index}`]);
1190
+ index++;
1191
+ }
1192
+ }
1135
1193
  return {
1136
1194
  dark: process.env[`${prefix}DARK`],
1137
1195
  light: process.env[`${prefix}LIGHT`],
@@ -1146,7 +1204,8 @@ var getSingleThemeColorConfigEnv = (prefix) => {
1146
1204
  danger: process.env[`${prefix}DANGER`],
1147
1205
  fatal: process.env[`${prefix}FATAL`],
1148
1206
  positive: process.env[`${prefix}POSITIVE`],
1149
- negative: process.env[`${prefix}NEGATIVE`]
1207
+ negative: process.env[`${prefix}NEGATIVE`],
1208
+ gradient
1150
1209
  };
1151
1210
  };
1152
1211
  var getMultiThemeColorConfigEnv = (prefix) => {
@@ -1158,6 +1217,19 @@ var getMultiThemeColorConfigEnv = (prefix) => {
1158
1217
  };
1159
1218
  };
1160
1219
  var getBaseThemeColorConfigEnv = (prefix) => {
1220
+ const gradient = [];
1221
+ if (process.env[`${prefix}GRADIENT_START`] && process.env[`${prefix}GRADIENT_END`]) {
1222
+ gradient.push(
1223
+ process.env[`${prefix}GRADIENT_START`],
1224
+ process.env[`${prefix}GRADIENT_END`]
1225
+ );
1226
+ } else if (process.env[`${prefix}GRADIENT_0`] || process.env[`${prefix}GRADIENT_1`]) {
1227
+ let index = process.env[`${prefix}GRADIENT_0`] ? 0 : 1;
1228
+ while (process.env[`${prefix}GRADIENT_${index}`]) {
1229
+ gradient.push(process.env[`${prefix}GRADIENT_${index}`]);
1230
+ index++;
1231
+ }
1232
+ }
1161
1233
  return {
1162
1234
  foreground: process.env[`${prefix}FOREGROUND`],
1163
1235
  background: process.env[`${prefix}BACKGROUND`],
@@ -1172,7 +1244,8 @@ var getBaseThemeColorConfigEnv = (prefix) => {
1172
1244
  danger: process.env[`${prefix}DANGER`],
1173
1245
  fatal: process.env[`${prefix}FATAL`],
1174
1246
  positive: process.env[`${prefix}POSITIVE`],
1175
- negative: process.env[`${prefix}NEGATIVE`]
1247
+ negative: process.env[`${prefix}NEGATIVE`],
1248
+ gradient
1176
1249
  };
1177
1250
  };
1178
1251
 
@@ -1303,11 +1376,12 @@ var setConfigEnv = (config) => {
1303
1376
  process.env[`${prefix}TIMEZONE`] = config.timezone;
1304
1377
  process.env.TZ = config.timezone;
1305
1378
  process.env.DEFAULT_TIMEZONE = config.timezone;
1379
+ process.env.TIMEZONE = config.timezone;
1306
1380
  }
1307
1381
  if (config.locale) {
1308
1382
  process.env[`${prefix}LOCALE`] = config.locale;
1309
- process.env.LOCALE = config.locale;
1310
1383
  process.env.DEFAULT_LOCALE = config.locale;
1384
+ process.env.LOCALE = config.locale;
1311
1385
  process.env.LANG = config.locale ? `${config.locale.replaceAll("-", "_")}.UTF-8` : "en_US.UTF-8";
1312
1386
  }
1313
1387
  if (config.configFile) {
@@ -1468,6 +1542,11 @@ var setSingleThemeColorConfigEnv = (prefix, config) => {
1468
1542
  if (config.negative) {
1469
1543
  process.env[`${prefix}NEGATIVE`] = config.negative;
1470
1544
  }
1545
+ if (config.gradient) {
1546
+ for (let i = 0; i < config.gradient.length; i++) {
1547
+ process.env[`${prefix}GRADIENT_${i}`] = config.gradient[i];
1548
+ }
1549
+ }
1471
1550
  };
1472
1551
  var setMultiThemeColorConfigEnv = (prefix, config) => {
1473
1552
  return {
@@ -1518,6 +1597,11 @@ var setBaseThemeColorConfigEnv = (prefix, config) => {
1518
1597
  if (config.negative) {
1519
1598
  process.env[`${prefix}NEGATIVE`] = config.negative;
1520
1599
  }
1600
+ if (config.gradient) {
1601
+ for (let i = 0; i < config.gradient.length; i++) {
1602
+ process.env[`${prefix}GRADIENT_${i}`] = config.gradient[i];
1603
+ }
1604
+ }
1521
1605
  };
1522
1606
  var _static_cache = void 0;
1523
1607
  var createStormWorkspaceConfig = async (extensionName, schema, workspaceRoot, skipLogs = false, useDefault = true) => {