@storm-software/untyped 0.24.241 → 0.24.246

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