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