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