@storm-software/git-tools 2.113.15 → 2.113.18
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-TOALWLBQ.js → chunk-54Q5U5WW.js} +2 -8
- package/bin/chunk-AMSZ7DVW.js +17 -0
- package/bin/chunk-CIJVSMK2.cjs +23 -0
- package/bin/chunk-DDGJVTT5.cjs +1622 -0
- package/bin/chunk-NRQQ6RND.js +1581 -0
- package/bin/{chunk-TDO6B2H4.js → chunk-SWXHQXUT.cjs} +3 -8
- package/bin/git.cjs +3013 -81697
- package/bin/git.js +2825 -91795
- package/bin/post-checkout.cjs +16 -36
- package/bin/post-checkout.js +3 -25
- package/bin/post-commit.cjs +16 -36
- package/bin/post-commit.js +3 -25
- package/bin/post-merge.cjs +16 -36
- package/bin/post-merge.js +3 -25
- package/bin/pre-commit.cjs +13 -32
- package/bin/pre-commit.js +2 -23
- package/bin/pre-install.cjs +12 -29
- package/bin/pre-install.js +2 -21
- package/bin/pre-push.cjs +33 -50
- package/bin/pre-push.js +6 -30
- package/bin/prepare.cjs +10 -27
- package/bin/prepare.js +2 -21
- package/bin/version-warning.cjs +8 -23
- package/bin/version-warning.js +2 -19
- package/package.json +15 -32
- package/bin/chunk-2EJN2ZIP.cjs +0 -3631
- package/bin/chunk-2FWQQ2X4.js +0 -35624
- package/bin/chunk-335YPSVH.cjs +0 -111
- package/bin/chunk-5OLGPOTK.js +0 -1003
- package/bin/chunk-5QFXXGFE.js +0 -7427
- package/bin/chunk-D2AN4H4B.js +0 -111
- package/bin/chunk-DTYNP6HG.js +0 -3634
- package/bin/chunk-FMYKTN2Z.cjs +0 -7427
- package/bin/chunk-GSZ2Y7H4.cjs +0 -1003
- package/bin/chunk-GWDOCACN.cjs +0 -27
- package/bin/chunk-H4MEIOPL.cjs +0 -476
- package/bin/chunk-HTVOKCRJ.cjs +0 -25
- package/bin/chunk-IG6EXAQU.cjs +0 -59
- package/bin/chunk-JHBHEVIE.js +0 -55
- package/bin/chunk-MXO7CLUN.cjs +0 -739
- package/bin/chunk-OKG5KNKQ.js +0 -419
- package/bin/chunk-QWTKUQL3.js +0 -739
- package/bin/chunk-R7ZVOQ5D.js +0 -476
- package/bin/chunk-TVPM4C6Y.cjs +0 -419
- package/bin/chunk-UQFYXF6V.cjs +0 -74
- package/bin/chunk-VU7MBHMN.js +0 -74
- package/bin/chunk-WOADGD4X.cjs +0 -35563
- package/bin/dist-GTHSKIW6.cjs +0 -16571
- package/bin/dist-JFDTSOSQ.js +0 -33
- package/bin/dist-JIPEOSES.js +0 -16736
- package/bin/dist-S2SQNR26.cjs +0 -33
- package/bin/esm-MJTK2O7U.js +0 -1708
- package/bin/esm-NOFJXYSW.cjs +0 -1708
- package/bin/json5-PMDKQHWU.js +0 -10
- package/bin/json5-XWK64HEF.cjs +0 -10
- package/bin/jsonc-GWY6R4PV.js +0 -15
- package/bin/jsonc-SBYIKOG2.cjs +0 -15
- package/bin/multipart-parser-HT3QRMAQ.cjs +0 -181
- package/bin/multipart-parser-LDIDKHXR.js +0 -185
- package/bin/toml-CWI7LORJ.cjs +0 -10
- package/bin/toml-KVVESQIU.js +0 -10
- package/bin/utils-EKXINDVD.js +0 -101
- package/bin/utils-P2DNOMLG.cjs +0 -101
- package/bin/yaml-WPTJ2ZU5.cjs +0 -10
- package/bin/yaml-XEVR3LQS.js +0 -10
|
@@ -0,0 +1,1622 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var z = require('zod');
|
|
4
|
+
var fs = require('fs');
|
|
5
|
+
var promises = require('fs/promises');
|
|
6
|
+
var path = require('path');
|
|
7
|
+
var chalk = require('chalk');
|
|
8
|
+
var c12 = require('c12');
|
|
9
|
+
|
|
10
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
+
|
|
12
|
+
function _interopNamespace(e) {
|
|
13
|
+
if (e && e.__esModule) return e;
|
|
14
|
+
var n = Object.create(null);
|
|
15
|
+
if (e) {
|
|
16
|
+
Object.keys(e).forEach(function (k) {
|
|
17
|
+
if (k !== 'default') {
|
|
18
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
19
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
get: function () { return e[k]; }
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
n.default = e;
|
|
27
|
+
return Object.freeze(n);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
var z__namespace = /*#__PURE__*/_interopNamespace(z);
|
|
31
|
+
var chalk__default = /*#__PURE__*/_interopDefault(chalk);
|
|
32
|
+
|
|
33
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
34
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
35
|
+
}) : x)(function(x) {
|
|
36
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
37
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
// ../config-tools/src/types.ts
|
|
41
|
+
var LogLevel = {
|
|
42
|
+
SILENT: 0,
|
|
43
|
+
FATAL: 10,
|
|
44
|
+
ERROR: 20,
|
|
45
|
+
WARN: 30,
|
|
46
|
+
SUCCESS: 35,
|
|
47
|
+
INFO: 40,
|
|
48
|
+
DEBUG: 60,
|
|
49
|
+
TRACE: 70,
|
|
50
|
+
ALL: 100
|
|
51
|
+
};
|
|
52
|
+
var LogLevelLabel = {
|
|
53
|
+
SILENT: "silent",
|
|
54
|
+
FATAL: "fatal",
|
|
55
|
+
ERROR: "error",
|
|
56
|
+
WARN: "warn",
|
|
57
|
+
SUCCESS: "success",
|
|
58
|
+
INFO: "info",
|
|
59
|
+
DEBUG: "debug",
|
|
60
|
+
TRACE: "trace",
|
|
61
|
+
ALL: "all"
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
// ../config/src/constants.ts
|
|
65
|
+
var STORM_DEFAULT_DOCS = "https://docs.stormsoftware.com";
|
|
66
|
+
var STORM_DEFAULT_HOMEPAGE = "https://stormsoftware.com";
|
|
67
|
+
var STORM_DEFAULT_LICENSING = "https://stormsoftware.com/license";
|
|
68
|
+
var STORM_DEFAULT_LICENSE = "Apache-2.0";
|
|
69
|
+
var STORM_DEFAULT_SOCIAL_TWITTER = "StormSoftwareHQ";
|
|
70
|
+
var STORM_DEFAULT_SOCIAL_DISCORD = "https://discord.gg/MQ6YVzakM5";
|
|
71
|
+
var STORM_DEFAULT_SOCIAL_TELEGRAM = "https://t.me/storm_software";
|
|
72
|
+
var STORM_DEFAULT_SOCIAL_SLACK = "https://join.slack.com/t/storm-software/shared_invite/zt-2gsmk04hs-i6yhK_r6urq0dkZYAwq2pA";
|
|
73
|
+
var STORM_DEFAULT_SOCIAL_MEDIUM = "https://medium.com/storm-software";
|
|
74
|
+
var STORM_DEFAULT_SOCIAL_GITHUB = "https://github.com/storm-software";
|
|
75
|
+
var STORM_DEFAULT_ERROR_CODES_FILE = "tools/errors/codes.json";
|
|
76
|
+
var DarkColorSchema = z__namespace.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#1d1e22").describe("The dark background color of the workspace");
|
|
77
|
+
var LightColorSchema = z__namespace.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#f4f4f5").describe("The light background color of the workspace");
|
|
78
|
+
var BrandColorSchema = z__namespace.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#1fb2a6").describe("The primary brand specific color of the workspace");
|
|
79
|
+
var AlternateColorSchema = z__namespace.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).optional().describe("The alternate brand specific color of the workspace");
|
|
80
|
+
var AccentColorSchema = z__namespace.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).optional().describe("The secondary brand specific color of the workspace");
|
|
81
|
+
var LinkColorSchema = z__namespace.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).optional().describe("The color used to display hyperlink text");
|
|
82
|
+
var HelpColorSchema = z__namespace.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#8256D0").describe("The second brand specific color of the workspace");
|
|
83
|
+
var SuccessColorSchema = z__namespace.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#12B66A").describe("The success color of the workspace");
|
|
84
|
+
var InfoColorSchema = z__namespace.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#0070E0").describe("The informational color of the workspace");
|
|
85
|
+
var WarningColorSchema = z__namespace.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#fcc419").describe("The warning color of the workspace");
|
|
86
|
+
var DangerColorSchema = z__namespace.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#D8314A").describe("The danger color of the workspace");
|
|
87
|
+
var FatalColorSchema = z__namespace.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).optional().describe("The fatal color of the workspace");
|
|
88
|
+
var PositiveColorSchema = z__namespace.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#4ade80").describe("The positive number color of the workspace");
|
|
89
|
+
var NegativeColorSchema = z__namespace.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#ef4444").describe("The negative number color of the workspace");
|
|
90
|
+
var DarkThemeColorConfigSchema = z__namespace.object({
|
|
91
|
+
foreground: LightColorSchema,
|
|
92
|
+
background: DarkColorSchema,
|
|
93
|
+
brand: BrandColorSchema,
|
|
94
|
+
alternate: AlternateColorSchema,
|
|
95
|
+
accent: AccentColorSchema,
|
|
96
|
+
link: LinkColorSchema,
|
|
97
|
+
help: HelpColorSchema,
|
|
98
|
+
success: SuccessColorSchema,
|
|
99
|
+
info: InfoColorSchema,
|
|
100
|
+
warning: WarningColorSchema,
|
|
101
|
+
danger: DangerColorSchema,
|
|
102
|
+
fatal: FatalColorSchema,
|
|
103
|
+
positive: PositiveColorSchema,
|
|
104
|
+
negative: NegativeColorSchema
|
|
105
|
+
});
|
|
106
|
+
var LightThemeColorConfigSchema = z__namespace.object({
|
|
107
|
+
foreground: DarkColorSchema,
|
|
108
|
+
background: LightColorSchema,
|
|
109
|
+
brand: BrandColorSchema,
|
|
110
|
+
alternate: AlternateColorSchema,
|
|
111
|
+
accent: AccentColorSchema,
|
|
112
|
+
link: LinkColorSchema,
|
|
113
|
+
help: HelpColorSchema,
|
|
114
|
+
success: SuccessColorSchema,
|
|
115
|
+
info: InfoColorSchema,
|
|
116
|
+
warning: WarningColorSchema,
|
|
117
|
+
danger: DangerColorSchema,
|
|
118
|
+
fatal: FatalColorSchema,
|
|
119
|
+
positive: PositiveColorSchema,
|
|
120
|
+
negative: NegativeColorSchema
|
|
121
|
+
});
|
|
122
|
+
var MultiThemeColorConfigSchema = z__namespace.object({
|
|
123
|
+
dark: DarkThemeColorConfigSchema,
|
|
124
|
+
light: LightThemeColorConfigSchema
|
|
125
|
+
});
|
|
126
|
+
var SingleThemeColorConfigSchema = z__namespace.object({
|
|
127
|
+
dark: DarkColorSchema,
|
|
128
|
+
light: LightColorSchema,
|
|
129
|
+
brand: BrandColorSchema,
|
|
130
|
+
alternate: AlternateColorSchema,
|
|
131
|
+
accent: AccentColorSchema,
|
|
132
|
+
link: LinkColorSchema,
|
|
133
|
+
help: HelpColorSchema,
|
|
134
|
+
success: SuccessColorSchema,
|
|
135
|
+
info: InfoColorSchema,
|
|
136
|
+
warning: WarningColorSchema,
|
|
137
|
+
danger: DangerColorSchema,
|
|
138
|
+
fatal: FatalColorSchema,
|
|
139
|
+
positive: PositiveColorSchema,
|
|
140
|
+
negative: NegativeColorSchema
|
|
141
|
+
});
|
|
142
|
+
var RegistryUrlConfigSchema = z__namespace.url().optional().describe("A remote registry URL used to publish distributable packages");
|
|
143
|
+
var RegistryConfigSchema = z__namespace.object({
|
|
144
|
+
github: RegistryUrlConfigSchema,
|
|
145
|
+
npm: RegistryUrlConfigSchema,
|
|
146
|
+
cargo: RegistryUrlConfigSchema,
|
|
147
|
+
cyclone: RegistryUrlConfigSchema,
|
|
148
|
+
container: RegistryUrlConfigSchema
|
|
149
|
+
}).default({}).describe("A list of remote registry URLs used by Storm Software");
|
|
150
|
+
var ColorConfigSchema = SingleThemeColorConfigSchema.or(
|
|
151
|
+
MultiThemeColorConfigSchema
|
|
152
|
+
).describe("Colors used for various workspace elements");
|
|
153
|
+
var ColorConfigMapSchema = z__namespace.record(
|
|
154
|
+
z__namespace.union([z__namespace.literal("base"), z__namespace.string()]),
|
|
155
|
+
ColorConfigSchema
|
|
156
|
+
);
|
|
157
|
+
var ExtendsItemSchema = z__namespace.string().trim().describe(
|
|
158
|
+
"The path to a base config file to use as a configuration preset file. Documentation can be found at https://github.com/unjs/c12#extending-configuration."
|
|
159
|
+
);
|
|
160
|
+
var ExtendsSchema = ExtendsItemSchema.or(
|
|
161
|
+
z__namespace.array(ExtendsItemSchema)
|
|
162
|
+
).describe(
|
|
163
|
+
"The path to a base config file to use as a configuration preset file. Documentation can be found at https://github.com/unjs/c12#extending-configuration."
|
|
164
|
+
);
|
|
165
|
+
var WorkspaceBotConfigSchema = z__namespace.object({
|
|
166
|
+
name: z__namespace.string().trim().default("stormie-bot").describe(
|
|
167
|
+
"The workspace bot user's name (this is the bot that will be used to perform various tasks)"
|
|
168
|
+
),
|
|
169
|
+
email: z__namespace.email().default("bot@stormsoftware.com").describe("The email of the workspace bot")
|
|
170
|
+
}).describe(
|
|
171
|
+
"The workspace's bot user's config used to automated various operations tasks"
|
|
172
|
+
);
|
|
173
|
+
var WorkspaceReleaseConfigSchema = z__namespace.object({
|
|
174
|
+
banner: z__namespace.string().trim().optional().describe(
|
|
175
|
+
"A URL to a banner image used to display the workspace's release"
|
|
176
|
+
),
|
|
177
|
+
header: z__namespace.string().trim().optional().describe(
|
|
178
|
+
"A header message appended to the start of the workspace's release notes"
|
|
179
|
+
),
|
|
180
|
+
footer: z__namespace.string().trim().optional().describe(
|
|
181
|
+
"A footer message appended to the end of the workspace's release notes"
|
|
182
|
+
)
|
|
183
|
+
}).describe("The workspace's release config used during the release process");
|
|
184
|
+
var WorkspaceSocialsConfigSchema = z__namespace.object({
|
|
185
|
+
twitter: z__namespace.string().trim().default(STORM_DEFAULT_SOCIAL_TWITTER).describe("A Twitter/X account associated with the organization/project"),
|
|
186
|
+
discord: z__namespace.string().trim().default(STORM_DEFAULT_SOCIAL_DISCORD).describe("A Discord account associated with the organization/project"),
|
|
187
|
+
telegram: z__namespace.string().trim().default(STORM_DEFAULT_SOCIAL_TELEGRAM).describe("A Telegram account associated with the organization/project"),
|
|
188
|
+
slack: z__namespace.string().trim().default(STORM_DEFAULT_SOCIAL_SLACK).describe("A Slack account associated with the organization/project"),
|
|
189
|
+
medium: z__namespace.string().trim().default(STORM_DEFAULT_SOCIAL_MEDIUM).describe("A Medium account associated with the organization/project"),
|
|
190
|
+
github: z__namespace.string().trim().default(STORM_DEFAULT_SOCIAL_GITHUB).describe("A GitHub account associated with the organization/project")
|
|
191
|
+
}).describe(
|
|
192
|
+
"The workspace's account config used to store various social media links"
|
|
193
|
+
);
|
|
194
|
+
var WorkspaceDirectoryConfigSchema = z__namespace.object({
|
|
195
|
+
cache: z__namespace.string().trim().optional().describe(
|
|
196
|
+
"The directory used to store the environment's cached file data"
|
|
197
|
+
),
|
|
198
|
+
data: z__namespace.string().trim().optional().describe("The directory used to store the environment's data files"),
|
|
199
|
+
config: z__namespace.string().trim().optional().describe(
|
|
200
|
+
"The directory used to store the environment's configuration files"
|
|
201
|
+
),
|
|
202
|
+
temp: z__namespace.string().trim().optional().describe("The directory used to store the environment's temp files"),
|
|
203
|
+
log: z__namespace.string().trim().optional().describe("The directory used to store the environment's temp files"),
|
|
204
|
+
build: z__namespace.string().trim().default("dist").describe(
|
|
205
|
+
"The directory used to store the workspace's distributable files after a build (relative to the workspace root)"
|
|
206
|
+
)
|
|
207
|
+
}).describe(
|
|
208
|
+
"Various directories used by the workspace to store data, cache, and configuration files"
|
|
209
|
+
);
|
|
210
|
+
var errorConfigSchema = z__namespace.object({
|
|
211
|
+
codesFile: z__namespace.string().trim().default(STORM_DEFAULT_ERROR_CODES_FILE).describe("The path to the workspace's error codes JSON file"),
|
|
212
|
+
url: z__namespace.url().optional().describe(
|
|
213
|
+
"A URL to a page that looks up the workspace's error messages given a specific error code"
|
|
214
|
+
)
|
|
215
|
+
}).describe("The workspace's error config used during the error process");
|
|
216
|
+
var organizationConfigSchema = z__namespace.object({
|
|
217
|
+
name: z__namespace.string().trim().describe("The name of the organization"),
|
|
218
|
+
description: z__namespace.string().trim().optional().describe("A description of the organization"),
|
|
219
|
+
logo: z__namespace.url().optional().describe("A URL to the organization's logo image"),
|
|
220
|
+
icon: z__namespace.url().optional().describe("A URL to the organization's icon image"),
|
|
221
|
+
url: z__namespace.url().optional().describe(
|
|
222
|
+
"A URL to a page that provides more information about the organization"
|
|
223
|
+
)
|
|
224
|
+
}).describe("The workspace's organization details");
|
|
225
|
+
var stormWorkspaceConfigSchema = z__namespace.object({
|
|
226
|
+
$schema: z__namespace.string().trim().default(
|
|
227
|
+
"https://public.storm-cdn.com/schemas/storm-workspace.schema.json"
|
|
228
|
+
).describe(
|
|
229
|
+
"The URL or file path to the JSON schema file that describes the Storm configuration file"
|
|
230
|
+
),
|
|
231
|
+
extends: ExtendsSchema.optional(),
|
|
232
|
+
name: z__namespace.string().trim().toLowerCase().optional().describe(
|
|
233
|
+
"The name of the service/package/scope using this configuration"
|
|
234
|
+
),
|
|
235
|
+
namespace: z__namespace.string().trim().toLowerCase().optional().describe("The namespace of the package"),
|
|
236
|
+
organization: organizationConfigSchema.or(z__namespace.string().trim().describe("The organization of the workspace")).optional().describe(
|
|
237
|
+
"The organization of the workspace. This can be a string or an object containing the organization's details"
|
|
238
|
+
),
|
|
239
|
+
repository: z__namespace.string().trim().optional().describe("The repo URL of the workspace (i.e. GitHub)"),
|
|
240
|
+
license: z__namespace.string().trim().default("Apache-2.0").describe("The license type of the package"),
|
|
241
|
+
homepage: z__namespace.url().optional().describe("The homepage of the workspace"),
|
|
242
|
+
docs: z__namespace.url().optional().describe("The documentation site for the workspace"),
|
|
243
|
+
portal: z__namespace.url().optional().describe("The development portal site for the workspace"),
|
|
244
|
+
licensing: z__namespace.url().optional().describe("The licensing site for the workspace"),
|
|
245
|
+
contact: z__namespace.url().optional().describe("The contact site for the workspace"),
|
|
246
|
+
support: z__namespace.url().optional().describe(
|
|
247
|
+
"The support site for the workspace. If not provided, this is defaulted to the `contact` config value"
|
|
248
|
+
),
|
|
249
|
+
branch: z__namespace.string().trim().default("main").describe("The branch of the workspace"),
|
|
250
|
+
preid: z__namespace.string().optional().describe("A tag specifying the version pre-release identifier"),
|
|
251
|
+
owner: z__namespace.string().trim().default("@storm-software/admin").describe("The owner of the package"),
|
|
252
|
+
bot: WorkspaceBotConfigSchema,
|
|
253
|
+
release: WorkspaceReleaseConfigSchema,
|
|
254
|
+
socials: WorkspaceSocialsConfigSchema,
|
|
255
|
+
error: errorConfigSchema,
|
|
256
|
+
mode: z__namespace.string().trim().default("production").describe("The current runtime environment mode for the package"),
|
|
257
|
+
workspaceRoot: z__namespace.string().trim().describe("The root directory of the workspace"),
|
|
258
|
+
skipCache: z__namespace.boolean().default(false).describe("Should all known types of workspace caching be skipped?"),
|
|
259
|
+
directories: WorkspaceDirectoryConfigSchema,
|
|
260
|
+
packageManager: z__namespace.enum(["npm", "yarn", "pnpm", "bun"]).default("npm").describe(
|
|
261
|
+
"The JavaScript/TypeScript package manager used by the repository"
|
|
262
|
+
),
|
|
263
|
+
timezone: z__namespace.string().trim().default("America/New_York").describe("The default timezone of the workspace"),
|
|
264
|
+
locale: z__namespace.string().trim().default("en-US").describe("The default locale of the workspace"),
|
|
265
|
+
logLevel: z__namespace.enum([
|
|
266
|
+
"silent",
|
|
267
|
+
"fatal",
|
|
268
|
+
"error",
|
|
269
|
+
"warn",
|
|
270
|
+
"success",
|
|
271
|
+
"info",
|
|
272
|
+
"debug",
|
|
273
|
+
"trace",
|
|
274
|
+
"all"
|
|
275
|
+
]).default("info").describe(
|
|
276
|
+
"The log level used to filter out lower priority log messages. If not provided, this is defaulted using the `environment` config value (if `environment` is set to `production` then `level` is `error`, else `level` is `debug`)."
|
|
277
|
+
),
|
|
278
|
+
skipConfigLogging: z__namespace.boolean().optional().describe(
|
|
279
|
+
"Should the logging of the current Storm Workspace configuration be skipped?"
|
|
280
|
+
),
|
|
281
|
+
registry: RegistryConfigSchema,
|
|
282
|
+
configFile: z__namespace.string().trim().nullable().default(null).describe(
|
|
283
|
+
"The filepath of the Storm config. When this field is null, no config file was found in the current workspace."
|
|
284
|
+
),
|
|
285
|
+
colors: ColorConfigSchema.or(ColorConfigMapSchema).describe(
|
|
286
|
+
"Storm theme config values used for styling various package elements"
|
|
287
|
+
),
|
|
288
|
+
extensions: z__namespace.record(z__namespace.string(), z__namespace.any()).optional().default({}).describe("Configuration of each used extension")
|
|
289
|
+
}).describe(
|
|
290
|
+
"Storm Workspace config values used during various dev-ops processes. This type is a combination of the StormPackageConfig and StormProject types. It represents the config of the entire monorepo."
|
|
291
|
+
);
|
|
292
|
+
|
|
293
|
+
// ../config/src/types.ts
|
|
294
|
+
var COLOR_KEYS = [
|
|
295
|
+
"dark",
|
|
296
|
+
"light",
|
|
297
|
+
"base",
|
|
298
|
+
"brand",
|
|
299
|
+
"alternate",
|
|
300
|
+
"accent",
|
|
301
|
+
"link",
|
|
302
|
+
"success",
|
|
303
|
+
"help",
|
|
304
|
+
"info",
|
|
305
|
+
"warning",
|
|
306
|
+
"danger",
|
|
307
|
+
"fatal",
|
|
308
|
+
"positive",
|
|
309
|
+
"negative"
|
|
310
|
+
];
|
|
311
|
+
|
|
312
|
+
// ../config-tools/src/utilities/correct-paths.ts
|
|
313
|
+
var _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
|
|
314
|
+
function normalizeWindowsPath(input = "") {
|
|
315
|
+
if (!input) {
|
|
316
|
+
return input;
|
|
317
|
+
}
|
|
318
|
+
return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
|
|
319
|
+
}
|
|
320
|
+
var _UNC_REGEX = /^[/\\]{2}/;
|
|
321
|
+
var _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
|
|
322
|
+
var _DRIVE_LETTER_RE = /^[A-Za-z]:$/;
|
|
323
|
+
var correctPaths = function(path) {
|
|
324
|
+
if (!path || path.length === 0) {
|
|
325
|
+
return ".";
|
|
326
|
+
}
|
|
327
|
+
path = normalizeWindowsPath(path);
|
|
328
|
+
const isUNCPath = path.match(_UNC_REGEX);
|
|
329
|
+
const isPathAbsolute = isAbsolute(path);
|
|
330
|
+
const trailingSeparator = path[path.length - 1] === "/";
|
|
331
|
+
path = normalizeString(path, !isPathAbsolute);
|
|
332
|
+
if (path.length === 0) {
|
|
333
|
+
if (isPathAbsolute) {
|
|
334
|
+
return "/";
|
|
335
|
+
}
|
|
336
|
+
return trailingSeparator ? "./" : ".";
|
|
337
|
+
}
|
|
338
|
+
if (trailingSeparator) {
|
|
339
|
+
path += "/";
|
|
340
|
+
}
|
|
341
|
+
if (_DRIVE_LETTER_RE.test(path)) {
|
|
342
|
+
path += "/";
|
|
343
|
+
}
|
|
344
|
+
if (isUNCPath) {
|
|
345
|
+
if (!isPathAbsolute) {
|
|
346
|
+
return `//./${path}`;
|
|
347
|
+
}
|
|
348
|
+
return `//${path}`;
|
|
349
|
+
}
|
|
350
|
+
return isPathAbsolute && !isAbsolute(path) ? `/${path}` : path;
|
|
351
|
+
};
|
|
352
|
+
var joinPaths = function(...segments) {
|
|
353
|
+
let path = "";
|
|
354
|
+
for (const seg of segments) {
|
|
355
|
+
if (!seg) {
|
|
356
|
+
continue;
|
|
357
|
+
}
|
|
358
|
+
if (path.length > 0) {
|
|
359
|
+
const pathTrailing = path[path.length - 1] === "/";
|
|
360
|
+
const segLeading = seg[0] === "/";
|
|
361
|
+
const both = pathTrailing && segLeading;
|
|
362
|
+
if (both) {
|
|
363
|
+
path += seg.slice(1);
|
|
364
|
+
} else {
|
|
365
|
+
path += pathTrailing || segLeading ? seg : `/${seg}`;
|
|
366
|
+
}
|
|
367
|
+
} else {
|
|
368
|
+
path += seg;
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
return correctPaths(path);
|
|
372
|
+
};
|
|
373
|
+
function normalizeString(path, allowAboveRoot) {
|
|
374
|
+
let res = "";
|
|
375
|
+
let lastSegmentLength = 0;
|
|
376
|
+
let lastSlash = -1;
|
|
377
|
+
let dots = 0;
|
|
378
|
+
let char = null;
|
|
379
|
+
for (let index = 0; index <= path.length; ++index) {
|
|
380
|
+
if (index < path.length) {
|
|
381
|
+
char = path[index];
|
|
382
|
+
} else if (char === "/") {
|
|
383
|
+
break;
|
|
384
|
+
} else {
|
|
385
|
+
char = "/";
|
|
386
|
+
}
|
|
387
|
+
if (char === "/") {
|
|
388
|
+
if (lastSlash === index - 1 || dots === 1) ; else if (dots === 2) {
|
|
389
|
+
if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
|
|
390
|
+
if (res.length > 2) {
|
|
391
|
+
const lastSlashIndex = res.lastIndexOf("/");
|
|
392
|
+
if (lastSlashIndex === -1) {
|
|
393
|
+
res = "";
|
|
394
|
+
lastSegmentLength = 0;
|
|
395
|
+
} else {
|
|
396
|
+
res = res.slice(0, lastSlashIndex);
|
|
397
|
+
lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
|
|
398
|
+
}
|
|
399
|
+
lastSlash = index;
|
|
400
|
+
dots = 0;
|
|
401
|
+
continue;
|
|
402
|
+
} else if (res.length > 0) {
|
|
403
|
+
res = "";
|
|
404
|
+
lastSegmentLength = 0;
|
|
405
|
+
lastSlash = index;
|
|
406
|
+
dots = 0;
|
|
407
|
+
continue;
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
if (allowAboveRoot) {
|
|
411
|
+
res += res.length > 0 ? "/.." : "..";
|
|
412
|
+
lastSegmentLength = 2;
|
|
413
|
+
}
|
|
414
|
+
} else {
|
|
415
|
+
if (res.length > 0) {
|
|
416
|
+
res += `/${path.slice(lastSlash + 1, index)}`;
|
|
417
|
+
} else {
|
|
418
|
+
res = path.slice(lastSlash + 1, index);
|
|
419
|
+
}
|
|
420
|
+
lastSegmentLength = index - lastSlash - 1;
|
|
421
|
+
}
|
|
422
|
+
lastSlash = index;
|
|
423
|
+
dots = 0;
|
|
424
|
+
} else if (char === "." && dots !== -1) {
|
|
425
|
+
++dots;
|
|
426
|
+
} else {
|
|
427
|
+
dots = -1;
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
return res;
|
|
431
|
+
}
|
|
432
|
+
var isAbsolute = function(p) {
|
|
433
|
+
return _IS_ABSOLUTE_RE.test(p);
|
|
434
|
+
};
|
|
435
|
+
var MAX_PATH_SEARCH_DEPTH = 30;
|
|
436
|
+
var depth = 0;
|
|
437
|
+
function findFolderUp(startPath, endFileNames = [], endDirectoryNames = []) {
|
|
438
|
+
const _startPath = startPath ?? process.cwd();
|
|
439
|
+
if (endDirectoryNames.some(
|
|
440
|
+
(endDirName) => fs.existsSync(path.join(_startPath, endDirName))
|
|
441
|
+
)) {
|
|
442
|
+
return _startPath;
|
|
443
|
+
}
|
|
444
|
+
if (endFileNames.some(
|
|
445
|
+
(endFileName) => fs.existsSync(path.join(_startPath, endFileName))
|
|
446
|
+
)) {
|
|
447
|
+
return _startPath;
|
|
448
|
+
}
|
|
449
|
+
if (_startPath !== "/" && depth++ < MAX_PATH_SEARCH_DEPTH) {
|
|
450
|
+
const parent = path.join(_startPath, "..");
|
|
451
|
+
return findFolderUp(parent, endFileNames, endDirectoryNames);
|
|
452
|
+
}
|
|
453
|
+
return void 0;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
// ../config-tools/src/utilities/find-workspace-root.ts
|
|
457
|
+
var rootFiles = [
|
|
458
|
+
"storm-workspace.json",
|
|
459
|
+
"storm-workspace.json",
|
|
460
|
+
"storm-workspace.yaml",
|
|
461
|
+
"storm-workspace.yml",
|
|
462
|
+
"storm-workspace.js",
|
|
463
|
+
"storm-workspace.ts",
|
|
464
|
+
".storm-workspace.json",
|
|
465
|
+
".storm-workspace.yaml",
|
|
466
|
+
".storm-workspace.yml",
|
|
467
|
+
".storm-workspace.js",
|
|
468
|
+
".storm-workspace.ts",
|
|
469
|
+
"lerna.json",
|
|
470
|
+
"nx.json",
|
|
471
|
+
"turbo.json",
|
|
472
|
+
"npm-workspace.json",
|
|
473
|
+
"yarn-workspace.json",
|
|
474
|
+
"pnpm-workspace.json",
|
|
475
|
+
"npm-workspace.yaml",
|
|
476
|
+
"yarn-workspace.yaml",
|
|
477
|
+
"pnpm-workspace.yaml",
|
|
478
|
+
"npm-workspace.yml",
|
|
479
|
+
"yarn-workspace.yml",
|
|
480
|
+
"pnpm-workspace.yml",
|
|
481
|
+
"npm-lock.json",
|
|
482
|
+
"yarn-lock.json",
|
|
483
|
+
"pnpm-lock.json",
|
|
484
|
+
"npm-lock.yaml",
|
|
485
|
+
"yarn-lock.yaml",
|
|
486
|
+
"pnpm-lock.yaml",
|
|
487
|
+
"npm-lock.yml",
|
|
488
|
+
"yarn-lock.yml",
|
|
489
|
+
"pnpm-lock.yml",
|
|
490
|
+
"bun.lockb"
|
|
491
|
+
];
|
|
492
|
+
var rootDirectories = [
|
|
493
|
+
".storm-workspace",
|
|
494
|
+
".nx",
|
|
495
|
+
".github",
|
|
496
|
+
".vscode",
|
|
497
|
+
".verdaccio"
|
|
498
|
+
];
|
|
499
|
+
function findWorkspaceRootSafe(pathInsideMonorepo) {
|
|
500
|
+
if (process.env.STORM_WORKSPACE_ROOT || process.env.NX_WORKSPACE_ROOT_PATH) {
|
|
501
|
+
return correctPaths(
|
|
502
|
+
process.env.STORM_WORKSPACE_ROOT ?? process.env.NX_WORKSPACE_ROOT_PATH
|
|
503
|
+
);
|
|
504
|
+
}
|
|
505
|
+
return correctPaths(
|
|
506
|
+
findFolderUp(
|
|
507
|
+
pathInsideMonorepo ?? process.cwd(),
|
|
508
|
+
rootFiles,
|
|
509
|
+
rootDirectories
|
|
510
|
+
)
|
|
511
|
+
);
|
|
512
|
+
}
|
|
513
|
+
function findWorkspaceRoot(pathInsideMonorepo) {
|
|
514
|
+
const result = findWorkspaceRootSafe(pathInsideMonorepo);
|
|
515
|
+
if (!result) {
|
|
516
|
+
throw new Error(
|
|
517
|
+
`Cannot find workspace root upwards from known path. Files search list includes:
|
|
518
|
+
${rootFiles.join(
|
|
519
|
+
"\n"
|
|
520
|
+
)}
|
|
521
|
+
Path: ${pathInsideMonorepo ? pathInsideMonorepo : process.cwd()}`
|
|
522
|
+
);
|
|
523
|
+
}
|
|
524
|
+
return result;
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
// ../config-tools/src/utilities/get-default-config.ts
|
|
528
|
+
var DEFAULT_COLOR_CONFIG = {
|
|
529
|
+
};
|
|
530
|
+
async function getPackageJsonConfig(root) {
|
|
531
|
+
let license = STORM_DEFAULT_LICENSE;
|
|
532
|
+
let homepage = void 0;
|
|
533
|
+
let support = void 0;
|
|
534
|
+
let name = void 0;
|
|
535
|
+
let namespace = void 0;
|
|
536
|
+
let repository = void 0;
|
|
537
|
+
const workspaceRoot = findWorkspaceRoot(root);
|
|
538
|
+
if (fs.existsSync(path.join(workspaceRoot, "package.json"))) {
|
|
539
|
+
const file = await promises.readFile(
|
|
540
|
+
joinPaths(workspaceRoot, "package.json"),
|
|
541
|
+
"utf8"
|
|
542
|
+
);
|
|
543
|
+
if (file) {
|
|
544
|
+
const packageJson = JSON.parse(file);
|
|
545
|
+
if (packageJson.name) {
|
|
546
|
+
name = packageJson.name;
|
|
547
|
+
}
|
|
548
|
+
if (packageJson.namespace) {
|
|
549
|
+
namespace = packageJson.namespace;
|
|
550
|
+
}
|
|
551
|
+
if (packageJson.repository) {
|
|
552
|
+
if (typeof packageJson.repository === "string") {
|
|
553
|
+
repository = packageJson.repository;
|
|
554
|
+
} else if (packageJson.repository.url) {
|
|
555
|
+
repository = packageJson.repository.url;
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
if (packageJson.license) {
|
|
559
|
+
license = packageJson.license;
|
|
560
|
+
}
|
|
561
|
+
if (packageJson.homepage) {
|
|
562
|
+
homepage = packageJson.homepage;
|
|
563
|
+
}
|
|
564
|
+
if (packageJson.bugs) {
|
|
565
|
+
if (typeof packageJson.bugs === "string") {
|
|
566
|
+
support = packageJson.bugs;
|
|
567
|
+
} else if (packageJson.bugs.url) {
|
|
568
|
+
support = packageJson.bugs.url;
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
return {
|
|
574
|
+
workspaceRoot,
|
|
575
|
+
name,
|
|
576
|
+
namespace,
|
|
577
|
+
repository,
|
|
578
|
+
license,
|
|
579
|
+
homepage,
|
|
580
|
+
support
|
|
581
|
+
};
|
|
582
|
+
}
|
|
583
|
+
function applyDefaultConfig(config) {
|
|
584
|
+
if (!config.support && config.contact) {
|
|
585
|
+
config.support = config.contact;
|
|
586
|
+
}
|
|
587
|
+
if (!config.contact && config.support) {
|
|
588
|
+
config.contact = config.support;
|
|
589
|
+
}
|
|
590
|
+
if (config.homepage) {
|
|
591
|
+
if (!config.docs) {
|
|
592
|
+
config.docs = `${config.homepage}/docs`;
|
|
593
|
+
}
|
|
594
|
+
if (!config.license) {
|
|
595
|
+
config.license = `${config.homepage}/license`;
|
|
596
|
+
}
|
|
597
|
+
if (!config.support) {
|
|
598
|
+
config.support = `${config.homepage}/support`;
|
|
599
|
+
}
|
|
600
|
+
if (!config.contact) {
|
|
601
|
+
config.contact = `${config.homepage}/contact`;
|
|
602
|
+
}
|
|
603
|
+
if (!config.error?.codesFile || !config?.error?.url) {
|
|
604
|
+
config.error ??= { codesFile: STORM_DEFAULT_ERROR_CODES_FILE };
|
|
605
|
+
if (config.homepage) {
|
|
606
|
+
config.error.url ??= `${config.homepage}/errors`;
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
return config;
|
|
611
|
+
}
|
|
612
|
+
var chalkDefault = {
|
|
613
|
+
hex: (_) => (message) => message,
|
|
614
|
+
bgHex: (_) => ({
|
|
615
|
+
whiteBright: (message) => message,
|
|
616
|
+
white: (message) => message
|
|
617
|
+
}),
|
|
618
|
+
white: (message) => message,
|
|
619
|
+
whiteBright: (message) => message,
|
|
620
|
+
gray: (message) => message,
|
|
621
|
+
bold: {
|
|
622
|
+
hex: (_) => (message) => message,
|
|
623
|
+
bgHex: (_) => ({
|
|
624
|
+
whiteBright: (message) => message,
|
|
625
|
+
white: (message) => message
|
|
626
|
+
}),
|
|
627
|
+
whiteBright: (message) => message,
|
|
628
|
+
white: (message) => message
|
|
629
|
+
},
|
|
630
|
+
dim: {
|
|
631
|
+
hex: (_) => (message) => message,
|
|
632
|
+
gray: (message) => message
|
|
633
|
+
}
|
|
634
|
+
};
|
|
635
|
+
var getChalk = () => {
|
|
636
|
+
let _chalk = chalk__default.default;
|
|
637
|
+
if (!_chalk?.hex || !_chalk?.bold?.hex || !_chalk?.bgHex || !_chalk?.whiteBright || !_chalk?.white) {
|
|
638
|
+
_chalk = chalkDefault;
|
|
639
|
+
}
|
|
640
|
+
return _chalk;
|
|
641
|
+
};
|
|
642
|
+
|
|
643
|
+
// ../config-tools/src/logger/is-unicode-supported.ts
|
|
644
|
+
function isUnicodeSupported() {
|
|
645
|
+
if (process.platform !== "win32") {
|
|
646
|
+
return process.env.TERM !== "linux";
|
|
647
|
+
}
|
|
648
|
+
return Boolean(process.env.WT_SESSION) || // Windows Terminal
|
|
649
|
+
Boolean(process.env.TERMINUS_SUBLIME) || // Terminus (<0.2.27)
|
|
650
|
+
process.env.ConEmuTask === "{cmd::Cmder}" || // ConEmu and cmder
|
|
651
|
+
process.env.TERM_PROGRAM === "Terminus-Sublime" || process.env.TERM_PROGRAM === "vscode" || process.env.TERM === "xterm-256color" || process.env.TERM === "alacritty" || process.env.TERM === "rxvt-unicode" || process.env.TERM === "rxvt-unicode-256color" || process.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
// ../config-tools/src/logger/console-icons.ts
|
|
655
|
+
var useIcon = (c, fallback) => isUnicodeSupported() ? c : fallback;
|
|
656
|
+
var CONSOLE_ICONS = {
|
|
657
|
+
[LogLevelLabel.ERROR]: useIcon("\u2718", "\xD7"),
|
|
658
|
+
[LogLevelLabel.FATAL]: useIcon("\u{1F480}", "\xD7"),
|
|
659
|
+
[LogLevelLabel.WARN]: useIcon("\u26A0", "\u203C"),
|
|
660
|
+
[LogLevelLabel.INFO]: useIcon("\u2139", "i"),
|
|
661
|
+
[LogLevelLabel.SUCCESS]: useIcon("\u2714", "\u221A"),
|
|
662
|
+
[LogLevelLabel.DEBUG]: useIcon("\u{1F6E0}", "D"),
|
|
663
|
+
[LogLevelLabel.TRACE]: useIcon("\u{1F6E0}", "T"),
|
|
664
|
+
[LogLevelLabel.ALL]: useIcon("\u2709", "\u2192")
|
|
665
|
+
};
|
|
666
|
+
|
|
667
|
+
// ../config-tools/src/logger/format-timestamp.ts
|
|
668
|
+
var formatTimestamp = (date = /* @__PURE__ */ new Date()) => {
|
|
669
|
+
return `${date.toLocaleDateString()} ${date.toLocaleTimeString()}`;
|
|
670
|
+
};
|
|
671
|
+
|
|
672
|
+
// ../config-tools/src/logger/get-log-level.ts
|
|
673
|
+
var getLogLevel = (label) => {
|
|
674
|
+
switch (label) {
|
|
675
|
+
case "all":
|
|
676
|
+
return LogLevel.ALL;
|
|
677
|
+
case "trace":
|
|
678
|
+
return LogLevel.TRACE;
|
|
679
|
+
case "debug":
|
|
680
|
+
return LogLevel.DEBUG;
|
|
681
|
+
case "info":
|
|
682
|
+
return LogLevel.INFO;
|
|
683
|
+
case "warn":
|
|
684
|
+
return LogLevel.WARN;
|
|
685
|
+
case "error":
|
|
686
|
+
return LogLevel.ERROR;
|
|
687
|
+
case "fatal":
|
|
688
|
+
return LogLevel.FATAL;
|
|
689
|
+
case "silent":
|
|
690
|
+
return LogLevel.SILENT;
|
|
691
|
+
default:
|
|
692
|
+
return LogLevel.INFO;
|
|
693
|
+
}
|
|
694
|
+
};
|
|
695
|
+
var getLogLevelLabel = (logLevel = LogLevel.INFO) => {
|
|
696
|
+
if (logLevel >= LogLevel.ALL) {
|
|
697
|
+
return LogLevelLabel.ALL;
|
|
698
|
+
}
|
|
699
|
+
if (logLevel >= LogLevel.TRACE) {
|
|
700
|
+
return LogLevelLabel.TRACE;
|
|
701
|
+
}
|
|
702
|
+
if (logLevel >= LogLevel.DEBUG) {
|
|
703
|
+
return LogLevelLabel.DEBUG;
|
|
704
|
+
}
|
|
705
|
+
if (logLevel >= LogLevel.INFO) {
|
|
706
|
+
return LogLevelLabel.INFO;
|
|
707
|
+
}
|
|
708
|
+
if (logLevel >= LogLevel.WARN) {
|
|
709
|
+
return LogLevelLabel.WARN;
|
|
710
|
+
}
|
|
711
|
+
if (logLevel >= LogLevel.ERROR) {
|
|
712
|
+
return LogLevelLabel.ERROR;
|
|
713
|
+
}
|
|
714
|
+
if (logLevel >= LogLevel.FATAL) {
|
|
715
|
+
return LogLevelLabel.FATAL;
|
|
716
|
+
}
|
|
717
|
+
if (logLevel <= LogLevel.SILENT) {
|
|
718
|
+
return LogLevelLabel.SILENT;
|
|
719
|
+
}
|
|
720
|
+
return LogLevelLabel.INFO;
|
|
721
|
+
};
|
|
722
|
+
var isVerbose = (label = LogLevelLabel.SILENT) => {
|
|
723
|
+
const logLevel = typeof label === "string" ? getLogLevel(label) : label;
|
|
724
|
+
return logLevel >= LogLevel.DEBUG;
|
|
725
|
+
};
|
|
726
|
+
|
|
727
|
+
// ../config-tools/src/logger/console.ts
|
|
728
|
+
var getLogFn = (logLevel = LogLevel.INFO, config = {}, _chalk = getChalk()) => {
|
|
729
|
+
const colors = !config.colors?.dark && !config.colors?.["base"] && !config.colors?.["base"]?.dark ? DEFAULT_COLOR_CONFIG : config.colors?.dark && typeof config.colors.dark === "string" ? config.colors : config.colors?.["base"]?.dark && typeof config.colors["base"].dark === "string" ? config.colors["base"].dark : config.colors?.["base"] ? config.colors?.["base"] : DEFAULT_COLOR_CONFIG;
|
|
730
|
+
const configLogLevel = config.logLevel || process.env.STORM_LOG_LEVEL || LogLevelLabel.INFO;
|
|
731
|
+
if (logLevel > getLogLevel(configLogLevel) || logLevel <= LogLevel.SILENT || getLogLevel(configLogLevel) <= LogLevel.SILENT) {
|
|
732
|
+
return (_) => {
|
|
733
|
+
};
|
|
734
|
+
}
|
|
735
|
+
if (typeof logLevel === "number" && LogLevel.FATAL >= logLevel) {
|
|
736
|
+
return (message) => {
|
|
737
|
+
console.error(
|
|
738
|
+
`
|
|
739
|
+
${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.fatal ?? "#7d1a1a")(`[${CONSOLE_ICONS[LogLevelLabel.FATAL]} Fatal] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
|
|
740
|
+
`
|
|
741
|
+
);
|
|
742
|
+
};
|
|
743
|
+
}
|
|
744
|
+
if (typeof logLevel === "number" && LogLevel.ERROR >= logLevel) {
|
|
745
|
+
return (message) => {
|
|
746
|
+
console.error(
|
|
747
|
+
`
|
|
748
|
+
${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.danger ?? "#f85149")(`[${CONSOLE_ICONS[LogLevelLabel.ERROR]} Error] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
|
|
749
|
+
`
|
|
750
|
+
);
|
|
751
|
+
};
|
|
752
|
+
}
|
|
753
|
+
if (typeof logLevel === "number" && LogLevel.WARN >= logLevel) {
|
|
754
|
+
return (message) => {
|
|
755
|
+
console.warn(
|
|
756
|
+
`
|
|
757
|
+
${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.warning ?? "#e3b341")(`[${CONSOLE_ICONS[LogLevelLabel.WARN]} Warn] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
|
|
758
|
+
`
|
|
759
|
+
);
|
|
760
|
+
};
|
|
761
|
+
}
|
|
762
|
+
if (typeof logLevel === "number" && LogLevel.SUCCESS >= logLevel) {
|
|
763
|
+
return (message) => {
|
|
764
|
+
console.info(
|
|
765
|
+
`
|
|
766
|
+
${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.success ?? "#56d364")(`[${CONSOLE_ICONS[LogLevelLabel.SUCCESS]} Success] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
|
|
767
|
+
`
|
|
768
|
+
);
|
|
769
|
+
};
|
|
770
|
+
}
|
|
771
|
+
if (typeof logLevel === "number" && LogLevel.INFO >= logLevel) {
|
|
772
|
+
return (message) => {
|
|
773
|
+
console.info(
|
|
774
|
+
`
|
|
775
|
+
${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.info ?? "#58a6ff")(`[${CONSOLE_ICONS[LogLevelLabel.INFO]} Info] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
|
|
776
|
+
`
|
|
777
|
+
);
|
|
778
|
+
};
|
|
779
|
+
}
|
|
780
|
+
if (typeof logLevel === "number" && LogLevel.DEBUG >= logLevel) {
|
|
781
|
+
return (message) => {
|
|
782
|
+
console.debug(
|
|
783
|
+
`
|
|
784
|
+
${_chalk.gray(formatTimestamp())} ${_chalk.hex("#3e9eff")(`[${CONSOLE_ICONS[LogLevelLabel.DEBUG]} Debug] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
|
|
785
|
+
`
|
|
786
|
+
);
|
|
787
|
+
};
|
|
788
|
+
}
|
|
789
|
+
if (typeof logLevel === "number" && LogLevel.TRACE >= logLevel) {
|
|
790
|
+
return (message) => {
|
|
791
|
+
console.debug(
|
|
792
|
+
`
|
|
793
|
+
${_chalk.gray(formatTimestamp())} ${_chalk.hex("#0070E0")(`[${CONSOLE_ICONS[LogLevelLabel.TRACE]} Trace] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
|
|
794
|
+
`
|
|
795
|
+
);
|
|
796
|
+
};
|
|
797
|
+
}
|
|
798
|
+
return (message) => {
|
|
799
|
+
console.log(
|
|
800
|
+
`
|
|
801
|
+
${_chalk.gray(formatTimestamp())} ${_chalk.hex("#0356a8")(`[${CONSOLE_ICONS[LogLevelLabel.ALL]} System] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
|
|
802
|
+
`
|
|
803
|
+
);
|
|
804
|
+
};
|
|
805
|
+
};
|
|
806
|
+
var writeFatal = (message, config) => getLogFn(LogLevel.FATAL, config)(message);
|
|
807
|
+
var writeError = (message, config) => getLogFn(LogLevel.ERROR, config)(message);
|
|
808
|
+
var writeWarning = (message, config) => getLogFn(LogLevel.WARN, config)(message);
|
|
809
|
+
var writeInfo = (message, config) => getLogFn(LogLevel.INFO, config)(message);
|
|
810
|
+
var writeSuccess = (message, config) => getLogFn(LogLevel.SUCCESS, config)(message);
|
|
811
|
+
var writeDebug = (message, config) => getLogFn(LogLevel.DEBUG, config)(message);
|
|
812
|
+
var writeTrace = (message, config) => getLogFn(LogLevel.TRACE, config)(message);
|
|
813
|
+
var MAX_DEPTH = 4;
|
|
814
|
+
var formatLogMessage = (message, options = {}, depth2 = 0) => {
|
|
815
|
+
if (depth2 > MAX_DEPTH) {
|
|
816
|
+
return "<max depth>";
|
|
817
|
+
}
|
|
818
|
+
const prefix = options.prefix ?? "-";
|
|
819
|
+
const skip = options.skip ?? [];
|
|
820
|
+
return typeof message === "undefined" || message === null || !message && typeof message !== "boolean" ? "<none>" : typeof message === "string" ? message : Array.isArray(message) ? `
|
|
821
|
+
${message.map((item, index) => ` ${prefix}> #${index} = ${formatLogMessage(item, { prefix: `${prefix}-`, skip }, depth2 + 1)}`).join("\n")}` : typeof message === "object" ? `
|
|
822
|
+
${Object.keys(message).filter((key) => !skip.includes(key)).map(
|
|
823
|
+
(key) => ` ${prefix}> ${key} = ${_isFunction(message[key]) ? "<function>" : typeof message[key] === "object" ? formatLogMessage(
|
|
824
|
+
message[key],
|
|
825
|
+
{ prefix: `${prefix}-`, skip },
|
|
826
|
+
depth2 + 1
|
|
827
|
+
) : message[key]}`
|
|
828
|
+
).join("\n")}` : message;
|
|
829
|
+
};
|
|
830
|
+
var _isFunction = (value) => {
|
|
831
|
+
try {
|
|
832
|
+
return value instanceof Function || typeof value === "function" || !!(value?.constructor && value?.call && value?.apply);
|
|
833
|
+
} catch (e) {
|
|
834
|
+
return false;
|
|
835
|
+
}
|
|
836
|
+
};
|
|
837
|
+
|
|
838
|
+
// ../config-tools/src/utilities/process-handler.ts
|
|
839
|
+
var exitWithError = (config) => {
|
|
840
|
+
writeFatal("Exiting script with an error status...", config);
|
|
841
|
+
process.exit(1);
|
|
842
|
+
};
|
|
843
|
+
var exitWithSuccess = (config) => {
|
|
844
|
+
writeSuccess("Script completed successfully. Exiting...", config);
|
|
845
|
+
process.exit(0);
|
|
846
|
+
};
|
|
847
|
+
var handleProcess = (config) => {
|
|
848
|
+
writeTrace(
|
|
849
|
+
`Using the following arguments to process the script: ${process.argv.join(", ")}`,
|
|
850
|
+
config
|
|
851
|
+
);
|
|
852
|
+
process.on("unhandledRejection", (error) => {
|
|
853
|
+
writeError(
|
|
854
|
+
`An Unhandled Rejection occurred while running the program: ${error}`,
|
|
855
|
+
config
|
|
856
|
+
);
|
|
857
|
+
exitWithError(config);
|
|
858
|
+
});
|
|
859
|
+
process.on("uncaughtException", (error) => {
|
|
860
|
+
writeError(
|
|
861
|
+
`An Uncaught Exception occurred while running the program: ${error.message}
|
|
862
|
+
Stacktrace: ${error.stack}`,
|
|
863
|
+
config
|
|
864
|
+
);
|
|
865
|
+
exitWithError(config);
|
|
866
|
+
});
|
|
867
|
+
process.on("SIGTERM", (signal) => {
|
|
868
|
+
writeError(`The program terminated with signal code: ${signal}`, config);
|
|
869
|
+
exitWithError(config);
|
|
870
|
+
});
|
|
871
|
+
process.on("SIGINT", (signal) => {
|
|
872
|
+
writeError(`The program terminated with signal code: ${signal}`, config);
|
|
873
|
+
exitWithError(config);
|
|
874
|
+
});
|
|
875
|
+
process.on("SIGHUP", (signal) => {
|
|
876
|
+
writeError(`The program terminated with signal code: ${signal}`, config);
|
|
877
|
+
exitWithError(config);
|
|
878
|
+
});
|
|
879
|
+
};
|
|
880
|
+
|
|
881
|
+
// ../../node_modules/.pnpm/defu@6.1.4/node_modules/defu/dist/defu.mjs
|
|
882
|
+
function isPlainObject(value) {
|
|
883
|
+
if (value === null || typeof value !== "object") {
|
|
884
|
+
return false;
|
|
885
|
+
}
|
|
886
|
+
const prototype = Object.getPrototypeOf(value);
|
|
887
|
+
if (prototype !== null && prototype !== Object.prototype && Object.getPrototypeOf(prototype) !== null) {
|
|
888
|
+
return false;
|
|
889
|
+
}
|
|
890
|
+
if (Symbol.iterator in value) {
|
|
891
|
+
return false;
|
|
892
|
+
}
|
|
893
|
+
if (Symbol.toStringTag in value) {
|
|
894
|
+
return Object.prototype.toString.call(value) === "[object Module]";
|
|
895
|
+
}
|
|
896
|
+
return true;
|
|
897
|
+
}
|
|
898
|
+
function _defu(baseObject, defaults, namespace = ".", merger) {
|
|
899
|
+
if (!isPlainObject(defaults)) {
|
|
900
|
+
return _defu(baseObject, {}, namespace, merger);
|
|
901
|
+
}
|
|
902
|
+
const object2 = Object.assign({}, defaults);
|
|
903
|
+
for (const key in baseObject) {
|
|
904
|
+
if (key === "__proto__" || key === "constructor") {
|
|
905
|
+
continue;
|
|
906
|
+
}
|
|
907
|
+
const value = baseObject[key];
|
|
908
|
+
if (value === null || value === void 0) {
|
|
909
|
+
continue;
|
|
910
|
+
}
|
|
911
|
+
if (merger && merger(object2, key, value, namespace)) {
|
|
912
|
+
continue;
|
|
913
|
+
}
|
|
914
|
+
if (Array.isArray(value) && Array.isArray(object2[key])) {
|
|
915
|
+
object2[key] = [...value, ...object2[key]];
|
|
916
|
+
} else if (isPlainObject(value) && isPlainObject(object2[key])) {
|
|
917
|
+
object2[key] = _defu(
|
|
918
|
+
value,
|
|
919
|
+
object2[key],
|
|
920
|
+
(namespace ? `${namespace}.` : "") + key.toString(),
|
|
921
|
+
merger
|
|
922
|
+
);
|
|
923
|
+
} else {
|
|
924
|
+
object2[key] = value;
|
|
925
|
+
}
|
|
926
|
+
}
|
|
927
|
+
return object2;
|
|
928
|
+
}
|
|
929
|
+
function createDefu(merger) {
|
|
930
|
+
return (...arguments_) => (
|
|
931
|
+
// eslint-disable-next-line unicorn/no-array-reduce
|
|
932
|
+
arguments_.reduce((p, c) => _defu(p, c, "", merger), {})
|
|
933
|
+
);
|
|
934
|
+
}
|
|
935
|
+
var defu = createDefu();
|
|
936
|
+
var getConfigFileByName = async (fileName, filePath, options = {}) => {
|
|
937
|
+
const workspacePath = filePath || findWorkspaceRoot(filePath);
|
|
938
|
+
const configs = await Promise.all([
|
|
939
|
+
c12.loadConfig({
|
|
940
|
+
cwd: workspacePath,
|
|
941
|
+
packageJson: true,
|
|
942
|
+
name: fileName,
|
|
943
|
+
envName: fileName?.toUpperCase(),
|
|
944
|
+
jitiOptions: {
|
|
945
|
+
debug: false,
|
|
946
|
+
fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : joinPaths(
|
|
947
|
+
process.env.STORM_CACHE_DIR || "node_modules/.cache/storm",
|
|
948
|
+
"jiti"
|
|
949
|
+
)
|
|
950
|
+
},
|
|
951
|
+
...options
|
|
952
|
+
}),
|
|
953
|
+
c12.loadConfig({
|
|
954
|
+
cwd: workspacePath,
|
|
955
|
+
packageJson: true,
|
|
956
|
+
name: fileName,
|
|
957
|
+
envName: fileName?.toUpperCase(),
|
|
958
|
+
jitiOptions: {
|
|
959
|
+
debug: false,
|
|
960
|
+
fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : joinPaths(
|
|
961
|
+
process.env.STORM_CACHE_DIR || "node_modules/.cache/storm",
|
|
962
|
+
"jiti"
|
|
963
|
+
)
|
|
964
|
+
},
|
|
965
|
+
configFile: fileName,
|
|
966
|
+
...options
|
|
967
|
+
})
|
|
968
|
+
]);
|
|
969
|
+
return defu(configs[0] ?? {}, configs[1] ?? {});
|
|
970
|
+
};
|
|
971
|
+
var getConfigFile = async (filePath, additionalFileNames = []) => {
|
|
972
|
+
const workspacePath = filePath ? filePath : findWorkspaceRoot(filePath);
|
|
973
|
+
const result = await getConfigFileByName("storm-workspace", workspacePath);
|
|
974
|
+
let config = result.config;
|
|
975
|
+
const configFile = result.configFile;
|
|
976
|
+
if (config && configFile && Object.keys(config).length > 0 && !config.skipConfigLogging) {
|
|
977
|
+
writeTrace(
|
|
978
|
+
`Found Storm configuration file "${configFile.includes(`${workspacePath}/`) ? configFile.replace(`${workspacePath}/`, "") : configFile}" at "${workspacePath}"`,
|
|
979
|
+
{
|
|
980
|
+
logLevel: "all"
|
|
981
|
+
}
|
|
982
|
+
);
|
|
983
|
+
}
|
|
984
|
+
if (additionalFileNames && additionalFileNames.length > 0) {
|
|
985
|
+
const results = await Promise.all(
|
|
986
|
+
additionalFileNames.map(
|
|
987
|
+
(fileName) => getConfigFileByName(fileName, workspacePath)
|
|
988
|
+
)
|
|
989
|
+
);
|
|
990
|
+
for (const result2 of results) {
|
|
991
|
+
if (result2?.config && result2?.configFile && Object.keys(result2.config).length > 0) {
|
|
992
|
+
if (!config.skipConfigLogging && !result2.config.skipConfigLogging) {
|
|
993
|
+
writeTrace(
|
|
994
|
+
`Found alternative configuration file "${result2.configFile.includes(`${workspacePath}/`) ? result2.configFile.replace(`${workspacePath}/`, "") : result2.configFile}" at "${workspacePath}"`,
|
|
995
|
+
{
|
|
996
|
+
logLevel: "all"
|
|
997
|
+
}
|
|
998
|
+
);
|
|
999
|
+
}
|
|
1000
|
+
config = defu(result2.config ?? {}, config ?? {});
|
|
1001
|
+
}
|
|
1002
|
+
}
|
|
1003
|
+
}
|
|
1004
|
+
if (!config || Object.keys(config).length === 0) {
|
|
1005
|
+
return void 0;
|
|
1006
|
+
}
|
|
1007
|
+
config.configFile = configFile;
|
|
1008
|
+
return config;
|
|
1009
|
+
};
|
|
1010
|
+
var getConfigEnv = () => {
|
|
1011
|
+
const prefix = "STORM_";
|
|
1012
|
+
let config = {
|
|
1013
|
+
extends: process.env[`${prefix}EXTENDS`] || void 0,
|
|
1014
|
+
name: process.env[`${prefix}NAME`] || void 0,
|
|
1015
|
+
namespace: process.env[`${prefix}NAMESPACE`] || void 0,
|
|
1016
|
+
owner: process.env[`${prefix}OWNER`] || void 0,
|
|
1017
|
+
bot: {
|
|
1018
|
+
name: process.env[`${prefix}BOT_NAME`] || void 0,
|
|
1019
|
+
email: process.env[`${prefix}BOT_EMAIL`] || void 0
|
|
1020
|
+
},
|
|
1021
|
+
release: {
|
|
1022
|
+
banner: process.env[`${prefix}RELEASE_BANNER`] || void 0,
|
|
1023
|
+
header: process.env[`${prefix}RELEASE_HEADER`] || void 0,
|
|
1024
|
+
footer: process.env[`${prefix}RELEASE_FOOTER`] || void 0
|
|
1025
|
+
},
|
|
1026
|
+
error: {
|
|
1027
|
+
codesFile: process.env[`${prefix}ERROR_CODES_FILE`] || void 0,
|
|
1028
|
+
url: process.env[`${prefix}ERROR_URL`] || void 0
|
|
1029
|
+
},
|
|
1030
|
+
socials: {
|
|
1031
|
+
twitter: process.env[`${prefix}SOCIAL_TWITTER`] || void 0,
|
|
1032
|
+
discord: process.env[`${prefix}SOCIAL_DISCORD`] || void 0,
|
|
1033
|
+
telegram: process.env[`${prefix}SOCIAL_TELEGRAM`] || void 0,
|
|
1034
|
+
slack: process.env[`${prefix}SOCIAL_SLACK`] || void 0,
|
|
1035
|
+
medium: process.env[`${prefix}SOCIAL_MEDIUM`] || void 0,
|
|
1036
|
+
github: process.env[`${prefix}SOCIAL_GITHUB`] || void 0
|
|
1037
|
+
},
|
|
1038
|
+
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`] ? {
|
|
1039
|
+
name: process.env[`${prefix}ORG`] || process.env[`${prefix}ORGANIZATION`] || process.env[`${prefix}ORG_NAME`] || process.env[`${prefix}ORGANIZATION_NAME`],
|
|
1040
|
+
description: process.env[`${prefix}ORG_DESCRIPTION`] || process.env[`${prefix}ORGANIZATION_DESCRIPTION`] || void 0,
|
|
1041
|
+
url: process.env[`${prefix}ORG_URL`] || process.env[`${prefix}ORGANIZATION_URL`] || void 0,
|
|
1042
|
+
logo: process.env[`${prefix}ORG_LOGO`] || process.env[`${prefix}ORGANIZATION_LOGO`] || void 0,
|
|
1043
|
+
icon: process.env[`${prefix}ORG_ICON`] || process.env[`${prefix}ORGANIZATION_ICON`] || void 0
|
|
1044
|
+
} : process.env[`${prefix}ORG`] || process.env[`${prefix}ORGANIZATION`] || process.env[`${prefix}ORG_NAME`] || process.env[`${prefix}ORGANIZATION_NAME`] : void 0,
|
|
1045
|
+
packageManager: process.env[`${prefix}PACKAGE_MANAGER`] || void 0,
|
|
1046
|
+
license: process.env[`${prefix}LICENSE`] || void 0,
|
|
1047
|
+
homepage: process.env[`${prefix}HOMEPAGE`] || void 0,
|
|
1048
|
+
docs: process.env[`${prefix}DOCS`] || void 0,
|
|
1049
|
+
portal: process.env[`${prefix}PORTAL`] || void 0,
|
|
1050
|
+
licensing: process.env[`${prefix}LICENSING`] || void 0,
|
|
1051
|
+
contact: process.env[`${prefix}CONTACT`] || void 0,
|
|
1052
|
+
support: process.env[`${prefix}SUPPORT`] || void 0,
|
|
1053
|
+
timezone: process.env[`${prefix}TIMEZONE`] || process.env.TZ || void 0,
|
|
1054
|
+
locale: process.env[`${prefix}LOCALE`] || process.env.LOCALE || void 0,
|
|
1055
|
+
configFile: process.env[`${prefix}CONFIG_FILE`] ? correctPaths(process.env[`${prefix}CONFIG_FILE`]) : void 0,
|
|
1056
|
+
workspaceRoot: process.env[`${prefix}WORKSPACE_ROOT`] ? correctPaths(process.env[`${prefix}WORKSPACE_ROOT`]) : void 0,
|
|
1057
|
+
directories: {
|
|
1058
|
+
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,
|
|
1059
|
+
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,
|
|
1060
|
+
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,
|
|
1061
|
+
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,
|
|
1062
|
+
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,
|
|
1063
|
+
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
|
|
1064
|
+
},
|
|
1065
|
+
skipCache: process.env[`${prefix}SKIP_CACHE`] !== void 0 ? Boolean(process.env[`${prefix}SKIP_CACHE`]) : void 0,
|
|
1066
|
+
mode: (process.env[`${prefix}MODE`] ?? process.env.NODE_ENV ?? process.env.ENVIRONMENT) || void 0,
|
|
1067
|
+
// ci:
|
|
1068
|
+
// process.env[`${prefix}CI`] !== undefined
|
|
1069
|
+
// ? Boolean(
|
|
1070
|
+
// process.env[`${prefix}CI`] ??
|
|
1071
|
+
// process.env.CI ??
|
|
1072
|
+
// process.env.CONTINUOUS_INTEGRATION
|
|
1073
|
+
// )
|
|
1074
|
+
// : undefined,
|
|
1075
|
+
repository: process.env[`${prefix}REPOSITORY`] || void 0,
|
|
1076
|
+
branch: process.env[`${prefix}BRANCH`] || void 0,
|
|
1077
|
+
preid: process.env[`${prefix}PRE_ID`] || void 0,
|
|
1078
|
+
registry: {
|
|
1079
|
+
github: process.env[`${prefix}REGISTRY_GITHUB`] || void 0,
|
|
1080
|
+
npm: process.env[`${prefix}REGISTRY_NPM`] || void 0,
|
|
1081
|
+
cargo: process.env[`${prefix}REGISTRY_CARGO`] || void 0,
|
|
1082
|
+
cyclone: process.env[`${prefix}REGISTRY_CYCLONE`] || void 0,
|
|
1083
|
+
container: process.env[`${prefix}REGISTRY_CONTAINER`] || void 0
|
|
1084
|
+
},
|
|
1085
|
+
logLevel: process.env[`${prefix}LOG_LEVEL`] !== null && process.env[`${prefix}LOG_LEVEL`] !== void 0 ? process.env[`${prefix}LOG_LEVEL`] && Number.isSafeInteger(
|
|
1086
|
+
Number.parseInt(process.env[`${prefix}LOG_LEVEL`])
|
|
1087
|
+
) ? getLogLevelLabel(
|
|
1088
|
+
Number.parseInt(process.env[`${prefix}LOG_LEVEL`])
|
|
1089
|
+
) : process.env[`${prefix}LOG_LEVEL`] : void 0,
|
|
1090
|
+
skipConfigLogging: process.env[`${prefix}SKIP_CONFIG_LOGGING`] !== void 0 ? Boolean(process.env[`${prefix}SKIP_CONFIG_LOGGING`]) : void 0
|
|
1091
|
+
};
|
|
1092
|
+
const themeNames = Object.keys(process.env).filter(
|
|
1093
|
+
(envKey) => envKey.startsWith(`${prefix}COLOR_`) && COLOR_KEYS.every(
|
|
1094
|
+
(colorKey) => !envKey.startsWith(`${prefix}COLOR_LIGHT_${colorKey}`) && !envKey.startsWith(`${prefix}COLOR_DARK_${colorKey}`)
|
|
1095
|
+
)
|
|
1096
|
+
);
|
|
1097
|
+
config.colors = themeNames.length > 0 ? themeNames.reduce(
|
|
1098
|
+
(ret, themeName) => {
|
|
1099
|
+
ret[themeName] = getThemeColorConfigEnv(prefix, themeName);
|
|
1100
|
+
return ret;
|
|
1101
|
+
},
|
|
1102
|
+
{}
|
|
1103
|
+
) : getThemeColorConfigEnv(prefix);
|
|
1104
|
+
if (config.docs === STORM_DEFAULT_DOCS) {
|
|
1105
|
+
if (config.homepage === STORM_DEFAULT_HOMEPAGE) {
|
|
1106
|
+
config.docs = `${STORM_DEFAULT_HOMEPAGE}/projects/${config.name}/docs`;
|
|
1107
|
+
} else {
|
|
1108
|
+
config.docs = `${config.homepage}/docs`;
|
|
1109
|
+
}
|
|
1110
|
+
}
|
|
1111
|
+
if (config.licensing === STORM_DEFAULT_LICENSING) {
|
|
1112
|
+
if (config.homepage === STORM_DEFAULT_HOMEPAGE) {
|
|
1113
|
+
config.licensing = `${STORM_DEFAULT_HOMEPAGE}/projects/${config.name}/licensing`;
|
|
1114
|
+
} else {
|
|
1115
|
+
config.licensing = `${config.homepage}/docs`;
|
|
1116
|
+
}
|
|
1117
|
+
}
|
|
1118
|
+
const serializedConfig = process.env[`${prefix}CONFIG`];
|
|
1119
|
+
if (serializedConfig) {
|
|
1120
|
+
const parsed = JSON.parse(serializedConfig);
|
|
1121
|
+
config = {
|
|
1122
|
+
...config,
|
|
1123
|
+
...parsed,
|
|
1124
|
+
colors: { ...config.colors, ...parsed.colors },
|
|
1125
|
+
extensions: { ...config.extensions, ...parsed.extensions }
|
|
1126
|
+
};
|
|
1127
|
+
}
|
|
1128
|
+
return config;
|
|
1129
|
+
};
|
|
1130
|
+
var getThemeColorConfigEnv = (prefix, theme) => {
|
|
1131
|
+
const themeName = `COLOR_${theme && theme !== "base" ? `${theme}_` : ""}`.toUpperCase();
|
|
1132
|
+
return process.env[`${prefix}${themeName}LIGHT_BRAND`] || process.env[`${prefix}${themeName}DARK_BRAND`] ? getMultiThemeColorConfigEnv(prefix + themeName) : getSingleThemeColorConfigEnv(prefix + themeName);
|
|
1133
|
+
};
|
|
1134
|
+
var getSingleThemeColorConfigEnv = (prefix) => {
|
|
1135
|
+
return {
|
|
1136
|
+
dark: process.env[`${prefix}DARK`],
|
|
1137
|
+
light: process.env[`${prefix}LIGHT`],
|
|
1138
|
+
brand: process.env[`${prefix}BRAND`],
|
|
1139
|
+
alternate: process.env[`${prefix}ALTERNATE`],
|
|
1140
|
+
accent: process.env[`${prefix}ACCENT`],
|
|
1141
|
+
link: process.env[`${prefix}LINK`],
|
|
1142
|
+
help: process.env[`${prefix}HELP`],
|
|
1143
|
+
success: process.env[`${prefix}SUCCESS`],
|
|
1144
|
+
info: process.env[`${prefix}INFO`],
|
|
1145
|
+
warning: process.env[`${prefix}WARNING`],
|
|
1146
|
+
danger: process.env[`${prefix}DANGER`],
|
|
1147
|
+
fatal: process.env[`${prefix}FATAL`],
|
|
1148
|
+
positive: process.env[`${prefix}POSITIVE`],
|
|
1149
|
+
negative: process.env[`${prefix}NEGATIVE`]
|
|
1150
|
+
};
|
|
1151
|
+
};
|
|
1152
|
+
var getMultiThemeColorConfigEnv = (prefix) => {
|
|
1153
|
+
return {
|
|
1154
|
+
light: getBaseThemeColorConfigEnv(
|
|
1155
|
+
`${prefix}_LIGHT_`
|
|
1156
|
+
),
|
|
1157
|
+
dark: getBaseThemeColorConfigEnv(`${prefix}_DARK_`)
|
|
1158
|
+
};
|
|
1159
|
+
};
|
|
1160
|
+
var getBaseThemeColorConfigEnv = (prefix) => {
|
|
1161
|
+
return {
|
|
1162
|
+
foreground: process.env[`${prefix}FOREGROUND`],
|
|
1163
|
+
background: process.env[`${prefix}BACKGROUND`],
|
|
1164
|
+
brand: process.env[`${prefix}BRAND`],
|
|
1165
|
+
alternate: process.env[`${prefix}ALTERNATE`],
|
|
1166
|
+
accent: process.env[`${prefix}ACCENT`],
|
|
1167
|
+
link: process.env[`${prefix}LINK`],
|
|
1168
|
+
help: process.env[`${prefix}HELP`],
|
|
1169
|
+
success: process.env[`${prefix}SUCCESS`],
|
|
1170
|
+
info: process.env[`${prefix}INFO`],
|
|
1171
|
+
warning: process.env[`${prefix}WARNING`],
|
|
1172
|
+
danger: process.env[`${prefix}DANGER`],
|
|
1173
|
+
fatal: process.env[`${prefix}FATAL`],
|
|
1174
|
+
positive: process.env[`${prefix}POSITIVE`],
|
|
1175
|
+
negative: process.env[`${prefix}NEGATIVE`]
|
|
1176
|
+
};
|
|
1177
|
+
};
|
|
1178
|
+
|
|
1179
|
+
// ../config-tools/src/env/set-env.ts
|
|
1180
|
+
var setExtensionEnv = (extensionName, extension) => {
|
|
1181
|
+
for (const key of Object.keys(extension ?? {})) {
|
|
1182
|
+
if (extension[key]) {
|
|
1183
|
+
const result = key?.replace(
|
|
1184
|
+
/([A-Z])+/g,
|
|
1185
|
+
(input) => input ? input[0]?.toUpperCase() + input.slice(1) : ""
|
|
1186
|
+
).split(/(?=[A-Z])|[.\-\s_]/).map((x) => x.toLowerCase()) ?? [];
|
|
1187
|
+
let extensionKey;
|
|
1188
|
+
if (result.length === 0) {
|
|
1189
|
+
return;
|
|
1190
|
+
}
|
|
1191
|
+
if (result.length === 1) {
|
|
1192
|
+
extensionKey = result[0]?.toUpperCase() ?? "";
|
|
1193
|
+
} else {
|
|
1194
|
+
extensionKey = result.reduce((ret, part) => {
|
|
1195
|
+
return `${ret}_${part.toLowerCase()}`;
|
|
1196
|
+
});
|
|
1197
|
+
}
|
|
1198
|
+
process.env[`STORM_EXTENSION_${extensionName.toUpperCase()}_${extensionKey.toUpperCase()}`] = extension[key];
|
|
1199
|
+
}
|
|
1200
|
+
}
|
|
1201
|
+
};
|
|
1202
|
+
var setConfigEnv = (config) => {
|
|
1203
|
+
const prefix = "STORM_";
|
|
1204
|
+
if (config.extends) {
|
|
1205
|
+
process.env[`${prefix}EXTENDS`] = Array.isArray(config.extends) ? JSON.stringify(config.extends) : config.extends;
|
|
1206
|
+
}
|
|
1207
|
+
if (config.name) {
|
|
1208
|
+
process.env[`${prefix}NAME`] = config.name;
|
|
1209
|
+
}
|
|
1210
|
+
if (config.namespace) {
|
|
1211
|
+
process.env[`${prefix}NAMESPACE`] = config.namespace;
|
|
1212
|
+
}
|
|
1213
|
+
if (config.owner) {
|
|
1214
|
+
process.env[`${prefix}OWNER`] = config.owner;
|
|
1215
|
+
}
|
|
1216
|
+
if (config.bot) {
|
|
1217
|
+
process.env[`${prefix}BOT_NAME`] = config.bot.name;
|
|
1218
|
+
process.env[`${prefix}BOT_EMAIL`] = config.bot.email;
|
|
1219
|
+
}
|
|
1220
|
+
if (config.error) {
|
|
1221
|
+
process.env[`${prefix}ERROR_CODES_FILE`] = config.error.codesFile;
|
|
1222
|
+
process.env[`${prefix}ERROR_URL`] = config.error.url;
|
|
1223
|
+
}
|
|
1224
|
+
if (config.release) {
|
|
1225
|
+
process.env[`${prefix}RELEASE_BANNER`] = config.release.banner;
|
|
1226
|
+
process.env[`${prefix}RELEASE_HEADER`] = config.release.header;
|
|
1227
|
+
process.env[`${prefix}RELEASE_FOOTER`] = config.release.footer;
|
|
1228
|
+
}
|
|
1229
|
+
if (config.socials) {
|
|
1230
|
+
if (config.socials.twitter) {
|
|
1231
|
+
process.env[`${prefix}SOCIAL_TWITTER`] = config.socials.twitter;
|
|
1232
|
+
}
|
|
1233
|
+
if (config.socials.discord) {
|
|
1234
|
+
process.env[`${prefix}SOCIAL_DISCORD`] = config.socials.discord;
|
|
1235
|
+
}
|
|
1236
|
+
if (config.socials.telegram) {
|
|
1237
|
+
process.env[`${prefix}SOCIAL_TELEGRAM`] = config.socials.telegram;
|
|
1238
|
+
}
|
|
1239
|
+
if (config.socials.slack) {
|
|
1240
|
+
process.env[`${prefix}SOCIAL_SLACK`] = config.socials.slack;
|
|
1241
|
+
}
|
|
1242
|
+
if (config.socials.medium) {
|
|
1243
|
+
process.env[`${prefix}SOCIAL_MEDIUM`] = config.socials.medium;
|
|
1244
|
+
}
|
|
1245
|
+
if (config.socials.github) {
|
|
1246
|
+
process.env[`${prefix}SOCIAL_GITHUB`] = config.socials.github;
|
|
1247
|
+
}
|
|
1248
|
+
}
|
|
1249
|
+
if (config.organization) {
|
|
1250
|
+
if (typeof config.organization === "string") {
|
|
1251
|
+
process.env[`${prefix}ORG`] = config.organization;
|
|
1252
|
+
process.env[`${prefix}ORG_NAME`] = config.organization;
|
|
1253
|
+
process.env[`${prefix}ORGANIZATION`] = config.organization;
|
|
1254
|
+
process.env[`${prefix}ORGANIZATION_NAME`] = config.organization;
|
|
1255
|
+
} else {
|
|
1256
|
+
process.env[`${prefix}ORG`] = config.organization.name;
|
|
1257
|
+
process.env[`${prefix}ORG_NAME`] = config.organization.name;
|
|
1258
|
+
process.env[`${prefix}ORGANIZATION`] = config.organization.name;
|
|
1259
|
+
process.env[`${prefix}ORGANIZATION_NAME`] = config.organization.name;
|
|
1260
|
+
if (config.organization.url) {
|
|
1261
|
+
process.env[`${prefix}ORG_URL`] = config.organization.url;
|
|
1262
|
+
process.env[`${prefix}ORGANIZATION_URL`] = config.organization.url;
|
|
1263
|
+
}
|
|
1264
|
+
if (config.organization.description) {
|
|
1265
|
+
process.env[`${prefix}ORG_DESCRIPTION`] = config.organization.description;
|
|
1266
|
+
process.env[`${prefix}ORGANIZATION_DESCRIPTION`] = config.organization.description;
|
|
1267
|
+
}
|
|
1268
|
+
if (config.organization.logo) {
|
|
1269
|
+
process.env[`${prefix}ORG_LOGO`] = config.organization.logo;
|
|
1270
|
+
process.env[`${prefix}ORGANIZATION_LOGO`] = config.organization.logo;
|
|
1271
|
+
}
|
|
1272
|
+
if (config.organization.icon) {
|
|
1273
|
+
process.env[`${prefix}ORG_ICON`] = config.organization.icon;
|
|
1274
|
+
process.env[`${prefix}ORGANIZATION_ICON`] = config.organization.icon;
|
|
1275
|
+
}
|
|
1276
|
+
}
|
|
1277
|
+
}
|
|
1278
|
+
if (config.packageManager) {
|
|
1279
|
+
process.env[`${prefix}PACKAGE_MANAGER`] = config.packageManager;
|
|
1280
|
+
}
|
|
1281
|
+
if (config.license) {
|
|
1282
|
+
process.env[`${prefix}LICENSE`] = config.license;
|
|
1283
|
+
}
|
|
1284
|
+
if (config.homepage) {
|
|
1285
|
+
process.env[`${prefix}HOMEPAGE`] = config.homepage;
|
|
1286
|
+
}
|
|
1287
|
+
if (config.docs) {
|
|
1288
|
+
process.env[`${prefix}DOCS`] = config.docs;
|
|
1289
|
+
}
|
|
1290
|
+
if (config.portal) {
|
|
1291
|
+
process.env[`${prefix}PORTAL`] = config.portal;
|
|
1292
|
+
}
|
|
1293
|
+
if (config.licensing) {
|
|
1294
|
+
process.env[`${prefix}LICENSING`] = config.licensing;
|
|
1295
|
+
}
|
|
1296
|
+
if (config.contact) {
|
|
1297
|
+
process.env[`${prefix}CONTACT`] = config.contact;
|
|
1298
|
+
}
|
|
1299
|
+
if (config.support) {
|
|
1300
|
+
process.env[`${prefix}SUPPORT`] = config.support;
|
|
1301
|
+
}
|
|
1302
|
+
if (config.timezone) {
|
|
1303
|
+
process.env[`${prefix}TIMEZONE`] = config.timezone;
|
|
1304
|
+
process.env.TZ = config.timezone;
|
|
1305
|
+
process.env.DEFAULT_TIMEZONE = config.timezone;
|
|
1306
|
+
}
|
|
1307
|
+
if (config.locale) {
|
|
1308
|
+
process.env[`${prefix}LOCALE`] = config.locale;
|
|
1309
|
+
process.env.LOCALE = config.locale;
|
|
1310
|
+
process.env.DEFAULT_LOCALE = config.locale;
|
|
1311
|
+
process.env.LANG = config.locale ? `${config.locale.replaceAll("-", "_")}.UTF-8` : "en_US.UTF-8";
|
|
1312
|
+
}
|
|
1313
|
+
if (config.configFile) {
|
|
1314
|
+
process.env[`${prefix}CONFIG_FILE`] = correctPaths(config.configFile);
|
|
1315
|
+
}
|
|
1316
|
+
if (config.workspaceRoot) {
|
|
1317
|
+
process.env[`${prefix}WORKSPACE_ROOT`] = correctPaths(config.workspaceRoot);
|
|
1318
|
+
process.env.NX_WORKSPACE_ROOT = correctPaths(config.workspaceRoot);
|
|
1319
|
+
process.env.NX_WORKSPACE_ROOT_PATH = correctPaths(config.workspaceRoot);
|
|
1320
|
+
}
|
|
1321
|
+
if (config.directories) {
|
|
1322
|
+
if (!config.skipCache && config.directories.cache) {
|
|
1323
|
+
process.env[`${prefix}CACHE_DIR`] = correctPaths(
|
|
1324
|
+
config.directories.cache
|
|
1325
|
+
);
|
|
1326
|
+
process.env[`${prefix}CACHE_DIRECTORY`] = process.env[`${prefix}CACHE_DIR`];
|
|
1327
|
+
}
|
|
1328
|
+
if (config.directories.data) {
|
|
1329
|
+
process.env[`${prefix}DATA_DIR`] = correctPaths(config.directories.data);
|
|
1330
|
+
process.env[`${prefix}DATA_DIRECTORY`] = process.env[`${prefix}DATA_DIR`];
|
|
1331
|
+
}
|
|
1332
|
+
if (config.directories.config) {
|
|
1333
|
+
process.env[`${prefix}CONFIG_DIR`] = correctPaths(
|
|
1334
|
+
config.directories.config
|
|
1335
|
+
);
|
|
1336
|
+
process.env[`${prefix}CONFIG_DIRECTORY`] = process.env[`${prefix}CONFIG_DIR`];
|
|
1337
|
+
}
|
|
1338
|
+
if (config.directories.temp) {
|
|
1339
|
+
process.env[`${prefix}TEMP_DIR`] = correctPaths(config.directories.temp);
|
|
1340
|
+
process.env[`${prefix}TEMP_DIRECTORY`] = process.env[`${prefix}TEMP_DIR`];
|
|
1341
|
+
}
|
|
1342
|
+
if (config.directories.log) {
|
|
1343
|
+
process.env[`${prefix}LOG_DIR`] = correctPaths(config.directories.log);
|
|
1344
|
+
process.env[`${prefix}LOG_DIRECTORY`] = process.env[`${prefix}LOG_DIR`];
|
|
1345
|
+
}
|
|
1346
|
+
if (config.directories.build) {
|
|
1347
|
+
process.env[`${prefix}BUILD_DIR`] = correctPaths(
|
|
1348
|
+
config.directories.build
|
|
1349
|
+
);
|
|
1350
|
+
process.env[`${prefix}BUILD_DIRECTORY`] = process.env[`${prefix}BUILD_DIR`];
|
|
1351
|
+
}
|
|
1352
|
+
}
|
|
1353
|
+
if (config.skipCache !== void 0) {
|
|
1354
|
+
process.env[`${prefix}SKIP_CACHE`] = String(config.skipCache);
|
|
1355
|
+
if (config.skipCache) {
|
|
1356
|
+
process.env.NX_SKIP_NX_CACHE ??= String(config.skipCache);
|
|
1357
|
+
process.env.NX_CACHE_PROJECT_GRAPH ??= String(config.skipCache);
|
|
1358
|
+
}
|
|
1359
|
+
}
|
|
1360
|
+
if (config.mode) {
|
|
1361
|
+
process.env[`${prefix}MODE`] = config.mode;
|
|
1362
|
+
process.env.NODE_ENV = config.mode;
|
|
1363
|
+
process.env.ENVIRONMENT = config.mode;
|
|
1364
|
+
}
|
|
1365
|
+
if (config.colors?.base?.light || config.colors?.base?.dark) {
|
|
1366
|
+
for (const key of Object.keys(config.colors)) {
|
|
1367
|
+
setThemeColorConfigEnv(`${prefix}COLOR_${key}_`, config.colors[key]);
|
|
1368
|
+
}
|
|
1369
|
+
} else {
|
|
1370
|
+
setThemeColorConfigEnv(
|
|
1371
|
+
`${prefix}COLOR_`,
|
|
1372
|
+
config.colors
|
|
1373
|
+
);
|
|
1374
|
+
}
|
|
1375
|
+
if (config.repository) {
|
|
1376
|
+
process.env[`${prefix}REPOSITORY`] = config.repository;
|
|
1377
|
+
}
|
|
1378
|
+
if (config.branch) {
|
|
1379
|
+
process.env[`${prefix}BRANCH`] = config.branch;
|
|
1380
|
+
}
|
|
1381
|
+
if (config.preid) {
|
|
1382
|
+
process.env[`${prefix}PRE_ID`] = String(config.preid);
|
|
1383
|
+
}
|
|
1384
|
+
if (config.registry) {
|
|
1385
|
+
if (config.registry.github) {
|
|
1386
|
+
process.env[`${prefix}REGISTRY_GITHUB`] = String(config.registry.github);
|
|
1387
|
+
}
|
|
1388
|
+
if (config.registry.npm) {
|
|
1389
|
+
process.env[`${prefix}REGISTRY_NPM`] = String(config.registry.npm);
|
|
1390
|
+
}
|
|
1391
|
+
if (config.registry.cargo) {
|
|
1392
|
+
process.env[`${prefix}REGISTRY_CARGO`] = String(config.registry.cargo);
|
|
1393
|
+
}
|
|
1394
|
+
if (config.registry.cyclone) {
|
|
1395
|
+
process.env[`${prefix}REGISTRY_CYCLONE`] = String(
|
|
1396
|
+
config.registry.cyclone
|
|
1397
|
+
);
|
|
1398
|
+
}
|
|
1399
|
+
if (config.registry.container) {
|
|
1400
|
+
process.env[`${prefix}REGISTRY_CONTAINER`] = String(
|
|
1401
|
+
config.registry.container
|
|
1402
|
+
);
|
|
1403
|
+
}
|
|
1404
|
+
}
|
|
1405
|
+
if (config.logLevel) {
|
|
1406
|
+
process.env[`${prefix}LOG_LEVEL`] = String(config.logLevel);
|
|
1407
|
+
process.env.LOG_LEVEL = String(config.logLevel);
|
|
1408
|
+
process.env.NX_VERBOSE_LOGGING = String(
|
|
1409
|
+
getLogLevel(config.logLevel) >= LogLevel.DEBUG ? true : false
|
|
1410
|
+
);
|
|
1411
|
+
process.env.RUST_BACKTRACE = getLogLevel(config.logLevel) >= LogLevel.DEBUG ? "full" : "none";
|
|
1412
|
+
}
|
|
1413
|
+
if (config.skipConfigLogging !== void 0) {
|
|
1414
|
+
process.env[`${prefix}SKIP_CONFIG_LOGGING`] = String(
|
|
1415
|
+
config.skipConfigLogging
|
|
1416
|
+
);
|
|
1417
|
+
}
|
|
1418
|
+
process.env[`${prefix}CONFIG`] = JSON.stringify(config);
|
|
1419
|
+
for (const key of Object.keys(config.extensions ?? {})) {
|
|
1420
|
+
if (config.extensions[key] && Object.keys(config.extensions[key])) {
|
|
1421
|
+
setExtensionEnv(key, config.extensions[key]);
|
|
1422
|
+
}
|
|
1423
|
+
}
|
|
1424
|
+
};
|
|
1425
|
+
var setThemeColorConfigEnv = (prefix, config) => {
|
|
1426
|
+
return config?.light?.brand || config?.dark?.brand ? setMultiThemeColorConfigEnv(prefix, config) : setSingleThemeColorConfigEnv(prefix, config);
|
|
1427
|
+
};
|
|
1428
|
+
var setSingleThemeColorConfigEnv = (prefix, config) => {
|
|
1429
|
+
if (config.dark) {
|
|
1430
|
+
process.env[`${prefix}DARK`] = config.dark;
|
|
1431
|
+
}
|
|
1432
|
+
if (config.light) {
|
|
1433
|
+
process.env[`${prefix}LIGHT`] = config.light;
|
|
1434
|
+
}
|
|
1435
|
+
if (config.brand) {
|
|
1436
|
+
process.env[`${prefix}BRAND`] = config.brand;
|
|
1437
|
+
}
|
|
1438
|
+
if (config.alternate) {
|
|
1439
|
+
process.env[`${prefix}ALTERNATE`] = config.alternate;
|
|
1440
|
+
}
|
|
1441
|
+
if (config.accent) {
|
|
1442
|
+
process.env[`${prefix}ACCENT`] = config.accent;
|
|
1443
|
+
}
|
|
1444
|
+
if (config.link) {
|
|
1445
|
+
process.env[`${prefix}LINK`] = config.link;
|
|
1446
|
+
}
|
|
1447
|
+
if (config.help) {
|
|
1448
|
+
process.env[`${prefix}HELP`] = config.help;
|
|
1449
|
+
}
|
|
1450
|
+
if (config.success) {
|
|
1451
|
+
process.env[`${prefix}SUCCESS`] = config.success;
|
|
1452
|
+
}
|
|
1453
|
+
if (config.info) {
|
|
1454
|
+
process.env[`${prefix}INFO`] = config.info;
|
|
1455
|
+
}
|
|
1456
|
+
if (config.warning) {
|
|
1457
|
+
process.env[`${prefix}WARNING`] = config.warning;
|
|
1458
|
+
}
|
|
1459
|
+
if (config.danger) {
|
|
1460
|
+
process.env[`${prefix}DANGER`] = config.danger;
|
|
1461
|
+
}
|
|
1462
|
+
if (config.fatal) {
|
|
1463
|
+
process.env[`${prefix}FATAL`] = config.fatal;
|
|
1464
|
+
}
|
|
1465
|
+
if (config.positive) {
|
|
1466
|
+
process.env[`${prefix}POSITIVE`] = config.positive;
|
|
1467
|
+
}
|
|
1468
|
+
if (config.negative) {
|
|
1469
|
+
process.env[`${prefix}NEGATIVE`] = config.negative;
|
|
1470
|
+
}
|
|
1471
|
+
};
|
|
1472
|
+
var setMultiThemeColorConfigEnv = (prefix, config) => {
|
|
1473
|
+
return {
|
|
1474
|
+
light: setBaseThemeColorConfigEnv(`${prefix}LIGHT_`, config.light),
|
|
1475
|
+
dark: setBaseThemeColorConfigEnv(`${prefix}DARK_`, config.dark)
|
|
1476
|
+
};
|
|
1477
|
+
};
|
|
1478
|
+
var setBaseThemeColorConfigEnv = (prefix, config) => {
|
|
1479
|
+
if (config.foreground) {
|
|
1480
|
+
process.env[`${prefix}FOREGROUND`] = config.foreground;
|
|
1481
|
+
}
|
|
1482
|
+
if (config.background) {
|
|
1483
|
+
process.env[`${prefix}BACKGROUND`] = config.background;
|
|
1484
|
+
}
|
|
1485
|
+
if (config.brand) {
|
|
1486
|
+
process.env[`${prefix}BRAND`] = config.brand;
|
|
1487
|
+
}
|
|
1488
|
+
if (config.alternate) {
|
|
1489
|
+
process.env[`${prefix}ALTERNATE`] = config.alternate;
|
|
1490
|
+
}
|
|
1491
|
+
if (config.accent) {
|
|
1492
|
+
process.env[`${prefix}ACCENT`] = config.accent;
|
|
1493
|
+
}
|
|
1494
|
+
if (config.link) {
|
|
1495
|
+
process.env[`${prefix}LINK`] = config.link;
|
|
1496
|
+
}
|
|
1497
|
+
if (config.help) {
|
|
1498
|
+
process.env[`${prefix}HELP`] = config.help;
|
|
1499
|
+
}
|
|
1500
|
+
if (config.success) {
|
|
1501
|
+
process.env[`${prefix}SUCCESS`] = config.success;
|
|
1502
|
+
}
|
|
1503
|
+
if (config.info) {
|
|
1504
|
+
process.env[`${prefix}INFO`] = config.info;
|
|
1505
|
+
}
|
|
1506
|
+
if (config.warning) {
|
|
1507
|
+
process.env[`${prefix}WARNING`] = config.warning;
|
|
1508
|
+
}
|
|
1509
|
+
if (config.danger) {
|
|
1510
|
+
process.env[`${prefix}DANGER`] = config.danger;
|
|
1511
|
+
}
|
|
1512
|
+
if (config.fatal) {
|
|
1513
|
+
process.env[`${prefix}FATAL`] = config.fatal;
|
|
1514
|
+
}
|
|
1515
|
+
if (config.positive) {
|
|
1516
|
+
process.env[`${prefix}POSITIVE`] = config.positive;
|
|
1517
|
+
}
|
|
1518
|
+
if (config.negative) {
|
|
1519
|
+
process.env[`${prefix}NEGATIVE`] = config.negative;
|
|
1520
|
+
}
|
|
1521
|
+
};
|
|
1522
|
+
var _static_cache = void 0;
|
|
1523
|
+
var createStormWorkspaceConfig = async (extensionName, schema, workspaceRoot, skipLogs = false, useDefault = true) => {
|
|
1524
|
+
let result;
|
|
1525
|
+
if (!_static_cache?.data || !_static_cache?.timestamp || _static_cache.timestamp < Date.now() - 8e3) {
|
|
1526
|
+
let _workspaceRoot = workspaceRoot;
|
|
1527
|
+
if (!_workspaceRoot) {
|
|
1528
|
+
_workspaceRoot = findWorkspaceRoot();
|
|
1529
|
+
}
|
|
1530
|
+
const configEnv = getConfigEnv();
|
|
1531
|
+
const configFile = await getConfigFile(_workspaceRoot);
|
|
1532
|
+
if (!configFile) {
|
|
1533
|
+
if (!skipLogs) {
|
|
1534
|
+
writeWarning(
|
|
1535
|
+
"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",
|
|
1536
|
+
{ logLevel: "all" }
|
|
1537
|
+
);
|
|
1538
|
+
}
|
|
1539
|
+
if (useDefault === false) {
|
|
1540
|
+
return void 0;
|
|
1541
|
+
}
|
|
1542
|
+
}
|
|
1543
|
+
const defaultConfig = await getPackageJsonConfig(_workspaceRoot);
|
|
1544
|
+
const configInput = defu(
|
|
1545
|
+
configEnv,
|
|
1546
|
+
configFile,
|
|
1547
|
+
defaultConfig
|
|
1548
|
+
);
|
|
1549
|
+
try {
|
|
1550
|
+
result = applyDefaultConfig(
|
|
1551
|
+
await stormWorkspaceConfigSchema.parseAsync(configInput)
|
|
1552
|
+
);
|
|
1553
|
+
result.workspaceRoot ??= _workspaceRoot;
|
|
1554
|
+
} catch (error) {
|
|
1555
|
+
throw new Error(
|
|
1556
|
+
`Failed to parse Storm Workspace configuration${error?.message ? `: ${error.message}` : ""}
|
|
1557
|
+
|
|
1558
|
+
Please ensure your configuration file is valid JSON and matches the expected schema. The current workspace configuration input is: ${formatLogMessage(
|
|
1559
|
+
configInput
|
|
1560
|
+
)}`,
|
|
1561
|
+
{
|
|
1562
|
+
cause: error
|
|
1563
|
+
}
|
|
1564
|
+
);
|
|
1565
|
+
}
|
|
1566
|
+
} else {
|
|
1567
|
+
result = _static_cache.data;
|
|
1568
|
+
}
|
|
1569
|
+
_static_cache = {
|
|
1570
|
+
timestamp: Date.now(),
|
|
1571
|
+
data: result
|
|
1572
|
+
};
|
|
1573
|
+
return result;
|
|
1574
|
+
};
|
|
1575
|
+
var loadStormWorkspaceConfig = async (workspaceRoot, skipLogs = false) => {
|
|
1576
|
+
const config = await createStormWorkspaceConfig(
|
|
1577
|
+
void 0,
|
|
1578
|
+
void 0,
|
|
1579
|
+
workspaceRoot,
|
|
1580
|
+
skipLogs,
|
|
1581
|
+
true
|
|
1582
|
+
);
|
|
1583
|
+
setConfigEnv(config);
|
|
1584
|
+
if (!skipLogs && !config.skipConfigLogging) {
|
|
1585
|
+
writeTrace(
|
|
1586
|
+
`\u2699\uFE0F Using Storm Workspace configuration:
|
|
1587
|
+
${formatLogMessage(config)}`,
|
|
1588
|
+
config
|
|
1589
|
+
);
|
|
1590
|
+
}
|
|
1591
|
+
return config;
|
|
1592
|
+
};
|
|
1593
|
+
|
|
1594
|
+
// ../config-tools/src/get-config.ts
|
|
1595
|
+
var getConfig = (workspaceRoot, skipLogs = false) => {
|
|
1596
|
+
return loadStormWorkspaceConfig(workspaceRoot, skipLogs);
|
|
1597
|
+
};
|
|
1598
|
+
var getWorkspaceConfig = (skipLogs = true, options = {}) => {
|
|
1599
|
+
let workspaceRoot = options.workspaceRoot;
|
|
1600
|
+
if (!workspaceRoot) {
|
|
1601
|
+
workspaceRoot = findWorkspaceRoot(options.cwd);
|
|
1602
|
+
}
|
|
1603
|
+
return getConfig(workspaceRoot, skipLogs);
|
|
1604
|
+
};
|
|
1605
|
+
|
|
1606
|
+
exports.__require = __require;
|
|
1607
|
+
exports.defu = defu;
|
|
1608
|
+
exports.exitWithError = exitWithError;
|
|
1609
|
+
exports.exitWithSuccess = exitWithSuccess;
|
|
1610
|
+
exports.findWorkspaceRootSafe = findWorkspaceRootSafe;
|
|
1611
|
+
exports.getConfig = getConfig;
|
|
1612
|
+
exports.getWorkspaceConfig = getWorkspaceConfig;
|
|
1613
|
+
exports.handleProcess = handleProcess;
|
|
1614
|
+
exports.isVerbose = isVerbose;
|
|
1615
|
+
exports.joinPaths = joinPaths;
|
|
1616
|
+
exports.writeDebug = writeDebug;
|
|
1617
|
+
exports.writeError = writeError;
|
|
1618
|
+
exports.writeFatal = writeFatal;
|
|
1619
|
+
exports.writeInfo = writeInfo;
|
|
1620
|
+
exports.writeSuccess = writeSuccess;
|
|
1621
|
+
exports.writeTrace = writeTrace;
|
|
1622
|
+
exports.writeWarning = writeWarning;
|