@storm-software/pnpm-tools 0.6.144 → 0.6.146
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 +27 -0
- package/README.md +1 -1
- package/bin/pnpm.cjs +2296 -60
- package/bin/pnpm.js +2258 -54
- package/package.json +15 -14
package/bin/pnpm.cjs
CHANGED
|
@@ -1,40 +1,2275 @@
|
|
|
1
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
|
+
));
|
|
2
24
|
|
|
3
|
-
//
|
|
4
|
-
var
|
|
5
|
-
|
|
6
|
-
|
|
25
|
+
// ../config/src/schema.ts
|
|
26
|
+
var z = __toESM(require("zod/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, "#151718");
|
|
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 helpColorSchema = z._default(colorSchema, "#818cf8");
|
|
82
|
+
schemaRegistry.add(helpColorSchema, {
|
|
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
|
+
help: helpColorSchema,
|
|
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
|
+
help: helpColorSchema,
|
|
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
|
+
help: helpColorSchema,
|
|
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
|
+
help: "#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: "#1d1e22",
|
|
673
|
+
foreground: "#cbd5e1",
|
|
674
|
+
brand: "#2dd4bf",
|
|
675
|
+
alternate: "#db2777",
|
|
676
|
+
help: "#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 = (date = /* @__PURE__ */ new Date()) => {
|
|
780
|
+
return `${date.toLocaleDateString()} ${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 = {}, _chalk = getChalk()) => {
|
|
841
|
+
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;
|
|
842
|
+
const configLogLevel = config.logLevel || process.env.STORM_LOG_LEVEL || LogLevelLabel.INFO;
|
|
843
|
+
if (logLevel > getLogLevel(configLogLevel) || logLevel <= LogLevel.SILENT || getLogLevel(configLogLevel) <= LogLevel.SILENT) {
|
|
844
|
+
return (_) => {
|
|
845
|
+
};
|
|
846
|
+
}
|
|
847
|
+
if (typeof logLevel === "number" && LogLevel.FATAL >= logLevel) {
|
|
848
|
+
return (message) => {
|
|
849
|
+
console.error(
|
|
850
|
+
`
|
|
851
|
+
${_chalk.gray(formatTimestamp())} ${_chalk.hex(
|
|
852
|
+
colors.fatal ?? DEFAULT_COLOR_CONFIG.dark.fatal
|
|
853
|
+
)(
|
|
854
|
+
`[${CONSOLE_ICONS[LogLevelLabel.FATAL]} Fatal] `
|
|
855
|
+
)}${_chalk.bold.whiteBright(formatLogMessage(message))}
|
|
856
|
+
`
|
|
857
|
+
);
|
|
858
|
+
};
|
|
859
|
+
}
|
|
860
|
+
if (typeof logLevel === "number" && LogLevel.ERROR >= logLevel) {
|
|
861
|
+
return (message) => {
|
|
862
|
+
console.error(
|
|
863
|
+
`
|
|
864
|
+
${_chalk.gray(formatTimestamp())} ${_chalk.hex(
|
|
865
|
+
colors.danger ?? DEFAULT_COLOR_CONFIG.dark.danger
|
|
866
|
+
)(
|
|
867
|
+
`[${CONSOLE_ICONS[LogLevelLabel.ERROR]} Error] `
|
|
868
|
+
)}${_chalk.bold.whiteBright(formatLogMessage(message))}
|
|
869
|
+
`
|
|
870
|
+
);
|
|
871
|
+
};
|
|
872
|
+
}
|
|
873
|
+
if (typeof logLevel === "number" && LogLevel.WARN >= logLevel) {
|
|
874
|
+
return (message) => {
|
|
875
|
+
console.warn(
|
|
876
|
+
`
|
|
877
|
+
${_chalk.gray(formatTimestamp())} ${_chalk.hex(
|
|
878
|
+
colors.warning ?? DEFAULT_COLOR_CONFIG.dark.warning
|
|
879
|
+
)(
|
|
880
|
+
`[${CONSOLE_ICONS[LogLevelLabel.WARN]} Warn] `
|
|
881
|
+
)}${_chalk.bold.whiteBright(formatLogMessage(message))}
|
|
882
|
+
`
|
|
883
|
+
);
|
|
884
|
+
};
|
|
885
|
+
}
|
|
886
|
+
if (typeof logLevel === "number" && LogLevel.SUCCESS >= logLevel) {
|
|
887
|
+
return (message) => {
|
|
888
|
+
console.info(
|
|
889
|
+
`
|
|
890
|
+
${_chalk.gray(formatTimestamp())} ${_chalk.hex(
|
|
891
|
+
colors.success ?? DEFAULT_COLOR_CONFIG.dark.success
|
|
892
|
+
)(
|
|
893
|
+
`[${CONSOLE_ICONS[LogLevelLabel.SUCCESS]} Success] `
|
|
894
|
+
)}${_chalk.bold.whiteBright(formatLogMessage(message))}
|
|
895
|
+
`
|
|
896
|
+
);
|
|
897
|
+
};
|
|
898
|
+
}
|
|
899
|
+
if (typeof logLevel === "number" && LogLevel.INFO >= logLevel) {
|
|
900
|
+
return (message) => {
|
|
901
|
+
console.info(
|
|
902
|
+
`
|
|
903
|
+
${_chalk.gray(formatTimestamp())} ${_chalk.hex(
|
|
904
|
+
colors.info ?? DEFAULT_COLOR_CONFIG.dark.info
|
|
905
|
+
)(
|
|
906
|
+
`[${CONSOLE_ICONS[LogLevelLabel.INFO]} Info] `
|
|
907
|
+
)}${_chalk.bold.whiteBright(formatLogMessage(message))}
|
|
908
|
+
`
|
|
909
|
+
);
|
|
910
|
+
};
|
|
911
|
+
}
|
|
912
|
+
if (typeof logLevel === "number" && LogLevel.PERFORMANCE >= logLevel) {
|
|
913
|
+
return (message) => {
|
|
914
|
+
console.debug(
|
|
915
|
+
`
|
|
916
|
+
${_chalk.gray(formatTimestamp())} ${_chalk.hex(
|
|
917
|
+
colors.performance ?? DEFAULT_COLOR_CONFIG.dark.performance
|
|
918
|
+
)(
|
|
919
|
+
`[${CONSOLE_ICONS[LogLevelLabel.PERFORMANCE]} Performance] `
|
|
920
|
+
)}${_chalk.bold.whiteBright(formatLogMessage(message))}
|
|
921
|
+
`
|
|
922
|
+
);
|
|
923
|
+
};
|
|
924
|
+
}
|
|
925
|
+
if (typeof logLevel === "number" && LogLevel.DEBUG >= logLevel) {
|
|
926
|
+
return (message) => {
|
|
927
|
+
console.debug(
|
|
928
|
+
`
|
|
929
|
+
${_chalk.gray(formatTimestamp())} ${_chalk.hex(
|
|
930
|
+
colors.debug ?? DEFAULT_COLOR_CONFIG.dark.debug
|
|
931
|
+
)(
|
|
932
|
+
`[${CONSOLE_ICONS[LogLevelLabel.DEBUG]} Debug] `
|
|
933
|
+
)}${_chalk.bold.whiteBright(formatLogMessage(message))}
|
|
934
|
+
`
|
|
935
|
+
);
|
|
936
|
+
};
|
|
937
|
+
}
|
|
938
|
+
if (typeof logLevel === "number" && LogLevel.TRACE >= logLevel) {
|
|
939
|
+
return (message) => {
|
|
940
|
+
console.debug(
|
|
941
|
+
`
|
|
942
|
+
${_chalk.gray(formatTimestamp())} ${_chalk.hex("#bbbbbb")(
|
|
943
|
+
`[${CONSOLE_ICONS[LogLevelLabel.TRACE]} Trace] `
|
|
944
|
+
)}${_chalk.bold.whiteBright(formatLogMessage(message))}
|
|
945
|
+
`
|
|
946
|
+
);
|
|
947
|
+
};
|
|
948
|
+
}
|
|
949
|
+
return (message) => {
|
|
950
|
+
console.log(
|
|
951
|
+
`
|
|
952
|
+
${_chalk.gray(formatTimestamp())} ${_chalk.hex(
|
|
953
|
+
colors.brand ?? DEFAULT_COLOR_CONFIG.dark.brand
|
|
954
|
+
)(
|
|
955
|
+
`[${CONSOLE_ICONS[LogLevelLabel.ALL]} System] `
|
|
956
|
+
)}${_chalk.bold.whiteBright(formatLogMessage(message))}
|
|
957
|
+
`
|
|
958
|
+
);
|
|
959
|
+
};
|
|
960
|
+
};
|
|
961
|
+
var writeFatal = (message, config) => getLogFn(LogLevel.FATAL, config)(message);
|
|
962
|
+
var writeError = (message, config) => getLogFn(LogLevel.ERROR, config)(message);
|
|
963
|
+
var writeWarning = (message, config) => getLogFn(LogLevel.WARN, config)(message);
|
|
964
|
+
var writeInfo = (message, config) => getLogFn(LogLevel.INFO, config)(message);
|
|
965
|
+
var writeSuccess = (message, config) => getLogFn(LogLevel.SUCCESS, config)(message);
|
|
966
|
+
var writeDebug = (message, config) => getLogFn(LogLevel.DEBUG, config)(message);
|
|
967
|
+
var writeTrace = (message, config) => getLogFn(LogLevel.TRACE, config)(message);
|
|
968
|
+
var MAX_DEPTH = 6;
|
|
969
|
+
var formatLogMessage = (message, options = {}, depth2 = 0) => {
|
|
970
|
+
if (depth2 > MAX_DEPTH) {
|
|
971
|
+
return "<max depth>";
|
|
972
|
+
}
|
|
973
|
+
const prefix = options.prefix ?? "-";
|
|
974
|
+
const skip = options.skip ?? [];
|
|
975
|
+
return typeof message === "undefined" || message === null || !message && typeof message !== "boolean" ? "<none>" : typeof message === "string" ? message : Array.isArray(message) ? `
|
|
976
|
+
${message.map((item, index) => ` ${prefix}> #${index} = ${formatLogMessage(item, { prefix: `${prefix}-`, skip }, depth2 + 1)}`).join("\n")}` : typeof message === "object" ? `
|
|
977
|
+
${Object.keys(message).filter((key) => !skip.includes(key)).map(
|
|
978
|
+
(key) => ` ${prefix}> ${key} = ${_isFunction(message[key]) ? "<function>" : typeof message[key] === "object" ? formatLogMessage(
|
|
979
|
+
message[key],
|
|
980
|
+
{ prefix: `${prefix}-`, skip },
|
|
981
|
+
depth2 + 1
|
|
982
|
+
) : message[key]}`
|
|
983
|
+
).join("\n")}` : message;
|
|
984
|
+
};
|
|
985
|
+
var _isFunction = (value) => {
|
|
986
|
+
try {
|
|
987
|
+
return value instanceof Function || typeof value === "function" || !!(value?.constructor && value?.call && value?.apply);
|
|
988
|
+
} catch {
|
|
989
|
+
return false;
|
|
990
|
+
}
|
|
991
|
+
};
|
|
992
|
+
var brandIcon = (config = {}, _chalk = getChalk()) => _chalk.hex(getColor("brand", config))("\u{1F5F2}");
|
|
993
|
+
|
|
994
|
+
// ../config-tools/src/utilities/correct-paths.ts
|
|
995
|
+
var _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
|
|
996
|
+
function normalizeWindowsPath(input = "") {
|
|
997
|
+
if (!input) {
|
|
998
|
+
return input;
|
|
999
|
+
}
|
|
1000
|
+
return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
|
|
1001
|
+
}
|
|
1002
|
+
var _UNC_REGEX = /^[/\\]{2}/;
|
|
1003
|
+
var _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
|
|
1004
|
+
var _DRIVE_LETTER_RE = /^[A-Za-z]:$/;
|
|
1005
|
+
var correctPaths = function(path2) {
|
|
1006
|
+
if (!path2 || path2.length === 0) {
|
|
1007
|
+
return ".";
|
|
1008
|
+
}
|
|
1009
|
+
path2 = normalizeWindowsPath(path2);
|
|
1010
|
+
const isUNCPath = path2?.match(_UNC_REGEX);
|
|
1011
|
+
const isPathAbsolute = isAbsolute(path2);
|
|
1012
|
+
const trailingSeparator = path2[path2.length - 1] === "/";
|
|
1013
|
+
path2 = normalizeString(path2, !isPathAbsolute);
|
|
1014
|
+
if (path2.length === 0) {
|
|
1015
|
+
if (isPathAbsolute) {
|
|
1016
|
+
return "/";
|
|
1017
|
+
}
|
|
1018
|
+
return trailingSeparator ? "./" : ".";
|
|
1019
|
+
}
|
|
1020
|
+
if (trailingSeparator) {
|
|
1021
|
+
path2 += "/";
|
|
1022
|
+
}
|
|
1023
|
+
if (_DRIVE_LETTER_RE.test(path2)) {
|
|
1024
|
+
path2 += "/";
|
|
1025
|
+
}
|
|
1026
|
+
if (isUNCPath) {
|
|
1027
|
+
if (!isPathAbsolute) {
|
|
1028
|
+
return `//./${path2}`;
|
|
1029
|
+
}
|
|
1030
|
+
return `//${path2}`;
|
|
1031
|
+
}
|
|
1032
|
+
return isPathAbsolute && !isAbsolute(path2) ? `/${path2}` : path2;
|
|
1033
|
+
};
|
|
1034
|
+
var joinPaths = function(...segments) {
|
|
1035
|
+
let path2 = "";
|
|
1036
|
+
for (const seg of segments) {
|
|
1037
|
+
if (!seg) {
|
|
1038
|
+
continue;
|
|
1039
|
+
}
|
|
1040
|
+
if (path2.length > 0) {
|
|
1041
|
+
const pathTrailing = path2[path2.length - 1] === "/";
|
|
1042
|
+
const segLeading = seg[0] === "/";
|
|
1043
|
+
const both = pathTrailing && segLeading;
|
|
1044
|
+
if (both) {
|
|
1045
|
+
path2 += seg.slice(1);
|
|
1046
|
+
} else {
|
|
1047
|
+
path2 += pathTrailing || segLeading ? seg : `/${seg}`;
|
|
1048
|
+
}
|
|
1049
|
+
} else {
|
|
1050
|
+
path2 += seg;
|
|
1051
|
+
}
|
|
1052
|
+
}
|
|
1053
|
+
return correctPaths(path2);
|
|
1054
|
+
};
|
|
1055
|
+
function normalizeString(path2, allowAboveRoot) {
|
|
1056
|
+
let res = "";
|
|
1057
|
+
let lastSegmentLength = 0;
|
|
1058
|
+
let lastSlash = -1;
|
|
1059
|
+
let dots = 0;
|
|
1060
|
+
let char = null;
|
|
1061
|
+
for (let index = 0; index <= path2.length; ++index) {
|
|
1062
|
+
if (index < path2.length) {
|
|
1063
|
+
char = path2[index];
|
|
1064
|
+
} else if (char === "/") {
|
|
1065
|
+
break;
|
|
1066
|
+
} else {
|
|
1067
|
+
char = "/";
|
|
1068
|
+
}
|
|
1069
|
+
if (char === "/") {
|
|
1070
|
+
if (lastSlash === index - 1 || dots === 1) {
|
|
1071
|
+
} else if (dots === 2) {
|
|
1072
|
+
if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
|
|
1073
|
+
if (res.length > 2) {
|
|
1074
|
+
const lastSlashIndex = res.lastIndexOf("/");
|
|
1075
|
+
if (lastSlashIndex === -1) {
|
|
1076
|
+
res = "";
|
|
1077
|
+
lastSegmentLength = 0;
|
|
1078
|
+
} else {
|
|
1079
|
+
res = res.slice(0, lastSlashIndex);
|
|
1080
|
+
lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
|
|
1081
|
+
}
|
|
1082
|
+
lastSlash = index;
|
|
1083
|
+
dots = 0;
|
|
1084
|
+
continue;
|
|
1085
|
+
} else if (res.length > 0) {
|
|
1086
|
+
res = "";
|
|
1087
|
+
lastSegmentLength = 0;
|
|
1088
|
+
lastSlash = index;
|
|
1089
|
+
dots = 0;
|
|
1090
|
+
continue;
|
|
1091
|
+
}
|
|
1092
|
+
}
|
|
1093
|
+
if (allowAboveRoot) {
|
|
1094
|
+
res += res.length > 0 ? "/.." : "..";
|
|
1095
|
+
lastSegmentLength = 2;
|
|
1096
|
+
}
|
|
1097
|
+
} else {
|
|
1098
|
+
if (res.length > 0) {
|
|
1099
|
+
res += `/${path2.slice(lastSlash + 1, index)}`;
|
|
1100
|
+
} else {
|
|
1101
|
+
res = path2.slice(lastSlash + 1, index);
|
|
1102
|
+
}
|
|
1103
|
+
lastSegmentLength = index - lastSlash - 1;
|
|
1104
|
+
}
|
|
1105
|
+
lastSlash = index;
|
|
1106
|
+
dots = 0;
|
|
1107
|
+
} else if (char === "." && dots !== -1) {
|
|
1108
|
+
++dots;
|
|
1109
|
+
} else {
|
|
1110
|
+
dots = -1;
|
|
1111
|
+
}
|
|
1112
|
+
}
|
|
1113
|
+
return res;
|
|
1114
|
+
}
|
|
1115
|
+
var isAbsolute = function(p) {
|
|
1116
|
+
return _IS_ABSOLUTE_RE.test(p);
|
|
1117
|
+
};
|
|
1118
|
+
|
|
1119
|
+
// ../config-tools/src/utilities/find-up.ts
|
|
1120
|
+
var import_node_fs = require("fs");
|
|
1121
|
+
var import_node_path = require("path");
|
|
1122
|
+
var MAX_PATH_SEARCH_DEPTH = 30;
|
|
1123
|
+
var depth = 0;
|
|
1124
|
+
function findFolderUp(startPath, endFileNames = [], endDirectoryNames = []) {
|
|
1125
|
+
const _startPath = startPath ?? process.cwd();
|
|
1126
|
+
if (endDirectoryNames.some(
|
|
1127
|
+
(endDirName) => (0, import_node_fs.existsSync)((0, import_node_path.join)(_startPath, endDirName))
|
|
1128
|
+
)) {
|
|
1129
|
+
return _startPath;
|
|
1130
|
+
}
|
|
1131
|
+
if (endFileNames.some((endFileName) => (0, import_node_fs.existsSync)((0, import_node_path.join)(_startPath, endFileName)))) {
|
|
1132
|
+
return _startPath;
|
|
1133
|
+
}
|
|
1134
|
+
if (_startPath !== "/" && depth++ < MAX_PATH_SEARCH_DEPTH) {
|
|
1135
|
+
const parent = (0, import_node_path.join)(_startPath, "..");
|
|
1136
|
+
return findFolderUp(parent, endFileNames, endDirectoryNames);
|
|
1137
|
+
}
|
|
1138
|
+
return void 0;
|
|
1139
|
+
}
|
|
1140
|
+
|
|
1141
|
+
// ../config-tools/src/utilities/find-workspace-root.ts
|
|
1142
|
+
var rootFiles = [
|
|
1143
|
+
"storm-workspace.json",
|
|
1144
|
+
"storm-workspace.yaml",
|
|
1145
|
+
"storm-workspace.yml",
|
|
1146
|
+
"storm-workspace.js",
|
|
1147
|
+
"storm-workspace.ts",
|
|
1148
|
+
".storm-workspace.json",
|
|
1149
|
+
".storm-workspace.yaml",
|
|
1150
|
+
".storm-workspace.yml",
|
|
1151
|
+
".storm-workspace.js",
|
|
1152
|
+
".storm-workspace.ts",
|
|
1153
|
+
"lerna.json",
|
|
1154
|
+
"nx.json",
|
|
1155
|
+
"turbo.json",
|
|
1156
|
+
"npm-workspace.json",
|
|
1157
|
+
"yarn-workspace.json",
|
|
1158
|
+
"pnpm-workspace.json",
|
|
1159
|
+
"npm-workspace.yaml",
|
|
1160
|
+
"yarn-workspace.yaml",
|
|
1161
|
+
"pnpm-workspace.yaml",
|
|
1162
|
+
"npm-workspace.yml",
|
|
1163
|
+
"yarn-workspace.yml",
|
|
1164
|
+
"pnpm-workspace.yml",
|
|
1165
|
+
"npm-lock.json",
|
|
1166
|
+
"yarn-lock.json",
|
|
1167
|
+
"pnpm-lock.json",
|
|
1168
|
+
"npm-lock.yaml",
|
|
1169
|
+
"yarn-lock.yaml",
|
|
1170
|
+
"pnpm-lock.yaml",
|
|
1171
|
+
"npm-lock.yml",
|
|
1172
|
+
"yarn-lock.yml",
|
|
1173
|
+
"pnpm-lock.yml",
|
|
1174
|
+
"bun.lockb"
|
|
1175
|
+
];
|
|
1176
|
+
var rootDirectories = [
|
|
1177
|
+
".storm-workspace",
|
|
1178
|
+
".nx",
|
|
1179
|
+
".git",
|
|
1180
|
+
".github",
|
|
1181
|
+
".vscode",
|
|
1182
|
+
".verdaccio"
|
|
1183
|
+
];
|
|
1184
|
+
function findWorkspaceRootSafe(pathInsideMonorepo) {
|
|
1185
|
+
if (process.env.STORM_WORKSPACE_ROOT || process.env.NX_WORKSPACE_ROOT_PATH) {
|
|
1186
|
+
return correctPaths(
|
|
1187
|
+
process.env.STORM_WORKSPACE_ROOT ?? process.env.NX_WORKSPACE_ROOT_PATH
|
|
1188
|
+
);
|
|
1189
|
+
}
|
|
1190
|
+
return correctPaths(
|
|
1191
|
+
findFolderUp(
|
|
1192
|
+
pathInsideMonorepo ?? process.cwd(),
|
|
1193
|
+
rootFiles,
|
|
1194
|
+
rootDirectories
|
|
1195
|
+
)
|
|
1196
|
+
);
|
|
1197
|
+
}
|
|
1198
|
+
function findWorkspaceRoot(pathInsideMonorepo) {
|
|
1199
|
+
const result = findWorkspaceRootSafe(pathInsideMonorepo);
|
|
1200
|
+
if (!result) {
|
|
1201
|
+
throw new Error(
|
|
1202
|
+
`Cannot find workspace root upwards from known path. Files search list includes:
|
|
1203
|
+
${rootFiles.join(
|
|
1204
|
+
"\n"
|
|
1205
|
+
)}
|
|
1206
|
+
Path: ${pathInsideMonorepo ? pathInsideMonorepo : process.cwd()}`
|
|
1207
|
+
);
|
|
1208
|
+
}
|
|
1209
|
+
return result;
|
|
1210
|
+
}
|
|
1211
|
+
|
|
1212
|
+
// ../config/src/types.ts
|
|
1213
|
+
var COLOR_KEYS = [
|
|
1214
|
+
"dark",
|
|
1215
|
+
"light",
|
|
1216
|
+
"base",
|
|
1217
|
+
"brand",
|
|
1218
|
+
"alternate",
|
|
1219
|
+
"accent",
|
|
1220
|
+
"link",
|
|
1221
|
+
"success",
|
|
1222
|
+
"help",
|
|
1223
|
+
"info",
|
|
1224
|
+
"warning",
|
|
1225
|
+
"danger",
|
|
1226
|
+
"fatal",
|
|
1227
|
+
"performance",
|
|
1228
|
+
"positive",
|
|
1229
|
+
"negative"
|
|
1230
|
+
];
|
|
1231
|
+
|
|
1232
|
+
// ../config-tools/src/utilities/get-default-config.ts
|
|
1233
|
+
var import_node_fs2 = require("fs");
|
|
1234
|
+
var import_promises = require("fs/promises");
|
|
1235
|
+
var import_node_path2 = require("path");
|
|
1236
|
+
async function getPackageJsonConfig(root) {
|
|
1237
|
+
let license = STORM_DEFAULT_LICENSE;
|
|
1238
|
+
let homepage = void 0;
|
|
1239
|
+
let support = void 0;
|
|
1240
|
+
let name = void 0;
|
|
1241
|
+
let namespace = void 0;
|
|
1242
|
+
let repository = void 0;
|
|
1243
|
+
const workspaceRoot = findWorkspaceRoot(root);
|
|
1244
|
+
if ((0, import_node_fs2.existsSync)((0, import_node_path2.join)(workspaceRoot, "package.json"))) {
|
|
1245
|
+
const file = await (0, import_promises.readFile)(
|
|
1246
|
+
joinPaths(workspaceRoot, "package.json"),
|
|
1247
|
+
"utf8"
|
|
1248
|
+
);
|
|
1249
|
+
if (file) {
|
|
1250
|
+
const packageJson = JSON.parse(file);
|
|
1251
|
+
if (packageJson.name) {
|
|
1252
|
+
name = packageJson.name;
|
|
1253
|
+
}
|
|
1254
|
+
if (packageJson.namespace) {
|
|
1255
|
+
namespace = packageJson.namespace;
|
|
1256
|
+
}
|
|
1257
|
+
if (packageJson.repository) {
|
|
1258
|
+
if (typeof packageJson.repository === "string") {
|
|
1259
|
+
repository = packageJson.repository;
|
|
1260
|
+
} else if (packageJson.repository.url) {
|
|
1261
|
+
repository = packageJson.repository.url;
|
|
1262
|
+
}
|
|
1263
|
+
}
|
|
1264
|
+
if (packageJson.license) {
|
|
1265
|
+
license = packageJson.license;
|
|
1266
|
+
}
|
|
1267
|
+
if (packageJson.homepage) {
|
|
1268
|
+
homepage = packageJson.homepage;
|
|
1269
|
+
}
|
|
1270
|
+
if (packageJson.bugs) {
|
|
1271
|
+
if (typeof packageJson.bugs === "string") {
|
|
1272
|
+
support = packageJson.bugs;
|
|
1273
|
+
} else if (packageJson.bugs.url) {
|
|
1274
|
+
support = packageJson.bugs.url;
|
|
1275
|
+
}
|
|
1276
|
+
}
|
|
1277
|
+
}
|
|
1278
|
+
}
|
|
1279
|
+
return {
|
|
1280
|
+
workspaceRoot,
|
|
1281
|
+
name,
|
|
1282
|
+
namespace,
|
|
1283
|
+
repository,
|
|
1284
|
+
license,
|
|
1285
|
+
homepage,
|
|
1286
|
+
support
|
|
1287
|
+
};
|
|
1288
|
+
}
|
|
1289
|
+
function applyDefaultConfig(config) {
|
|
1290
|
+
if (!config.support && config.contact) {
|
|
1291
|
+
config.support = config.contact;
|
|
1292
|
+
}
|
|
1293
|
+
if (!config.contact && config.support) {
|
|
1294
|
+
config.contact = config.support;
|
|
1295
|
+
}
|
|
1296
|
+
if (config.homepage) {
|
|
1297
|
+
if (!config.docs) {
|
|
1298
|
+
config.docs = `${config.homepage}/docs`;
|
|
1299
|
+
}
|
|
1300
|
+
if (!config.license) {
|
|
1301
|
+
config.license = `${config.homepage}/license`;
|
|
1302
|
+
}
|
|
1303
|
+
if (!config.support) {
|
|
1304
|
+
config.support = `${config.homepage}/support`;
|
|
1305
|
+
}
|
|
1306
|
+
if (!config.contact) {
|
|
1307
|
+
config.contact = `${config.homepage}/contact`;
|
|
1308
|
+
}
|
|
1309
|
+
if (!config.error?.codesFile || !config?.error?.url) {
|
|
1310
|
+
config.error ??= { codesFile: STORM_DEFAULT_ERROR_CODES_FILE };
|
|
1311
|
+
if (config.homepage) {
|
|
1312
|
+
config.error.url ??= `${config.homepage}/errors`;
|
|
1313
|
+
}
|
|
1314
|
+
}
|
|
1315
|
+
}
|
|
1316
|
+
return config;
|
|
1317
|
+
}
|
|
1318
|
+
|
|
1319
|
+
// ../config-tools/src/utilities/process-handler.ts
|
|
1320
|
+
var exitWithError = (config) => {
|
|
1321
|
+
writeFatal("Exiting script with an error status...", config);
|
|
1322
|
+
process.exit(1);
|
|
1323
|
+
};
|
|
1324
|
+
var exitWithSuccess = (config) => {
|
|
1325
|
+
writeSuccess("Script completed successfully. Exiting...", config);
|
|
1326
|
+
process.exit(0);
|
|
1327
|
+
};
|
|
1328
|
+
var handleProcess = (config) => {
|
|
1329
|
+
writeTrace(
|
|
1330
|
+
`Using the following arguments to process the script: ${process.argv.join(", ")}`,
|
|
1331
|
+
config
|
|
1332
|
+
);
|
|
1333
|
+
process.on("unhandledRejection", (error) => {
|
|
1334
|
+
writeError(
|
|
1335
|
+
`An Unhandled Rejection occurred while running the program: ${error}`,
|
|
1336
|
+
config
|
|
1337
|
+
);
|
|
1338
|
+
exitWithError(config);
|
|
1339
|
+
});
|
|
1340
|
+
process.on("uncaughtException", (error) => {
|
|
1341
|
+
writeError(
|
|
1342
|
+
`An Uncaught Exception occurred while running the program: ${error.message}
|
|
1343
|
+
Stacktrace: ${error.stack}`,
|
|
1344
|
+
config
|
|
1345
|
+
);
|
|
1346
|
+
exitWithError(config);
|
|
1347
|
+
});
|
|
1348
|
+
process.on("SIGTERM", (signal) => {
|
|
1349
|
+
writeError(`The program terminated with signal code: ${signal}`, config);
|
|
1350
|
+
exitWithError(config);
|
|
1351
|
+
});
|
|
1352
|
+
process.on("SIGINT", (signal) => {
|
|
1353
|
+
writeError(`The program terminated with signal code: ${signal}`, config);
|
|
1354
|
+
exitWithError(config);
|
|
1355
|
+
});
|
|
1356
|
+
process.on("SIGHUP", (signal) => {
|
|
1357
|
+
writeError(`The program terminated with signal code: ${signal}`, config);
|
|
1358
|
+
exitWithError(config);
|
|
1359
|
+
});
|
|
1360
|
+
};
|
|
1361
|
+
|
|
1362
|
+
// ../config-tools/src/utilities/run.ts
|
|
1363
|
+
var import_node_child_process = require("child_process");
|
|
1364
|
+
var LARGE_BUFFER = 1024 * 1e6;
|
|
1365
|
+
var runAsync = (config, command, cwd = config.workspaceRoot ?? process.cwd(), env = process.env) => {
|
|
1366
|
+
return (0, import_node_child_process.exec)(command, {
|
|
1367
|
+
cwd,
|
|
1368
|
+
env: {
|
|
1369
|
+
...process.env,
|
|
1370
|
+
...env,
|
|
1371
|
+
CLICOLOR: "true",
|
|
1372
|
+
FORCE_COLOR: "true"
|
|
1373
|
+
},
|
|
1374
|
+
windowsHide: true,
|
|
1375
|
+
maxBuffer: LARGE_BUFFER,
|
|
1376
|
+
killSignal: "SIGTERM",
|
|
1377
|
+
encoding: "utf8"
|
|
1378
|
+
});
|
|
1379
|
+
};
|
|
1380
|
+
|
|
1381
|
+
// ../config-tools/src/config-file/get-config-file.ts
|
|
1382
|
+
var getConfigFileByName = async (fileName, filePath, options = {}) => {
|
|
1383
|
+
const workspacePath = filePath || findWorkspaceRoot(filePath);
|
|
1384
|
+
const configs = await Promise.all([
|
|
1385
|
+
(0, import_c12.loadConfig)({
|
|
1386
|
+
cwd: workspacePath,
|
|
1387
|
+
packageJson: true,
|
|
1388
|
+
name: fileName,
|
|
1389
|
+
envName: fileName?.toUpperCase(),
|
|
1390
|
+
jitiOptions: {
|
|
1391
|
+
debug: false,
|
|
1392
|
+
fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : joinPaths(
|
|
1393
|
+
process.env.STORM_CACHE_DIR || "node_modules/.cache/storm",
|
|
1394
|
+
"jiti"
|
|
1395
|
+
)
|
|
1396
|
+
},
|
|
1397
|
+
...options
|
|
1398
|
+
}),
|
|
1399
|
+
(0, import_c12.loadConfig)({
|
|
1400
|
+
cwd: workspacePath,
|
|
1401
|
+
packageJson: true,
|
|
1402
|
+
name: fileName,
|
|
1403
|
+
envName: fileName?.toUpperCase(),
|
|
1404
|
+
jitiOptions: {
|
|
1405
|
+
debug: false,
|
|
1406
|
+
fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : joinPaths(
|
|
1407
|
+
process.env.STORM_CACHE_DIR || "node_modules/.cache/storm",
|
|
1408
|
+
"jiti"
|
|
1409
|
+
)
|
|
1410
|
+
},
|
|
1411
|
+
configFile: fileName,
|
|
1412
|
+
...options
|
|
1413
|
+
})
|
|
1414
|
+
]);
|
|
1415
|
+
return (0, import_defu.default)(configs[0] ?? {}, configs[1] ?? {});
|
|
1416
|
+
};
|
|
1417
|
+
var getConfigFile = async (filePath, additionalFileNames = []) => {
|
|
1418
|
+
const workspacePath = filePath ? filePath : findWorkspaceRoot(filePath);
|
|
1419
|
+
const result = await getConfigFileByName("storm-workspace", workspacePath);
|
|
1420
|
+
let config = result.config;
|
|
1421
|
+
const configFile = result.configFile;
|
|
1422
|
+
if (config && configFile && Object.keys(config).length > 0 && !config.skipConfigLogging) {
|
|
1423
|
+
writeTrace(
|
|
1424
|
+
`Found Storm configuration file "${configFile.includes(`${workspacePath}/`) ? configFile.replace(`${workspacePath}/`, "") : configFile}" at "${workspacePath}"`,
|
|
1425
|
+
{
|
|
1426
|
+
logLevel: "all"
|
|
1427
|
+
}
|
|
1428
|
+
);
|
|
1429
|
+
}
|
|
1430
|
+
if (additionalFileNames && additionalFileNames.length > 0) {
|
|
1431
|
+
const results = await Promise.all(
|
|
1432
|
+
additionalFileNames.map(
|
|
1433
|
+
(fileName) => getConfigFileByName(fileName, workspacePath)
|
|
1434
|
+
)
|
|
1435
|
+
);
|
|
1436
|
+
for (const result2 of results) {
|
|
1437
|
+
if (result2?.config && result2?.configFile && Object.keys(result2.config).length > 0) {
|
|
1438
|
+
if (!config.skipConfigLogging && !result2.config.skipConfigLogging) {
|
|
1439
|
+
writeTrace(
|
|
1440
|
+
`Found alternative configuration file "${result2.configFile.includes(`${workspacePath}/`) ? result2.configFile.replace(`${workspacePath}/`, "") : result2.configFile}" at "${workspacePath}"`,
|
|
1441
|
+
{
|
|
1442
|
+
logLevel: "all"
|
|
1443
|
+
}
|
|
1444
|
+
);
|
|
1445
|
+
}
|
|
1446
|
+
config = (0, import_defu.default)(result2.config ?? {}, config ?? {});
|
|
1447
|
+
}
|
|
1448
|
+
}
|
|
1449
|
+
}
|
|
1450
|
+
if (!config || Object.keys(config).length === 0) {
|
|
1451
|
+
return void 0;
|
|
1452
|
+
}
|
|
1453
|
+
config.configFile = configFile;
|
|
1454
|
+
return config;
|
|
1455
|
+
};
|
|
1456
|
+
|
|
1457
|
+
// ../config-tools/src/env/get-env.ts
|
|
1458
|
+
var getExtensionEnv = (extensionName) => {
|
|
1459
|
+
const prefix = `STORM_EXTENSION_${extensionName.toUpperCase()}_`;
|
|
1460
|
+
return Object.keys(process.env).filter((key) => key.startsWith(prefix)).reduce((ret, key) => {
|
|
1461
|
+
const name = key.replace(prefix, "").split("_").map(
|
|
1462
|
+
(i) => i.length > 0 ? i.trim().charAt(0).toUpperCase() + i.trim().slice(1) : ""
|
|
1463
|
+
).join("");
|
|
1464
|
+
if (name) {
|
|
1465
|
+
ret[name] = process.env[key];
|
|
1466
|
+
}
|
|
1467
|
+
return ret;
|
|
1468
|
+
}, {});
|
|
1469
|
+
};
|
|
1470
|
+
var getConfigEnv = () => {
|
|
1471
|
+
const prefix = "STORM_";
|
|
1472
|
+
let config = {
|
|
1473
|
+
extends: process.env[`${prefix}EXTENDS`] || void 0,
|
|
1474
|
+
name: process.env[`${prefix}NAME`] || void 0,
|
|
1475
|
+
variant: process.env[`${prefix}VARIANT`] || void 0,
|
|
1476
|
+
namespace: process.env[`${prefix}NAMESPACE`] || void 0,
|
|
1477
|
+
owner: process.env[`${prefix}OWNER`] || void 0,
|
|
1478
|
+
bot: {
|
|
1479
|
+
name: process.env[`${prefix}BOT_NAME`] || void 0,
|
|
1480
|
+
email: process.env[`${prefix}BOT_EMAIL`] || void 0
|
|
1481
|
+
},
|
|
1482
|
+
release: {
|
|
1483
|
+
banner: {
|
|
1484
|
+
url: process.env[`${prefix}RELEASE_BANNER_URL`] || void 0,
|
|
1485
|
+
alt: process.env[`${prefix}RELEASE_BANNER_ALT`] || void 0
|
|
1486
|
+
},
|
|
1487
|
+
header: process.env[`${prefix}RELEASE_HEADER`] || void 0,
|
|
1488
|
+
footer: process.env[`${prefix}RELEASE_FOOTER`] || void 0
|
|
1489
|
+
},
|
|
1490
|
+
error: {
|
|
1491
|
+
codesFile: process.env[`${prefix}ERROR_CODES_FILE`] || void 0,
|
|
1492
|
+
url: process.env[`${prefix}ERROR_URL`] || void 0
|
|
1493
|
+
},
|
|
1494
|
+
socials: {
|
|
1495
|
+
twitter: process.env[`${prefix}SOCIAL_TWITTER`] || void 0,
|
|
1496
|
+
discord: process.env[`${prefix}SOCIAL_DISCORD`] || void 0,
|
|
1497
|
+
telegram: process.env[`${prefix}SOCIAL_TELEGRAM`] || void 0,
|
|
1498
|
+
slack: process.env[`${prefix}SOCIAL_SLACK`] || void 0,
|
|
1499
|
+
medium: process.env[`${prefix}SOCIAL_MEDIUM`] || void 0,
|
|
1500
|
+
github: process.env[`${prefix}SOCIAL_GITHUB`] || void 0
|
|
1501
|
+
},
|
|
1502
|
+
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`] ? {
|
|
1503
|
+
name: process.env[`${prefix}ORG`] || process.env[`${prefix}ORGANIZATION`] || process.env[`${prefix}ORG_NAME`] || process.env[`${prefix}ORGANIZATION_NAME`],
|
|
1504
|
+
description: process.env[`${prefix}ORG_DESCRIPTION`] || process.env[`${prefix}ORGANIZATION_DESCRIPTION`] || void 0,
|
|
1505
|
+
url: process.env[`${prefix}ORG_URL`] || process.env[`${prefix}ORGANIZATION_URL`] || void 0,
|
|
1506
|
+
logo: process.env[`${prefix}ORG_LOGO`] || process.env[`${prefix}ORGANIZATION_LOGO`] || void 0,
|
|
1507
|
+
icon: process.env[`${prefix}ORG_ICON`] || process.env[`${prefix}ORGANIZATION_ICON`] || void 0
|
|
1508
|
+
} : process.env[`${prefix}ORG`] || process.env[`${prefix}ORGANIZATION`] || process.env[`${prefix}ORG_NAME`] || process.env[`${prefix}ORGANIZATION_NAME`] : void 0,
|
|
1509
|
+
packageManager: process.env[`${prefix}PACKAGE_MANAGER`] || void 0,
|
|
1510
|
+
license: process.env[`${prefix}LICENSE`] || void 0,
|
|
1511
|
+
homepage: process.env[`${prefix}HOMEPAGE`] || void 0,
|
|
1512
|
+
docs: process.env[`${prefix}DOCS`] || void 0,
|
|
1513
|
+
portal: process.env[`${prefix}PORTAL`] || void 0,
|
|
1514
|
+
licensing: process.env[`${prefix}LICENSING`] || void 0,
|
|
1515
|
+
contact: process.env[`${prefix}CONTACT`] || void 0,
|
|
1516
|
+
support: process.env[`${prefix}SUPPORT`] || void 0,
|
|
1517
|
+
timezone: process.env[`${prefix}TIMEZONE`] || process.env.TZ || void 0,
|
|
1518
|
+
locale: process.env[`${prefix}LOCALE`] || process.env.LOCALE || void 0,
|
|
1519
|
+
configFile: process.env[`${prefix}WORKSPACE_CONFIG_FILE`] ? correctPaths(process.env[`${prefix}WORKSPACE_CONFIG_FILE`]) : void 0,
|
|
1520
|
+
workspaceRoot: process.env[`${prefix}WORKSPACE_ROOT`] ? correctPaths(process.env[`${prefix}WORKSPACE_ROOT`]) : void 0,
|
|
1521
|
+
directories: {
|
|
1522
|
+
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,
|
|
1523
|
+
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,
|
|
1524
|
+
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,
|
|
1525
|
+
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,
|
|
1526
|
+
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,
|
|
1527
|
+
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
|
|
1528
|
+
},
|
|
1529
|
+
skipCache: process.env[`${prefix}SKIP_CACHE`] !== void 0 ? Boolean(process.env[`${prefix}SKIP_CACHE`]) : void 0,
|
|
1530
|
+
mode: (process.env[`${prefix}MODE`] ?? process.env.NODE_ENV ?? process.env.ENVIRONMENT) || void 0,
|
|
1531
|
+
// ci:
|
|
1532
|
+
// process.env[`${prefix}CI`] !== undefined
|
|
1533
|
+
// ? Boolean(
|
|
1534
|
+
// process.env[`${prefix}CI`] ??
|
|
1535
|
+
// process.env.CI ??
|
|
1536
|
+
// process.env.CONTINUOUS_INTEGRATION
|
|
1537
|
+
// )
|
|
1538
|
+
// : undefined,
|
|
1539
|
+
repository: process.env[`${prefix}REPOSITORY`] || void 0,
|
|
1540
|
+
branch: process.env[`${prefix}BRANCH`] || void 0,
|
|
1541
|
+
preid: process.env[`${prefix}PRE_ID`] || void 0,
|
|
1542
|
+
registry: {
|
|
1543
|
+
github: process.env[`${prefix}REGISTRY_GITHUB`] || void 0,
|
|
1544
|
+
npm: process.env[`${prefix}REGISTRY_NPM`] || void 0,
|
|
1545
|
+
cargo: process.env[`${prefix}REGISTRY_CARGO`] || void 0,
|
|
1546
|
+
cyclone: process.env[`${prefix}REGISTRY_CYCLONE`] || void 0,
|
|
1547
|
+
container: process.env[`${prefix}REGISTRY_CONTAINER`] || void 0
|
|
1548
|
+
},
|
|
1549
|
+
logLevel: process.env[`${prefix}LOG_LEVEL`] !== null && process.env[`${prefix}LOG_LEVEL`] !== void 0 ? process.env[`${prefix}LOG_LEVEL`] && Number.isSafeInteger(
|
|
1550
|
+
Number.parseInt(process.env[`${prefix}LOG_LEVEL`])
|
|
1551
|
+
) ? getLogLevelLabel(
|
|
1552
|
+
Number.parseInt(process.env[`${prefix}LOG_LEVEL`])
|
|
1553
|
+
) : process.env[`${prefix}LOG_LEVEL`] : void 0,
|
|
1554
|
+
skipConfigLogging: process.env[`${prefix}SKIP_CONFIG_LOGGING`] !== void 0 ? Boolean(process.env[`${prefix}SKIP_CONFIG_LOGGING`]) : void 0
|
|
1555
|
+
};
|
|
1556
|
+
const themeNames = Object.keys(process.env).filter(
|
|
1557
|
+
(envKey) => envKey.startsWith(`${prefix}COLOR_`) && COLOR_KEYS.every(
|
|
1558
|
+
(colorKey) => !envKey.startsWith(`${prefix}COLOR_LIGHT_${colorKey}`) && !envKey.startsWith(`${prefix}COLOR_DARK_${colorKey}`)
|
|
1559
|
+
)
|
|
1560
|
+
);
|
|
1561
|
+
config.colors = themeNames.length > 0 ? themeNames.reduce(
|
|
1562
|
+
(ret, themeName) => {
|
|
1563
|
+
ret[themeName] = getThemeColorsEnv(prefix, themeName);
|
|
1564
|
+
return ret;
|
|
1565
|
+
},
|
|
1566
|
+
{}
|
|
1567
|
+
) : getThemeColorsEnv(prefix);
|
|
1568
|
+
if (config.docs === STORM_DEFAULT_DOCS) {
|
|
1569
|
+
if (config.homepage === STORM_DEFAULT_HOMEPAGE) {
|
|
1570
|
+
config.docs = `${STORM_DEFAULT_HOMEPAGE}/projects/${config.name}/docs`;
|
|
1571
|
+
} else {
|
|
1572
|
+
config.docs = `${config.homepage}/docs`;
|
|
1573
|
+
}
|
|
1574
|
+
}
|
|
1575
|
+
if (config.licensing === STORM_DEFAULT_LICENSING) {
|
|
1576
|
+
if (config.homepage === STORM_DEFAULT_HOMEPAGE) {
|
|
1577
|
+
config.licensing = `${STORM_DEFAULT_HOMEPAGE}/projects/${config.name}/licensing`;
|
|
1578
|
+
} else {
|
|
1579
|
+
config.licensing = `${config.homepage}/docs`;
|
|
1580
|
+
}
|
|
1581
|
+
}
|
|
1582
|
+
const serializedConfig = process.env[`${prefix}WORKSPACE_CONFIG`];
|
|
1583
|
+
if (serializedConfig) {
|
|
1584
|
+
const parsed = JSON.parse(serializedConfig);
|
|
1585
|
+
config = {
|
|
1586
|
+
...config,
|
|
1587
|
+
...parsed,
|
|
1588
|
+
colors: { ...config.colors, ...parsed.colors },
|
|
1589
|
+
extensions: { ...config.extensions, ...parsed.extensions }
|
|
1590
|
+
};
|
|
1591
|
+
}
|
|
1592
|
+
return config;
|
|
1593
|
+
};
|
|
1594
|
+
var getThemeColorsEnv = (prefix, theme) => {
|
|
1595
|
+
const themeName = `COLOR_${theme && theme !== "base" ? `${theme}_` : ""}`.toUpperCase();
|
|
1596
|
+
return process.env[`${prefix}${themeName}LIGHT_BRAND`] || process.env[`${prefix}${themeName}DARK_BRAND`] ? getMultiThemeColorsEnv(prefix + themeName) : getSingleThemeColorsEnv(prefix + themeName);
|
|
1597
|
+
};
|
|
1598
|
+
var getSingleThemeColorsEnv = (prefix) => {
|
|
1599
|
+
const gradient = [];
|
|
1600
|
+
if (process.env[`${prefix}GRADIENT_START`] && process.env[`${prefix}GRADIENT_END`]) {
|
|
1601
|
+
gradient.push(
|
|
1602
|
+
process.env[`${prefix}GRADIENT_START`],
|
|
1603
|
+
process.env[`${prefix}GRADIENT_END`]
|
|
1604
|
+
);
|
|
1605
|
+
} else if (process.env[`${prefix}GRADIENT_0`] || process.env[`${prefix}GRADIENT_1`]) {
|
|
1606
|
+
let index = process.env[`${prefix}GRADIENT_0`] ? 0 : 1;
|
|
1607
|
+
while (process.env[`${prefix}GRADIENT_${index}`]) {
|
|
1608
|
+
gradient.push(process.env[`${prefix}GRADIENT_${index}`]);
|
|
1609
|
+
index++;
|
|
1610
|
+
}
|
|
1611
|
+
}
|
|
1612
|
+
return {
|
|
1613
|
+
dark: process.env[`${prefix}DARK`],
|
|
1614
|
+
light: process.env[`${prefix}LIGHT`],
|
|
1615
|
+
brand: process.env[`${prefix}BRAND`],
|
|
1616
|
+
alternate: process.env[`${prefix}ALTERNATE`],
|
|
1617
|
+
accent: process.env[`${prefix}ACCENT`],
|
|
1618
|
+
link: process.env[`${prefix}LINK`],
|
|
1619
|
+
help: process.env[`${prefix}HELP`],
|
|
1620
|
+
success: process.env[`${prefix}SUCCESS`],
|
|
1621
|
+
info: process.env[`${prefix}INFO`],
|
|
1622
|
+
debug: process.env[`${prefix}DEBUG`],
|
|
1623
|
+
warning: process.env[`${prefix}WARNING`],
|
|
1624
|
+
danger: process.env[`${prefix}DANGER`],
|
|
1625
|
+
fatal: process.env[`${prefix}FATAL`],
|
|
1626
|
+
performance: process.env[`${prefix}PERFORMANCE`],
|
|
1627
|
+
positive: process.env[`${prefix}POSITIVE`],
|
|
1628
|
+
negative: process.env[`${prefix}NEGATIVE`],
|
|
1629
|
+
gradient
|
|
1630
|
+
};
|
|
1631
|
+
};
|
|
1632
|
+
var getMultiThemeColorsEnv = (prefix) => {
|
|
1633
|
+
return {
|
|
1634
|
+
light: getBaseThemeColorsEnv(`${prefix}_LIGHT_`),
|
|
1635
|
+
dark: getBaseThemeColorsEnv(`${prefix}_DARK_`)
|
|
1636
|
+
};
|
|
1637
|
+
};
|
|
1638
|
+
var getBaseThemeColorsEnv = (prefix) => {
|
|
1639
|
+
const gradient = [];
|
|
1640
|
+
if (process.env[`${prefix}GRADIENT_START`] && process.env[`${prefix}GRADIENT_END`]) {
|
|
1641
|
+
gradient.push(
|
|
1642
|
+
process.env[`${prefix}GRADIENT_START`],
|
|
1643
|
+
process.env[`${prefix}GRADIENT_END`]
|
|
1644
|
+
);
|
|
1645
|
+
} else if (process.env[`${prefix}GRADIENT_0`] || process.env[`${prefix}GRADIENT_1`]) {
|
|
1646
|
+
let index = process.env[`${prefix}GRADIENT_0`] ? 0 : 1;
|
|
1647
|
+
while (process.env[`${prefix}GRADIENT_${index}`]) {
|
|
1648
|
+
gradient.push(process.env[`${prefix}GRADIENT_${index}`]);
|
|
1649
|
+
index++;
|
|
1650
|
+
}
|
|
1651
|
+
}
|
|
1652
|
+
return {
|
|
1653
|
+
foreground: process.env[`${prefix}FOREGROUND`],
|
|
1654
|
+
background: process.env[`${prefix}BACKGROUND`],
|
|
1655
|
+
brand: process.env[`${prefix}BRAND`],
|
|
1656
|
+
alternate: process.env[`${prefix}ALTERNATE`],
|
|
1657
|
+
accent: process.env[`${prefix}ACCENT`],
|
|
1658
|
+
link: process.env[`${prefix}LINK`],
|
|
1659
|
+
help: process.env[`${prefix}HELP`],
|
|
1660
|
+
success: process.env[`${prefix}SUCCESS`],
|
|
1661
|
+
info: process.env[`${prefix}INFO`],
|
|
1662
|
+
debug: process.env[`${prefix}DEBUG`],
|
|
1663
|
+
warning: process.env[`${prefix}WARNING`],
|
|
1664
|
+
danger: process.env[`${prefix}DANGER`],
|
|
1665
|
+
fatal: process.env[`${prefix}FATAL`],
|
|
1666
|
+
performance: process.env[`${prefix}PERFORMANCE`],
|
|
1667
|
+
positive: process.env[`${prefix}POSITIVE`],
|
|
1668
|
+
negative: process.env[`${prefix}NEGATIVE`],
|
|
1669
|
+
gradient
|
|
1670
|
+
};
|
|
1671
|
+
};
|
|
1672
|
+
|
|
1673
|
+
// ../config-tools/src/env/set-env.ts
|
|
1674
|
+
var setExtensionEnv = (extensionName, extension) => {
|
|
1675
|
+
for (const key of Object.keys(extension ?? {})) {
|
|
1676
|
+
if (extension[key]) {
|
|
1677
|
+
const result = key?.replace(
|
|
1678
|
+
/([A-Z])+/g,
|
|
1679
|
+
(input) => input ? input[0]?.toUpperCase() + input.slice(1) : ""
|
|
1680
|
+
).split(/(?=[A-Z])|[.\-\s_]/).map((x) => x.toLowerCase()) ?? [];
|
|
1681
|
+
let extensionKey;
|
|
1682
|
+
if (result.length === 0) {
|
|
1683
|
+
return;
|
|
1684
|
+
}
|
|
1685
|
+
if (result.length === 1) {
|
|
1686
|
+
extensionKey = result[0]?.toUpperCase() ?? "";
|
|
1687
|
+
} else {
|
|
1688
|
+
extensionKey = result.reduce((ret, part) => {
|
|
1689
|
+
return `${ret}_${part.toLowerCase()}`;
|
|
1690
|
+
});
|
|
1691
|
+
}
|
|
1692
|
+
process.env[`STORM_EXTENSION_${extensionName.toUpperCase()}_${extensionKey.toUpperCase()}`] = extension[key];
|
|
1693
|
+
}
|
|
1694
|
+
}
|
|
1695
|
+
};
|
|
1696
|
+
var setConfigEnv = (config) => {
|
|
1697
|
+
const prefix = "STORM_";
|
|
1698
|
+
if (config.extends) {
|
|
1699
|
+
process.env[`${prefix}EXTENDS`] = Array.isArray(config.extends) ? JSON.stringify(config.extends) : config.extends;
|
|
1700
|
+
}
|
|
1701
|
+
if (config.name) {
|
|
1702
|
+
process.env[`${prefix}NAME`] = config.name;
|
|
1703
|
+
}
|
|
1704
|
+
if (config.variant) {
|
|
1705
|
+
process.env[`${prefix}VARIANT`] = config.variant;
|
|
1706
|
+
}
|
|
1707
|
+
if (config.namespace) {
|
|
1708
|
+
process.env[`${prefix}NAMESPACE`] = config.namespace;
|
|
1709
|
+
}
|
|
1710
|
+
if (config.owner) {
|
|
1711
|
+
process.env[`${prefix}OWNER`] = config.owner;
|
|
1712
|
+
}
|
|
1713
|
+
if (config.bot) {
|
|
1714
|
+
process.env[`${prefix}BOT_NAME`] = config.bot.name;
|
|
1715
|
+
process.env[`${prefix}BOT_EMAIL`] = config.bot.email;
|
|
1716
|
+
}
|
|
1717
|
+
if (config.error) {
|
|
1718
|
+
process.env[`${prefix}ERROR_CODES_FILE`] = config.error.codesFile;
|
|
1719
|
+
process.env[`${prefix}ERROR_URL`] = config.error.url;
|
|
1720
|
+
}
|
|
1721
|
+
if (config.release) {
|
|
1722
|
+
if (config.release.banner) {
|
|
1723
|
+
if (typeof config.release.banner === "string") {
|
|
1724
|
+
process.env[`${prefix}RELEASE_BANNER`] = config.release.banner;
|
|
1725
|
+
process.env[`${prefix}RELEASE_BANNER_URL`] = config.release.banner;
|
|
1726
|
+
} else {
|
|
1727
|
+
process.env[`${prefix}RELEASE_BANNER`] = config.release.banner.url;
|
|
1728
|
+
process.env[`${prefix}RELEASE_BANNER_URL`] = config.release.banner.url;
|
|
1729
|
+
process.env[`${prefix}RELEASE_BANNER_ALT`] = config.release.banner.alt;
|
|
1730
|
+
}
|
|
1731
|
+
}
|
|
1732
|
+
process.env[`${prefix}RELEASE_HEADER`] = config.release.header;
|
|
1733
|
+
process.env[`${prefix}RELEASE_FOOTER`] = config.release.footer;
|
|
1734
|
+
}
|
|
1735
|
+
if (config.socials) {
|
|
1736
|
+
if (config.socials.twitter) {
|
|
1737
|
+
process.env[`${prefix}SOCIAL_TWITTER`] = config.socials.twitter;
|
|
1738
|
+
}
|
|
1739
|
+
if (config.socials.discord) {
|
|
1740
|
+
process.env[`${prefix}SOCIAL_DISCORD`] = config.socials.discord;
|
|
1741
|
+
}
|
|
1742
|
+
if (config.socials.telegram) {
|
|
1743
|
+
process.env[`${prefix}SOCIAL_TELEGRAM`] = config.socials.telegram;
|
|
1744
|
+
}
|
|
1745
|
+
if (config.socials.slack) {
|
|
1746
|
+
process.env[`${prefix}SOCIAL_SLACK`] = config.socials.slack;
|
|
1747
|
+
}
|
|
1748
|
+
if (config.socials.medium) {
|
|
1749
|
+
process.env[`${prefix}SOCIAL_MEDIUM`] = config.socials.medium;
|
|
1750
|
+
}
|
|
1751
|
+
if (config.socials.github) {
|
|
1752
|
+
process.env[`${prefix}SOCIAL_GITHUB`] = config.socials.github;
|
|
1753
|
+
}
|
|
1754
|
+
}
|
|
1755
|
+
if (config.organization) {
|
|
1756
|
+
if (typeof config.organization === "string") {
|
|
1757
|
+
process.env[`${prefix}ORG`] = config.organization;
|
|
1758
|
+
process.env[`${prefix}ORG_NAME`] = config.organization;
|
|
1759
|
+
process.env[`${prefix}ORGANIZATION`] = config.organization;
|
|
1760
|
+
process.env[`${prefix}ORGANIZATION_NAME`] = config.organization;
|
|
1761
|
+
} else {
|
|
1762
|
+
process.env[`${prefix}ORG`] = config.organization.name;
|
|
1763
|
+
process.env[`${prefix}ORG_NAME`] = config.organization.name;
|
|
1764
|
+
process.env[`${prefix}ORGANIZATION`] = config.organization.name;
|
|
1765
|
+
process.env[`${prefix}ORGANIZATION_NAME`] = config.organization.name;
|
|
1766
|
+
if (config.organization.url) {
|
|
1767
|
+
process.env[`${prefix}ORG_URL`] = config.organization.url;
|
|
1768
|
+
process.env[`${prefix}ORGANIZATION_URL`] = config.organization.url;
|
|
1769
|
+
}
|
|
1770
|
+
if (config.organization.description) {
|
|
1771
|
+
process.env[`${prefix}ORG_DESCRIPTION`] = config.organization.description;
|
|
1772
|
+
process.env[`${prefix}ORGANIZATION_DESCRIPTION`] = config.organization.description;
|
|
1773
|
+
}
|
|
1774
|
+
if (config.organization.logo) {
|
|
1775
|
+
process.env[`${prefix}ORG_LOGO`] = config.organization.logo;
|
|
1776
|
+
process.env[`${prefix}ORGANIZATION_LOGO`] = config.organization.logo;
|
|
1777
|
+
}
|
|
1778
|
+
if (config.organization.icon) {
|
|
1779
|
+
process.env[`${prefix}ORG_ICON`] = config.organization.icon;
|
|
1780
|
+
process.env[`${prefix}ORGANIZATION_ICON`] = config.organization.icon;
|
|
1781
|
+
}
|
|
1782
|
+
}
|
|
1783
|
+
}
|
|
1784
|
+
if (config.packageManager) {
|
|
1785
|
+
process.env[`${prefix}PACKAGE_MANAGER`] = config.packageManager;
|
|
1786
|
+
}
|
|
1787
|
+
if (config.license) {
|
|
1788
|
+
process.env[`${prefix}LICENSE`] = config.license;
|
|
1789
|
+
}
|
|
1790
|
+
if (config.homepage) {
|
|
1791
|
+
process.env[`${prefix}HOMEPAGE`] = config.homepage;
|
|
1792
|
+
}
|
|
1793
|
+
if (config.docs) {
|
|
1794
|
+
process.env[`${prefix}DOCS`] = config.docs;
|
|
1795
|
+
}
|
|
1796
|
+
if (config.portal) {
|
|
1797
|
+
process.env[`${prefix}PORTAL`] = config.portal;
|
|
1798
|
+
}
|
|
1799
|
+
if (config.licensing) {
|
|
1800
|
+
process.env[`${prefix}LICENSING`] = config.licensing;
|
|
1801
|
+
}
|
|
1802
|
+
if (config.contact) {
|
|
1803
|
+
process.env[`${prefix}CONTACT`] = config.contact;
|
|
1804
|
+
}
|
|
1805
|
+
if (config.support) {
|
|
1806
|
+
process.env[`${prefix}SUPPORT`] = config.support;
|
|
1807
|
+
}
|
|
1808
|
+
if (config.timezone) {
|
|
1809
|
+
process.env[`${prefix}TIMEZONE`] = config.timezone;
|
|
1810
|
+
process.env.TZ = config.timezone;
|
|
1811
|
+
process.env.DEFAULT_TIMEZONE = config.timezone;
|
|
1812
|
+
process.env.TIMEZONE = config.timezone;
|
|
1813
|
+
}
|
|
1814
|
+
if (config.locale) {
|
|
1815
|
+
process.env[`${prefix}LOCALE`] = config.locale;
|
|
1816
|
+
process.env.DEFAULT_LOCALE = config.locale;
|
|
1817
|
+
process.env.LOCALE = config.locale;
|
|
1818
|
+
process.env.LANG = config.locale ? `${config.locale.replaceAll("-", "_")}.UTF-8` : "en_US.UTF-8";
|
|
1819
|
+
}
|
|
1820
|
+
if (config.configFile) {
|
|
1821
|
+
process.env[`${prefix}WORKSPACE_CONFIG_FILE`] = correctPaths(
|
|
1822
|
+
config.configFile
|
|
1823
|
+
);
|
|
1824
|
+
}
|
|
1825
|
+
if (config.workspaceRoot) {
|
|
1826
|
+
process.env[`${prefix}WORKSPACE_ROOT`] = correctPaths(config.workspaceRoot);
|
|
1827
|
+
process.env.NX_WORKSPACE_ROOT = correctPaths(config.workspaceRoot);
|
|
1828
|
+
process.env.NX_WORKSPACE_ROOT_PATH = correctPaths(config.workspaceRoot);
|
|
1829
|
+
}
|
|
1830
|
+
if (config.directories) {
|
|
1831
|
+
if (!config.skipCache && config.directories.cache) {
|
|
1832
|
+
process.env[`${prefix}CACHE_DIR`] = correctPaths(
|
|
1833
|
+
config.directories.cache
|
|
1834
|
+
);
|
|
1835
|
+
process.env[`${prefix}CACHE_DIRECTORY`] = process.env[`${prefix}CACHE_DIR`];
|
|
1836
|
+
}
|
|
1837
|
+
if (config.directories.data) {
|
|
1838
|
+
process.env[`${prefix}DATA_DIR`] = correctPaths(config.directories.data);
|
|
1839
|
+
process.env[`${prefix}DATA_DIRECTORY`] = process.env[`${prefix}DATA_DIR`];
|
|
1840
|
+
}
|
|
1841
|
+
if (config.directories.config) {
|
|
1842
|
+
process.env[`${prefix}CONFIG_DIR`] = correctPaths(
|
|
1843
|
+
config.directories.config
|
|
1844
|
+
);
|
|
1845
|
+
process.env[`${prefix}CONFIG_DIRECTORY`] = process.env[`${prefix}CONFIG_DIR`];
|
|
1846
|
+
}
|
|
1847
|
+
if (config.directories.temp) {
|
|
1848
|
+
process.env[`${prefix}TEMP_DIR`] = correctPaths(config.directories.temp);
|
|
1849
|
+
process.env[`${prefix}TEMP_DIRECTORY`] = process.env[`${prefix}TEMP_DIR`];
|
|
1850
|
+
}
|
|
1851
|
+
if (config.directories.log) {
|
|
1852
|
+
process.env[`${prefix}LOG_DIR`] = correctPaths(config.directories.log);
|
|
1853
|
+
process.env[`${prefix}LOG_DIRECTORY`] = process.env[`${prefix}LOG_DIR`];
|
|
1854
|
+
}
|
|
1855
|
+
if (config.directories.build) {
|
|
1856
|
+
process.env[`${prefix}BUILD_DIR`] = correctPaths(
|
|
1857
|
+
config.directories.build
|
|
1858
|
+
);
|
|
1859
|
+
process.env[`${prefix}BUILD_DIRECTORY`] = process.env[`${prefix}BUILD_DIR`];
|
|
1860
|
+
}
|
|
1861
|
+
}
|
|
1862
|
+
if (config.skipCache !== void 0) {
|
|
1863
|
+
process.env[`${prefix}SKIP_CACHE`] = String(config.skipCache);
|
|
1864
|
+
if (config.skipCache) {
|
|
1865
|
+
process.env.NX_SKIP_NX_CACHE ??= String(config.skipCache);
|
|
1866
|
+
process.env.NX_CACHE_PROJECT_GRAPH ??= String(config.skipCache);
|
|
1867
|
+
}
|
|
1868
|
+
}
|
|
1869
|
+
if (config.mode) {
|
|
1870
|
+
process.env[`${prefix}MODE`] = config.mode;
|
|
1871
|
+
process.env.NODE_ENV = config.mode;
|
|
1872
|
+
process.env.ENVIRONMENT = config.mode;
|
|
1873
|
+
}
|
|
1874
|
+
if (config.colors?.base?.light || config.colors?.base?.dark) {
|
|
1875
|
+
for (const key of Object.keys(config.colors)) {
|
|
1876
|
+
setThemeColorsEnv(`${prefix}COLOR_${key}_`, config.colors[key]);
|
|
1877
|
+
}
|
|
1878
|
+
} else {
|
|
1879
|
+
setThemeColorsEnv(
|
|
1880
|
+
`${prefix}COLOR_`,
|
|
1881
|
+
config.colors
|
|
1882
|
+
);
|
|
1883
|
+
}
|
|
1884
|
+
if (config.repository) {
|
|
1885
|
+
process.env[`${prefix}REPOSITORY`] = config.repository;
|
|
1886
|
+
}
|
|
1887
|
+
if (config.branch) {
|
|
1888
|
+
process.env[`${prefix}BRANCH`] = config.branch;
|
|
1889
|
+
}
|
|
1890
|
+
if (config.preid) {
|
|
1891
|
+
process.env[`${prefix}PRE_ID`] = String(config.preid);
|
|
1892
|
+
}
|
|
1893
|
+
if (config.registry) {
|
|
1894
|
+
if (config.registry.github) {
|
|
1895
|
+
process.env[`${prefix}REGISTRY_GITHUB`] = String(config.registry.github);
|
|
1896
|
+
}
|
|
1897
|
+
if (config.registry.npm) {
|
|
1898
|
+
process.env[`${prefix}REGISTRY_NPM`] = String(config.registry.npm);
|
|
1899
|
+
}
|
|
1900
|
+
if (config.registry.cargo) {
|
|
1901
|
+
process.env[`${prefix}REGISTRY_CARGO`] = String(config.registry.cargo);
|
|
1902
|
+
}
|
|
1903
|
+
if (config.registry.cyclone) {
|
|
1904
|
+
process.env[`${prefix}REGISTRY_CYCLONE`] = String(
|
|
1905
|
+
config.registry.cyclone
|
|
1906
|
+
);
|
|
1907
|
+
}
|
|
1908
|
+
if (config.registry.container) {
|
|
1909
|
+
process.env[`${prefix}REGISTRY_CONTAINER`] = String(
|
|
1910
|
+
config.registry.container
|
|
1911
|
+
);
|
|
1912
|
+
}
|
|
1913
|
+
}
|
|
1914
|
+
if (config.logLevel) {
|
|
1915
|
+
process.env[`${prefix}LOG_LEVEL`] = String(config.logLevel);
|
|
1916
|
+
process.env.LOG_LEVEL = String(config.logLevel);
|
|
1917
|
+
process.env.NX_VERBOSE_LOGGING = String(
|
|
1918
|
+
getLogLevel(config.logLevel) >= LogLevel.DEBUG ? true : false
|
|
1919
|
+
);
|
|
1920
|
+
process.env.RUST_BACKTRACE = getLogLevel(config.logLevel) >= LogLevel.DEBUG ? "full" : "none";
|
|
1921
|
+
}
|
|
1922
|
+
if (config.skipConfigLogging !== void 0) {
|
|
1923
|
+
process.env[`${prefix}SKIP_CONFIG_LOGGING`] = String(
|
|
1924
|
+
config.skipConfigLogging
|
|
1925
|
+
);
|
|
1926
|
+
}
|
|
1927
|
+
process.env[`${prefix}WORKSPACE_CONFIG`] = JSON.stringify(config);
|
|
1928
|
+
for (const key of Object.keys(config.extensions ?? {})) {
|
|
1929
|
+
if (config.extensions[key] && Object.keys(config.extensions[key])) {
|
|
1930
|
+
setExtensionEnv(key, config.extensions[key]);
|
|
1931
|
+
}
|
|
1932
|
+
}
|
|
1933
|
+
};
|
|
1934
|
+
var setThemeColorsEnv = (prefix, config) => {
|
|
1935
|
+
return config?.light?.brand || config?.dark?.brand ? setMultiThemeColorsEnv(prefix, config) : setSingleThemeColorsEnv(prefix, config);
|
|
1936
|
+
};
|
|
1937
|
+
var setSingleThemeColorsEnv = (prefix, config) => {
|
|
1938
|
+
if (config.dark) {
|
|
1939
|
+
process.env[`${prefix}DARK`] = config.dark;
|
|
1940
|
+
}
|
|
1941
|
+
if (config.light) {
|
|
1942
|
+
process.env[`${prefix}LIGHT`] = config.light;
|
|
1943
|
+
}
|
|
1944
|
+
if (config.brand) {
|
|
1945
|
+
process.env[`${prefix}BRAND`] = config.brand;
|
|
1946
|
+
}
|
|
1947
|
+
if (config.alternate) {
|
|
1948
|
+
process.env[`${prefix}ALTERNATE`] = config.alternate;
|
|
1949
|
+
}
|
|
1950
|
+
if (config.accent) {
|
|
1951
|
+
process.env[`${prefix}ACCENT`] = config.accent;
|
|
1952
|
+
}
|
|
1953
|
+
if (config.link) {
|
|
1954
|
+
process.env[`${prefix}LINK`] = config.link;
|
|
1955
|
+
}
|
|
1956
|
+
if (config.help) {
|
|
1957
|
+
process.env[`${prefix}HELP`] = config.help;
|
|
1958
|
+
}
|
|
1959
|
+
if (config.success) {
|
|
1960
|
+
process.env[`${prefix}SUCCESS`] = config.success;
|
|
1961
|
+
}
|
|
1962
|
+
if (config.info) {
|
|
1963
|
+
process.env[`${prefix}INFO`] = config.info;
|
|
1964
|
+
}
|
|
1965
|
+
if (config.debug) {
|
|
1966
|
+
process.env[`${prefix}DEBUG`] = config.debug;
|
|
1967
|
+
}
|
|
1968
|
+
if (config.warning) {
|
|
1969
|
+
process.env[`${prefix}WARNING`] = config.warning;
|
|
1970
|
+
}
|
|
1971
|
+
if (config.danger) {
|
|
1972
|
+
process.env[`${prefix}DANGER`] = config.danger;
|
|
1973
|
+
}
|
|
1974
|
+
if (config.fatal) {
|
|
1975
|
+
process.env[`${prefix}FATAL`] = config.fatal;
|
|
1976
|
+
}
|
|
1977
|
+
if (config.performance) {
|
|
1978
|
+
process.env[`${prefix}PERFORMANCE`] = config.performance;
|
|
1979
|
+
}
|
|
1980
|
+
if (config.positive) {
|
|
1981
|
+
process.env[`${prefix}POSITIVE`] = config.positive;
|
|
1982
|
+
}
|
|
1983
|
+
if (config.negative) {
|
|
1984
|
+
process.env[`${prefix}NEGATIVE`] = config.negative;
|
|
1985
|
+
}
|
|
1986
|
+
if (config.gradient) {
|
|
1987
|
+
for (let i = 0; i < config.gradient.length; i++) {
|
|
1988
|
+
process.env[`${prefix}GRADIENT_${i}`] = config.gradient[i];
|
|
1989
|
+
}
|
|
1990
|
+
}
|
|
1991
|
+
};
|
|
1992
|
+
var setMultiThemeColorsEnv = (prefix, config) => {
|
|
1993
|
+
return {
|
|
1994
|
+
light: setBaseThemeColorsEnv(`${prefix}LIGHT_`, config.light),
|
|
1995
|
+
dark: setBaseThemeColorsEnv(`${prefix}DARK_`, config.dark)
|
|
1996
|
+
};
|
|
1997
|
+
};
|
|
1998
|
+
var setBaseThemeColorsEnv = (prefix, config) => {
|
|
1999
|
+
if (config.foreground) {
|
|
2000
|
+
process.env[`${prefix}FOREGROUND`] = config.foreground;
|
|
2001
|
+
}
|
|
2002
|
+
if (config.background) {
|
|
2003
|
+
process.env[`${prefix}BACKGROUND`] = config.background;
|
|
2004
|
+
}
|
|
2005
|
+
if (config.brand) {
|
|
2006
|
+
process.env[`${prefix}BRAND`] = config.brand;
|
|
2007
|
+
}
|
|
2008
|
+
if (config.alternate) {
|
|
2009
|
+
process.env[`${prefix}ALTERNATE`] = config.alternate;
|
|
2010
|
+
}
|
|
2011
|
+
if (config.accent) {
|
|
2012
|
+
process.env[`${prefix}ACCENT`] = config.accent;
|
|
2013
|
+
}
|
|
2014
|
+
if (config.link) {
|
|
2015
|
+
process.env[`${prefix}LINK`] = config.link;
|
|
2016
|
+
}
|
|
2017
|
+
if (config.help) {
|
|
2018
|
+
process.env[`${prefix}HELP`] = config.help;
|
|
2019
|
+
}
|
|
2020
|
+
if (config.success) {
|
|
2021
|
+
process.env[`${prefix}SUCCESS`] = config.success;
|
|
2022
|
+
}
|
|
2023
|
+
if (config.info) {
|
|
2024
|
+
process.env[`${prefix}INFO`] = config.info;
|
|
2025
|
+
}
|
|
2026
|
+
if (config.debug) {
|
|
2027
|
+
process.env[`${prefix}DEBUG`] = config.debug;
|
|
2028
|
+
}
|
|
2029
|
+
if (config.warning) {
|
|
2030
|
+
process.env[`${prefix}WARNING`] = config.warning;
|
|
2031
|
+
}
|
|
2032
|
+
if (config.danger) {
|
|
2033
|
+
process.env[`${prefix}DANGER`] = config.danger;
|
|
2034
|
+
}
|
|
2035
|
+
if (config.fatal) {
|
|
2036
|
+
process.env[`${prefix}FATAL`] = config.fatal;
|
|
2037
|
+
}
|
|
2038
|
+
if (config.performance) {
|
|
2039
|
+
process.env[`${prefix}PERFORMANCE`] = config.performance;
|
|
2040
|
+
}
|
|
2041
|
+
if (config.positive) {
|
|
2042
|
+
process.env[`${prefix}POSITIVE`] = config.positive;
|
|
2043
|
+
}
|
|
2044
|
+
if (config.negative) {
|
|
2045
|
+
process.env[`${prefix}NEGATIVE`] = config.negative;
|
|
2046
|
+
}
|
|
2047
|
+
if (config.gradient) {
|
|
2048
|
+
for (let i = 0; i < config.gradient.length; i++) {
|
|
2049
|
+
process.env[`${prefix}GRADIENT_${i}`] = config.gradient[i];
|
|
2050
|
+
}
|
|
2051
|
+
}
|
|
2052
|
+
};
|
|
2053
|
+
|
|
2054
|
+
// ../config-tools/src/create-storm-config.ts
|
|
2055
|
+
var _extension_cache = /* @__PURE__ */ new WeakMap();
|
|
2056
|
+
var _static_cache = void 0;
|
|
2057
|
+
var createStormWorkspaceConfig = async (extensionName, schema, workspaceRoot, skipLogs = false, useDefault = true) => {
|
|
2058
|
+
let result;
|
|
2059
|
+
if (!_static_cache?.data || !_static_cache?.timestamp || _static_cache.timestamp < Date.now() - 8e3) {
|
|
2060
|
+
let _workspaceRoot = workspaceRoot;
|
|
2061
|
+
if (!_workspaceRoot) {
|
|
2062
|
+
_workspaceRoot = findWorkspaceRoot();
|
|
2063
|
+
}
|
|
2064
|
+
const configEnv = getConfigEnv();
|
|
2065
|
+
const configFile = await getConfigFile(_workspaceRoot);
|
|
2066
|
+
if (!configFile) {
|
|
2067
|
+
if (!skipLogs) {
|
|
2068
|
+
writeWarning(
|
|
2069
|
+
"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",
|
|
2070
|
+
{ logLevel: "all" }
|
|
2071
|
+
);
|
|
2072
|
+
}
|
|
2073
|
+
if (useDefault === false) {
|
|
2074
|
+
return void 0;
|
|
2075
|
+
}
|
|
2076
|
+
}
|
|
2077
|
+
const defaultConfig = await getPackageJsonConfig(_workspaceRoot);
|
|
2078
|
+
const configInput = (0, import_defu2.default)(
|
|
2079
|
+
configEnv,
|
|
2080
|
+
configFile,
|
|
2081
|
+
defaultConfig
|
|
2082
|
+
);
|
|
2083
|
+
if (!configInput.variant) {
|
|
2084
|
+
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";
|
|
2085
|
+
}
|
|
2086
|
+
try {
|
|
2087
|
+
result = applyDefaultConfig(
|
|
2088
|
+
await workspaceConfigSchema.parseAsync(configInput)
|
|
2089
|
+
);
|
|
2090
|
+
result.workspaceRoot ??= _workspaceRoot;
|
|
2091
|
+
} catch (error) {
|
|
2092
|
+
throw new Error(
|
|
2093
|
+
`Failed to parse Storm Workspace configuration${error?.message ? `: ${error.message}` : ""}
|
|
2094
|
+
|
|
2095
|
+
Please ensure your configuration file is valid JSON and matches the expected schema. The current workspace configuration input is: ${formatLogMessage(
|
|
2096
|
+
configInput
|
|
2097
|
+
)}`,
|
|
2098
|
+
{
|
|
2099
|
+
cause: error
|
|
2100
|
+
}
|
|
2101
|
+
);
|
|
2102
|
+
}
|
|
2103
|
+
} else {
|
|
2104
|
+
result = _static_cache.data;
|
|
2105
|
+
}
|
|
2106
|
+
if (schema && extensionName) {
|
|
2107
|
+
result.extensions = {
|
|
2108
|
+
...result.extensions,
|
|
2109
|
+
[extensionName]: createConfigExtension(extensionName, schema)
|
|
2110
|
+
};
|
|
2111
|
+
}
|
|
2112
|
+
_static_cache = {
|
|
2113
|
+
timestamp: Date.now(),
|
|
2114
|
+
data: result
|
|
2115
|
+
};
|
|
2116
|
+
return result;
|
|
2117
|
+
};
|
|
2118
|
+
var createConfigExtension = (extensionName, schema) => {
|
|
2119
|
+
const extension_cache_key = { extensionName };
|
|
2120
|
+
if (_extension_cache.has(extension_cache_key)) {
|
|
2121
|
+
return _extension_cache.get(extension_cache_key);
|
|
2122
|
+
}
|
|
2123
|
+
let extension = getExtensionEnv(extensionName);
|
|
2124
|
+
if (schema) {
|
|
2125
|
+
extension = schema.parse(extension);
|
|
2126
|
+
}
|
|
2127
|
+
_extension_cache.set(extension_cache_key, extension);
|
|
2128
|
+
return extension;
|
|
2129
|
+
};
|
|
2130
|
+
var loadStormWorkspaceConfig = async (workspaceRoot, skipLogs = false) => {
|
|
2131
|
+
const config = await createStormWorkspaceConfig(
|
|
2132
|
+
void 0,
|
|
2133
|
+
void 0,
|
|
2134
|
+
workspaceRoot,
|
|
2135
|
+
skipLogs,
|
|
2136
|
+
true
|
|
2137
|
+
);
|
|
2138
|
+
setConfigEnv(config);
|
|
2139
|
+
if (!skipLogs && !config.skipConfigLogging) {
|
|
2140
|
+
writeTrace(
|
|
2141
|
+
`\u2699\uFE0F Using Storm Workspace configuration:
|
|
2142
|
+
${formatLogMessage(config)}`,
|
|
2143
|
+
config
|
|
2144
|
+
);
|
|
2145
|
+
}
|
|
2146
|
+
return config;
|
|
2147
|
+
};
|
|
2148
|
+
|
|
2149
|
+
// ../config-tools/src/get-config.ts
|
|
2150
|
+
function getConfig(workspaceRoot, skipLogs = false) {
|
|
2151
|
+
return loadStormWorkspaceConfig(workspaceRoot, skipLogs);
|
|
2152
|
+
}
|
|
2153
|
+
function getWorkspaceConfig(skipLogs = true, options = {}) {
|
|
2154
|
+
let workspaceRoot = options.workspaceRoot;
|
|
2155
|
+
if (!workspaceRoot) {
|
|
2156
|
+
workspaceRoot = findWorkspaceRoot(options.cwd);
|
|
2157
|
+
}
|
|
2158
|
+
return getConfig(workspaceRoot, skipLogs);
|
|
2159
|
+
}
|
|
2160
|
+
|
|
2161
|
+
// ../build-tools/src/constants/internal-packages.ts
|
|
2162
|
+
var INTERNAL_PACKAGES = [
|
|
2163
|
+
"@storm-software/*",
|
|
2164
|
+
"conventional-changelog-storm-software",
|
|
2165
|
+
"pnpm-plugin-storm-software",
|
|
2166
|
+
"@stryke/*",
|
|
2167
|
+
"@powerlines/*",
|
|
2168
|
+
"powerlines",
|
|
2169
|
+
"@shell-shock/*",
|
|
2170
|
+
"@earthquake/*",
|
|
2171
|
+
"earthquake"
|
|
2172
|
+
];
|
|
2173
|
+
|
|
2174
|
+
// ../build-tools/src/plugins/swc.ts
|
|
2175
|
+
var import_core = require("@swc/core");
|
|
2176
|
+
|
|
2177
|
+
// ../build-tools/src/plugins/ts-resolve.ts
|
|
2178
|
+
var import_node_fs4 = __toESM(require("fs"));
|
|
2179
|
+
var import_node_module = require("module");
|
|
2180
|
+
var import_node_path3 = __toESM(require("path"));
|
|
2181
|
+
var import_resolve = __toESM(require("resolve"));
|
|
2182
|
+
|
|
2183
|
+
// ../build-tools/src/plugins/type-definitions.ts
|
|
2184
|
+
var import_devkit = require("@nx/devkit");
|
|
2185
|
+
var import_path = require("path");
|
|
2186
|
+
|
|
2187
|
+
// ../build-tools/src/utilities/copy-assets.ts
|
|
2188
|
+
var import_copy_assets_handler = require("@nx/js/src/utils/assets/copy-assets-handler");
|
|
2189
|
+
var import_glob = require("glob");
|
|
2190
|
+
var import_promises2 = require("fs/promises");
|
|
2191
|
+
|
|
2192
|
+
// ../build-tools/src/utilities/generate-package-json.ts
|
|
2193
|
+
var import_buildable_libs_utils = require("@nx/js/src/utils/buildable-libs-utils");
|
|
2194
|
+
var import_glob2 = require("glob");
|
|
2195
|
+
var import_node_fs5 = require("fs");
|
|
2196
|
+
var import_promises3 = require("fs/promises");
|
|
2197
|
+
var import_project_graph = require("nx/src/project-graph/project-graph");
|
|
2198
|
+
|
|
2199
|
+
// ../build-tools/src/utilities/get-entry-points.ts
|
|
2200
|
+
var import_glob3 = require("glob");
|
|
2201
|
+
|
|
2202
|
+
// ../build-tools/src/utilities/read-nx-config.ts
|
|
2203
|
+
var import_node_fs6 = require("fs");
|
|
2204
|
+
var import_promises4 = require("fs/promises");
|
|
2205
|
+
|
|
2206
|
+
// ../build-tools/src/utilities/task-graph.ts
|
|
2207
|
+
var import_create_task_graph = require("nx/src/tasks-runner/create-task-graph");
|
|
7
2208
|
|
|
8
2209
|
// src/cli/index.ts
|
|
9
|
-
var import_config_tools2 = require("@storm-software/config-tools");
|
|
10
2210
|
var import_commander = require("commander");
|
|
11
2211
|
|
|
2212
|
+
// ../npm-tools/src/constants.ts
|
|
2213
|
+
var LATEST_NPM_TAG = "latest";
|
|
2214
|
+
var DEFAULT_NPM_TAG = LATEST_NPM_TAG;
|
|
2215
|
+
|
|
2216
|
+
// ../npm-tools/src/helpers/get-version.ts
|
|
2217
|
+
var import_node_child_process3 = require("child_process");
|
|
2218
|
+
|
|
2219
|
+
// ../npm-tools/src/helpers/get-registry.ts
|
|
2220
|
+
var import_node_child_process2 = require("child_process");
|
|
2221
|
+
async function getRegistry(executable = "npm") {
|
|
2222
|
+
return new Promise((resolve, reject) => {
|
|
2223
|
+
(0, import_node_child_process2.exec)(`${executable} config get registry`, (error, stdout, stderr) => {
|
|
2224
|
+
if (error && !error.message.toLowerCase().trim().startsWith("npm warn")) {
|
|
2225
|
+
return reject(error);
|
|
2226
|
+
}
|
|
2227
|
+
if (stderr && !stderr.toLowerCase().trim().startsWith("npm warn")) {
|
|
2228
|
+
return reject(stderr);
|
|
2229
|
+
}
|
|
2230
|
+
return resolve(stdout.trim());
|
|
2231
|
+
});
|
|
2232
|
+
});
|
|
2233
|
+
}
|
|
2234
|
+
|
|
2235
|
+
// ../npm-tools/src/helpers/get-version.ts
|
|
2236
|
+
async function getVersion(packageName, tag = DEFAULT_NPM_TAG, options = {}) {
|
|
2237
|
+
const executable = options.executable || "npm";
|
|
2238
|
+
const registry2 = options.registry || await getRegistry(executable);
|
|
2239
|
+
return new Promise((resolve, reject) => {
|
|
2240
|
+
(0, import_node_child_process3.exec)(
|
|
2241
|
+
`${executable} view ${packageName} version --registry=${registry2} --tag=${tag}`,
|
|
2242
|
+
(error, stdout, stderr) => {
|
|
2243
|
+
if (error && !error.message.toLowerCase().trim().startsWith("npm warn")) {
|
|
2244
|
+
return reject(error);
|
|
2245
|
+
}
|
|
2246
|
+
if (stderr && !stderr.toLowerCase().trim().startsWith("npm warn")) {
|
|
2247
|
+
return reject(stderr);
|
|
2248
|
+
}
|
|
2249
|
+
return resolve(stdout.trim());
|
|
2250
|
+
}
|
|
2251
|
+
);
|
|
2252
|
+
});
|
|
2253
|
+
}
|
|
2254
|
+
|
|
12
2255
|
// src/helpers/catalog.ts
|
|
13
|
-
var import_get_config = require("@storm-software/config-tools/get-config");
|
|
14
|
-
var import_console = require("@storm-software/config-tools/logger/console");
|
|
15
|
-
var import_find_workspace_root2 = require("@storm-software/config-tools/utilities/find-workspace-root");
|
|
16
|
-
var import_constants = require("@storm-software/npm-tools/constants");
|
|
17
|
-
var import_get_version = require("@storm-software/npm-tools/helpers/get-version");
|
|
18
2256
|
var import_semver = require("semver");
|
|
19
2257
|
|
|
20
2258
|
// src/helpers/pnpm-workspace.ts
|
|
21
|
-
var
|
|
22
|
-
var
|
|
23
|
-
var import_find_workspace_root = require("@storm-software/config-tools/utilities/find-workspace-root");
|
|
24
|
-
var import_node_fs = require("fs");
|
|
25
|
-
var import_promises = require("fs/promises");
|
|
2259
|
+
var import_node_fs7 = require("fs");
|
|
2260
|
+
var import_promises5 = require("fs/promises");
|
|
26
2261
|
var import_yaml = require("yaml");
|
|
27
|
-
function getPnpmWorkspaceFilePath(workspaceRoot =
|
|
28
|
-
const pnpmWorkspacePath =
|
|
29
|
-
if (!(0,
|
|
2262
|
+
function getPnpmWorkspaceFilePath(workspaceRoot = findWorkspaceRoot(process.cwd())) {
|
|
2263
|
+
const pnpmWorkspacePath = joinPaths(workspaceRoot, "pnpm-workspace.yaml");
|
|
2264
|
+
if (!(0, import_node_fs7.existsSync)(pnpmWorkspacePath)) {
|
|
30
2265
|
throw new Error(
|
|
31
2266
|
`No \`pnpm-workspace.yaml\` file found in workspace root (searched in: ${pnpmWorkspacePath}).`
|
|
32
2267
|
);
|
|
33
2268
|
}
|
|
34
2269
|
return pnpmWorkspacePath;
|
|
35
2270
|
}
|
|
36
|
-
async function readPnpmWorkspaceFile(workspaceRoot =
|
|
37
|
-
const result = await (0,
|
|
2271
|
+
async function readPnpmWorkspaceFile(workspaceRoot = findWorkspaceRoot(process.cwd())) {
|
|
2272
|
+
const result = await (0, import_promises5.readFile)(
|
|
38
2273
|
getPnpmWorkspaceFilePath(workspaceRoot),
|
|
39
2274
|
"utf8"
|
|
40
2275
|
);
|
|
@@ -43,18 +2278,18 @@ async function readPnpmWorkspaceFile(workspaceRoot = (0, import_find_workspace_r
|
|
|
43
2278
|
}
|
|
44
2279
|
return (0, import_yaml.parse)(result);
|
|
45
2280
|
}
|
|
46
|
-
async function writePnpmWorkspaceFile(pnpmWorkspaceFile, workspaceRoot =
|
|
47
|
-
const config = await
|
|
2281
|
+
async function writePnpmWorkspaceFile(pnpmWorkspaceFile, workspaceRoot = findWorkspaceRoot(process.cwd())) {
|
|
2282
|
+
const config = await getWorkspaceConfig();
|
|
48
2283
|
const stringified = (0, import_yaml.stringify)(pnpmWorkspaceFile);
|
|
49
|
-
|
|
2284
|
+
writeTrace(
|
|
50
2285
|
`Writing updated pnpm-workspace.yaml file to workspace root: ${stringified}`,
|
|
51
2286
|
config
|
|
52
2287
|
);
|
|
53
|
-
await (0,
|
|
2288
|
+
await (0, import_promises5.writeFile)(getPnpmWorkspaceFilePath(workspaceRoot), stringified);
|
|
54
2289
|
}
|
|
55
2290
|
|
|
56
2291
|
// src/helpers/catalog.ts
|
|
57
|
-
async function getCatalogSafe(workspaceRoot =
|
|
2292
|
+
async function getCatalogSafe(workspaceRoot = findWorkspaceRoot(process.cwd())) {
|
|
58
2293
|
const pnpmWorkspaceFile = await readPnpmWorkspaceFile(workspaceRoot);
|
|
59
2294
|
if (!pnpmWorkspaceFile) {
|
|
60
2295
|
throw new Error("No pnpm-workspace.yaml file found");
|
|
@@ -77,14 +2312,14 @@ File content: ${JSON.stringify(
|
|
|
77
2312
|
}
|
|
78
2313
|
return void 0;
|
|
79
2314
|
}
|
|
80
|
-
async function getCatalog(workspaceRoot =
|
|
2315
|
+
async function getCatalog(workspaceRoot = findWorkspaceRoot(process.cwd())) {
|
|
81
2316
|
const catalog = await getCatalogSafe(workspaceRoot);
|
|
82
2317
|
if (!catalog) {
|
|
83
2318
|
throw new Error("No catalog entries found in pnpm-workspace.yaml file");
|
|
84
2319
|
}
|
|
85
2320
|
return catalog;
|
|
86
2321
|
}
|
|
87
|
-
async function setCatalog(catalog, workspaceRoot =
|
|
2322
|
+
async function setCatalog(catalog, workspaceRoot = findWorkspaceRoot(process.cwd())) {
|
|
88
2323
|
const pnpmWorkspaceFile = await readPnpmWorkspaceFile(workspaceRoot);
|
|
89
2324
|
if (!pnpmWorkspaceFile) {
|
|
90
2325
|
throw new Error("No pnpm-workspace.yaml file found");
|
|
@@ -98,16 +2333,16 @@ async function setCatalog(catalog, workspaceRoot = (0, import_find_workspace_roo
|
|
|
98
2333
|
}
|
|
99
2334
|
async function upgradeCatalog(catalog, packageName, options = {}) {
|
|
100
2335
|
const {
|
|
101
|
-
tag =
|
|
2336
|
+
tag = DEFAULT_NPM_TAG,
|
|
102
2337
|
prefix = "^",
|
|
103
|
-
workspaceRoot =
|
|
2338
|
+
workspaceRoot = findWorkspaceRoot()
|
|
104
2339
|
} = options;
|
|
105
|
-
const workspaceConfig = await
|
|
106
|
-
|
|
2340
|
+
const workspaceConfig = await getWorkspaceConfig(true, { workspaceRoot });
|
|
2341
|
+
writeTrace(
|
|
107
2342
|
`Upgrading catalog entry for package "${packageName}" with tag "${tag}"`,
|
|
108
2343
|
workspaceConfig
|
|
109
2344
|
);
|
|
110
|
-
const origVersion = await
|
|
2345
|
+
const origVersion = await getVersion(packageName, tag, {
|
|
111
2346
|
executable: "pnpm"
|
|
112
2347
|
});
|
|
113
2348
|
const version = `${prefix || ""}${origVersion.replace(/^[\^~><=*]+/g, "")}`;
|
|
@@ -115,13 +2350,13 @@ async function upgradeCatalog(catalog, packageName, options = {}) {
|
|
|
115
2350
|
if (!(0, import_semver.valid)((0, import_semver.coerce)(catalog[packageName])) || (0, import_semver.coerce)(catalog[packageName]) && (0, import_semver.coerce)(version) && // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
116
2351
|
(0, import_semver.gt)((0, import_semver.coerce)(version), (0, import_semver.coerce)(catalog[packageName]))) {
|
|
117
2352
|
catalog[packageName] = `${prefix || ""}${version.replace(/^[\^~><=*]+/g, "")}`;
|
|
118
|
-
|
|
2353
|
+
writeDebug(
|
|
119
2354
|
`Writing version ${catalog[packageName]} to catalog for "${packageName}" package`,
|
|
120
2355
|
workspaceConfig
|
|
121
2356
|
);
|
|
122
2357
|
updated = true;
|
|
123
2358
|
} else {
|
|
124
|
-
|
|
2359
|
+
writeDebug(
|
|
125
2360
|
`The current version ${catalog[packageName]} for package "${packageName}" is greater than or equal to the version ${version} fetched from the npm registry with tag "${tag}". No update performed.`,
|
|
126
2361
|
workspaceConfig
|
|
127
2362
|
);
|
|
@@ -133,11 +2368,11 @@ async function upgradeCatalog(catalog, packageName, options = {}) {
|
|
|
133
2368
|
var _config = {};
|
|
134
2369
|
function createProgram(config) {
|
|
135
2370
|
_config = config;
|
|
136
|
-
|
|
137
|
-
`${
|
|
2371
|
+
writeInfo(
|
|
2372
|
+
`${brandIcon(_config)} Running the \`storm-pnpm\` command-line application`,
|
|
138
2373
|
config
|
|
139
2374
|
);
|
|
140
|
-
const root =
|
|
2375
|
+
const root = findWorkspaceRootSafe(_config.workspaceRoot || process.cwd());
|
|
141
2376
|
process.env.STORM_WORKSPACE_ROOT ??= root;
|
|
142
2377
|
process.env.NX_WORKSPACE_ROOT_PATH ??= root;
|
|
143
2378
|
if (root) {
|
|
@@ -146,8 +2381,8 @@ function createProgram(config) {
|
|
|
146
2381
|
const program = new import_commander.Command("storm-pnpm");
|
|
147
2382
|
program.version("1.0.0", "-v --version", "display CLI version");
|
|
148
2383
|
program.command("update").description("Update pnpm catalog dependency package version.").argument(
|
|
149
|
-
"<
|
|
150
|
-
"The package name/pattern to update the version for (e.g., @storm-software/config or @storm-software/
|
|
2384
|
+
"<packages...>",
|
|
2385
|
+
"The package name/pattern to update the version for (e.g., @storm-software/config or @storm-software/ or @storm-software/*)."
|
|
151
2386
|
).option(
|
|
152
2387
|
"-t, --tag <string>",
|
|
153
2388
|
`The npm tag to use when fetching the latest version of the package (e.g., "latest", "next", etc.). Defaults to "latest".`,
|
|
@@ -155,7 +2390,7 @@ function createProgram(config) {
|
|
|
155
2390
|
).option(
|
|
156
2391
|
"-i, --install",
|
|
157
2392
|
"Whether to install the package after updating the version."
|
|
158
|
-
).option(
|
|
2393
|
+
).option("--all", "Whether to update all Storm Software packages.").option(
|
|
159
2394
|
"-p, --prefix <string>",
|
|
160
2395
|
`The version prefix to use when updating the package (e.g., "^", "~", or "1.2.3"). Defaults to "^".
|
|
161
2396
|
- Caret (^): The default prefix. It allows updates to the latest minor or patch version while staying within the same major version. Example: \u201C^1.2.3" allows updates to 1.3.0 or 1.2.4, but not 2.0.0.
|
|
@@ -167,15 +2402,16 @@ function createProgram(config) {
|
|
|
167
2402
|
).action(updateAction);
|
|
168
2403
|
return program;
|
|
169
2404
|
}
|
|
170
|
-
async function updateAction(
|
|
2405
|
+
async function updateAction(packages, {
|
|
171
2406
|
tag,
|
|
172
2407
|
install = false,
|
|
2408
|
+
all = false,
|
|
173
2409
|
prefix = "^"
|
|
174
2410
|
}) {
|
|
175
2411
|
try {
|
|
176
|
-
const
|
|
177
|
-
|
|
178
|
-
`${
|
|
2412
|
+
const pkgs = (Array.isArray(packages) ? packages : [packages.split(",")].flat()).map((pkg) => pkg.trim().replaceAll("*", "")).concat(all ? INTERNAL_PACKAGES : []);
|
|
2413
|
+
writeInfo(
|
|
2414
|
+
`${brandIcon(_config)} Preparing to update the package version for ${pkgs.join(", ")}.`,
|
|
179
2415
|
_config
|
|
180
2416
|
);
|
|
181
2417
|
let catalog = await getCatalog();
|
|
@@ -186,25 +2422,25 @@ async function updateAction(packageNames, {
|
|
|
186
2422
|
}
|
|
187
2423
|
let packagesFound = false;
|
|
188
2424
|
let packagesUpdated = false;
|
|
189
|
-
for (const pkg of
|
|
2425
|
+
for (const pkg of pkgs) {
|
|
190
2426
|
const matchedPackages = Object.keys(catalog).filter(
|
|
191
2427
|
(p) => pkg.endsWith("/") ? p.startsWith(pkg) : p === pkg
|
|
192
2428
|
);
|
|
193
2429
|
if (matchedPackages.length === 0) {
|
|
194
|
-
|
|
2430
|
+
writeInfo(
|
|
195
2431
|
`No packages found in the catalog matching the name/pattern "${pkg}".`,
|
|
196
2432
|
_config
|
|
197
2433
|
);
|
|
198
2434
|
} else {
|
|
199
|
-
|
|
200
|
-
`${
|
|
2435
|
+
writeDebug(
|
|
2436
|
+
`${brandIcon(_config)} Found ${matchedPackages.length} packages matching "${pkg}" in the pnpm catalog file:
|
|
201
2437
|
|
|
202
2438
|
- ${matchedPackages.map((p) => `${p} (${catalog[p] || "unknown"})`).join("\n- ")}`,
|
|
203
2439
|
_config
|
|
204
2440
|
);
|
|
205
2441
|
packagesFound = true;
|
|
206
2442
|
for (const matchedPackage of matchedPackages) {
|
|
207
|
-
|
|
2443
|
+
writeTrace(`- Upgrading ${matchedPackage}...`, _config);
|
|
208
2444
|
const result = await upgradeCatalog(catalog, matchedPackage, {
|
|
209
2445
|
tag,
|
|
210
2446
|
prefix,
|
|
@@ -218,18 +2454,18 @@ async function updateAction(packageNames, {
|
|
|
218
2454
|
}
|
|
219
2455
|
}
|
|
220
2456
|
if (!packagesFound) {
|
|
221
|
-
|
|
2457
|
+
writeWarning(
|
|
222
2458
|
`No packages were updated since no matching packages were found in the catalog.`,
|
|
223
2459
|
_config
|
|
224
2460
|
);
|
|
225
2461
|
return;
|
|
226
2462
|
}
|
|
227
|
-
|
|
2463
|
+
writeDebug(
|
|
228
2464
|
"Finalizing changes to the pnpm workspace's catalog dependencies",
|
|
229
2465
|
_config
|
|
230
2466
|
);
|
|
231
2467
|
if (!packagesUpdated) {
|
|
232
|
-
|
|
2468
|
+
writeDebug(
|
|
233
2469
|
"No packages were updated since all matching packages are already up to date in the catalog.",
|
|
234
2470
|
_config
|
|
235
2471
|
);
|
|
@@ -237,17 +2473,17 @@ async function updateAction(packageNames, {
|
|
|
237
2473
|
}
|
|
238
2474
|
await setCatalog(catalog, _config.workspaceRoot);
|
|
239
2475
|
if (install) {
|
|
240
|
-
|
|
2476
|
+
writeDebug(
|
|
241
2477
|
"Running `pnpm install --no-frozen-lockfile` to update local dependency versions",
|
|
242
2478
|
_config
|
|
243
2479
|
);
|
|
244
|
-
const proc = await
|
|
2480
|
+
const proc = await runAsync(_config, "pnpm install --no-frozen-lockfile");
|
|
245
2481
|
proc.stdout?.on("data", (data) => {
|
|
246
2482
|
console.log(data.toString());
|
|
247
2483
|
});
|
|
248
2484
|
}
|
|
249
2485
|
} catch (error) {
|
|
250
|
-
|
|
2486
|
+
writeFatal(
|
|
251
2487
|
`A fatal error occurred while running Storm pnpm update:
|
|
252
2488
|
|
|
253
2489
|
${JSON.stringify(
|
|
@@ -263,18 +2499,18 @@ ${JSON.stringify(
|
|
|
263
2499
|
|
|
264
2500
|
// bin/pnpm.ts
|
|
265
2501
|
void (async () => {
|
|
266
|
-
const config = await
|
|
2502
|
+
const config = await getWorkspaceConfig();
|
|
267
2503
|
try {
|
|
268
|
-
|
|
2504
|
+
handleProcess(config);
|
|
269
2505
|
const program = createProgram(config);
|
|
270
2506
|
await program.parseAsync(process.argv);
|
|
271
|
-
|
|
2507
|
+
writeSuccess(
|
|
272
2508
|
`\u2714 Storm pnpm ${process.argv && process.argv.length >= 3 && process.argv[2] ? process.argv[2] : "tool"} processing completed successfully!`,
|
|
273
2509
|
config
|
|
274
2510
|
);
|
|
275
|
-
|
|
2511
|
+
exitWithSuccess(config);
|
|
276
2512
|
} catch (error) {
|
|
277
|
-
|
|
2513
|
+
exitWithError(config);
|
|
278
2514
|
process.exit(1);
|
|
279
2515
|
}
|
|
280
2516
|
})();
|