@storm-software/config-tools 1.176.13 → 1.176.15

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.
@@ -0,0 +1,358 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
+
3
+ var _chunk4PX5UVANcjs = require('./chunk-4PX5UVAN.cjs');
4
+
5
+
6
+ var _chunkIRCFHYKZcjs = require('./chunk-IRCFHYKZ.cjs');
7
+
8
+
9
+ var _chunkM3REM2FUcjs = require('./chunk-M3REM2FU.cjs');
10
+
11
+ // src/env/set-env.ts
12
+ var setExtensionEnv = (extensionName, extension) => {
13
+ for (const key of Object.keys(_nullishCoalesce(extension, () => ( {})))) {
14
+ if (extension[key]) {
15
+ const result = _nullishCoalesce(_optionalChain([key, 'optionalAccess', _ => _.replace, 'call', _2 => _2(
16
+ /([A-Z])+/g,
17
+ (input) => input ? _optionalChain([input, 'access', _3 => _3[0], 'optionalAccess', _4 => _4.toUpperCase, 'call', _5 => _5()]) + input.slice(1) : ""
18
+ ), 'access', _6 => _6.split, 'call', _7 => _7(/(?=[A-Z])|[.\-\s_]/), 'access', _8 => _8.map, 'call', _9 => _9((x) => x.toLowerCase())]), () => ( []));
19
+ let extensionKey;
20
+ if (result.length === 0) {
21
+ return;
22
+ }
23
+ if (result.length === 1) {
24
+ extensionKey = _nullishCoalesce(_optionalChain([result, 'access', _10 => _10[0], 'optionalAccess', _11 => _11.toUpperCase, 'call', _12 => _12()]), () => ( ""));
25
+ } else {
26
+ extensionKey = result.reduce((ret, part) => {
27
+ return `${ret}_${part.toLowerCase()}`;
28
+ });
29
+ }
30
+ process.env[`STORM_EXTENSION_${extensionName.toUpperCase()}_${extensionKey.toUpperCase()}`] = extension[key];
31
+ }
32
+ }
33
+ };
34
+ var setConfigEnv = (config) => {
35
+ const prefix = "STORM_";
36
+ if (config.extends) {
37
+ process.env[`${prefix}EXTENDS`] = Array.isArray(config.extends) ? JSON.stringify(config.extends) : config.extends;
38
+ }
39
+ if (config.name) {
40
+ process.env[`${prefix}NAME`] = config.name;
41
+ }
42
+ if (config.namespace) {
43
+ process.env[`${prefix}NAMESPACE`] = config.namespace;
44
+ }
45
+ if (config.owner) {
46
+ process.env[`${prefix}OWNER`] = config.owner;
47
+ }
48
+ if (config.bot) {
49
+ process.env[`${prefix}BOT_NAME`] = config.bot.name;
50
+ process.env[`${prefix}BOT_EMAIL`] = config.bot.email;
51
+ }
52
+ if (config.error) {
53
+ process.env[`${prefix}ERROR_CODES_FILE`] = config.error.codesFile;
54
+ process.env[`${prefix}ERROR_URL`] = config.error.url;
55
+ }
56
+ if (config.release) {
57
+ process.env[`${prefix}RELEASE_BANNER`] = config.release.banner;
58
+ process.env[`${prefix}RELEASE_HEADER`] = config.release.header;
59
+ process.env[`${prefix}RELEASE_FOOTER`] = config.release.footer;
60
+ }
61
+ if (config.socials) {
62
+ if (config.socials.twitter) {
63
+ process.env[`${prefix}SOCIAL_TWITTER`] = config.socials.twitter;
64
+ }
65
+ if (config.socials.discord) {
66
+ process.env[`${prefix}SOCIAL_DISCORD`] = config.socials.discord;
67
+ }
68
+ if (config.socials.telegram) {
69
+ process.env[`${prefix}SOCIAL_TELEGRAM`] = config.socials.telegram;
70
+ }
71
+ if (config.socials.slack) {
72
+ process.env[`${prefix}SOCIAL_SLACK`] = config.socials.slack;
73
+ }
74
+ if (config.socials.medium) {
75
+ process.env[`${prefix}SOCIAL_MEDIUM`] = config.socials.medium;
76
+ }
77
+ if (config.socials.github) {
78
+ process.env[`${prefix}SOCIAL_GITHUB`] = config.socials.github;
79
+ }
80
+ }
81
+ if (config.organization) {
82
+ if (typeof config.organization === "string") {
83
+ process.env[`${prefix}ORG`] = config.organization;
84
+ process.env[`${prefix}ORG_NAME`] = config.organization;
85
+ process.env[`${prefix}ORGANIZATION`] = config.organization;
86
+ process.env[`${prefix}ORGANIZATION_NAME`] = config.organization;
87
+ } else {
88
+ process.env[`${prefix}ORG`] = config.organization.name;
89
+ process.env[`${prefix}ORG_NAME`] = config.organization.name;
90
+ process.env[`${prefix}ORGANIZATION`] = config.organization.name;
91
+ process.env[`${prefix}ORGANIZATION_NAME`] = config.organization.name;
92
+ if (config.organization.url) {
93
+ process.env[`${prefix}ORG_URL`] = config.organization.url;
94
+ process.env[`${prefix}ORGANIZATION_URL`] = config.organization.url;
95
+ }
96
+ if (config.organization.description) {
97
+ process.env[`${prefix}ORG_DESCRIPTION`] = config.organization.description;
98
+ process.env[`${prefix}ORGANIZATION_DESCRIPTION`] = config.organization.description;
99
+ }
100
+ if (config.organization.logo) {
101
+ process.env[`${prefix}ORG_LOGO`] = config.organization.logo;
102
+ process.env[`${prefix}ORGANIZATION_LOGO`] = config.organization.logo;
103
+ }
104
+ if (config.organization.icon) {
105
+ process.env[`${prefix}ORG_ICON`] = config.organization.icon;
106
+ process.env[`${prefix}ORGANIZATION_ICON`] = config.organization.icon;
107
+ }
108
+ }
109
+ }
110
+ if (config.packageManager) {
111
+ process.env[`${prefix}PACKAGE_MANAGER`] = config.packageManager;
112
+ }
113
+ if (config.license) {
114
+ process.env[`${prefix}LICENSE`] = config.license;
115
+ }
116
+ if (config.homepage) {
117
+ process.env[`${prefix}HOMEPAGE`] = config.homepage;
118
+ }
119
+ if (config.docs) {
120
+ process.env[`${prefix}DOCS`] = config.docs;
121
+ }
122
+ if (config.portal) {
123
+ process.env[`${prefix}PORTAL`] = config.portal;
124
+ }
125
+ if (config.licensing) {
126
+ process.env[`${prefix}LICENSING`] = config.licensing;
127
+ }
128
+ if (config.contact) {
129
+ process.env[`${prefix}CONTACT`] = config.contact;
130
+ }
131
+ if (config.support) {
132
+ process.env[`${prefix}SUPPORT`] = config.support;
133
+ }
134
+ if (config.timezone) {
135
+ process.env[`${prefix}TIMEZONE`] = config.timezone;
136
+ process.env.TZ = config.timezone;
137
+ process.env.DEFAULT_TIMEZONE = config.timezone;
138
+ }
139
+ if (config.locale) {
140
+ process.env[`${prefix}LOCALE`] = config.locale;
141
+ process.env.LOCALE = config.locale;
142
+ process.env.DEFAULT_LOCALE = config.locale;
143
+ process.env.LANG = config.locale ? `${config.locale.replaceAll("-", "_")}.UTF-8` : "en_US.UTF-8";
144
+ }
145
+ if (config.configFile) {
146
+ process.env[`${prefix}CONFIG_FILE`] = _chunkM3REM2FUcjs.correctPaths.call(void 0, config.configFile);
147
+ }
148
+ if (config.workspaceRoot) {
149
+ process.env[`${prefix}WORKSPACE_ROOT`] = _chunkM3REM2FUcjs.correctPaths.call(void 0, config.workspaceRoot);
150
+ process.env.NX_WORKSPACE_ROOT = _chunkM3REM2FUcjs.correctPaths.call(void 0, config.workspaceRoot);
151
+ process.env.NX_WORKSPACE_ROOT_PATH = _chunkM3REM2FUcjs.correctPaths.call(void 0, config.workspaceRoot);
152
+ }
153
+ if (config.directories) {
154
+ if (!config.skipCache && config.directories.cache) {
155
+ process.env[`${prefix}CACHE_DIR`] = _chunkM3REM2FUcjs.correctPaths.call(void 0,
156
+ config.directories.cache
157
+ );
158
+ process.env[`${prefix}CACHE_DIRECTORY`] = process.env[`${prefix}CACHE_DIR`];
159
+ }
160
+ if (config.directories.data) {
161
+ process.env[`${prefix}DATA_DIR`] = _chunkM3REM2FUcjs.correctPaths.call(void 0, config.directories.data);
162
+ process.env[`${prefix}DATA_DIRECTORY`] = process.env[`${prefix}DATA_DIR`];
163
+ }
164
+ if (config.directories.config) {
165
+ process.env[`${prefix}CONFIG_DIR`] = _chunkM3REM2FUcjs.correctPaths.call(void 0,
166
+ config.directories.config
167
+ );
168
+ process.env[`${prefix}CONFIG_DIRECTORY`] = process.env[`${prefix}CONFIG_DIR`];
169
+ }
170
+ if (config.directories.temp) {
171
+ process.env[`${prefix}TEMP_DIR`] = _chunkM3REM2FUcjs.correctPaths.call(void 0, config.directories.temp);
172
+ process.env[`${prefix}TEMP_DIRECTORY`] = process.env[`${prefix}TEMP_DIR`];
173
+ }
174
+ if (config.directories.log) {
175
+ process.env[`${prefix}LOG_DIR`] = _chunkM3REM2FUcjs.correctPaths.call(void 0, config.directories.log);
176
+ process.env[`${prefix}LOG_DIRECTORY`] = process.env[`${prefix}LOG_DIR`];
177
+ }
178
+ if (config.directories.build) {
179
+ process.env[`${prefix}BUILD_DIR`] = _chunkM3REM2FUcjs.correctPaths.call(void 0,
180
+ config.directories.build
181
+ );
182
+ process.env[`${prefix}BUILD_DIRECTORY`] = process.env[`${prefix}BUILD_DIR`];
183
+ }
184
+ }
185
+ if (config.skipCache !== void 0) {
186
+ process.env[`${prefix}SKIP_CACHE`] = String(config.skipCache);
187
+ if (config.skipCache) {
188
+ process.env.NX_SKIP_NX_CACHE ??= String(config.skipCache);
189
+ process.env.NX_CACHE_PROJECT_GRAPH ??= String(config.skipCache);
190
+ }
191
+ }
192
+ if (config.mode) {
193
+ process.env[`${prefix}MODE`] = config.mode;
194
+ process.env.NODE_ENV = config.mode;
195
+ process.env.ENVIRONMENT = config.mode;
196
+ }
197
+ if (_optionalChain([config, 'access', _13 => _13.colors, 'optionalAccess', _14 => _14.base, 'optionalAccess', _15 => _15.light]) || _optionalChain([config, 'access', _16 => _16.colors, 'optionalAccess', _17 => _17.base, 'optionalAccess', _18 => _18.dark])) {
198
+ for (const key of Object.keys(config.colors)) {
199
+ setThemeColorConfigEnv(`${prefix}COLOR_${key}_`, config.colors[key]);
200
+ }
201
+ } else {
202
+ setThemeColorConfigEnv(
203
+ `${prefix}COLOR_`,
204
+ config.colors
205
+ );
206
+ }
207
+ if (config.repository) {
208
+ process.env[`${prefix}REPOSITORY`] = config.repository;
209
+ }
210
+ if (config.branch) {
211
+ process.env[`${prefix}BRANCH`] = config.branch;
212
+ }
213
+ if (config.preid) {
214
+ process.env[`${prefix}PRE_ID`] = String(config.preid);
215
+ }
216
+ if (config.registry) {
217
+ if (config.registry.github) {
218
+ process.env[`${prefix}REGISTRY_GITHUB`] = String(config.registry.github);
219
+ }
220
+ if (config.registry.npm) {
221
+ process.env[`${prefix}REGISTRY_NPM`] = String(config.registry.npm);
222
+ }
223
+ if (config.registry.cargo) {
224
+ process.env[`${prefix}REGISTRY_CARGO`] = String(config.registry.cargo);
225
+ }
226
+ if (config.registry.cyclone) {
227
+ process.env[`${prefix}REGISTRY_CYCLONE`] = String(
228
+ config.registry.cyclone
229
+ );
230
+ }
231
+ if (config.registry.container) {
232
+ process.env[`${prefix}REGISTRY_CONTAINER`] = String(
233
+ config.registry.container
234
+ );
235
+ }
236
+ }
237
+ if (config.logLevel) {
238
+ process.env[`${prefix}LOG_LEVEL`] = String(config.logLevel);
239
+ process.env.LOG_LEVEL = String(config.logLevel);
240
+ process.env.NX_VERBOSE_LOGGING = String(
241
+ _chunk4PX5UVANcjs.getLogLevel.call(void 0, config.logLevel) >= _chunkIRCFHYKZcjs.LogLevel.DEBUG ? true : false
242
+ );
243
+ process.env.RUST_BACKTRACE = _chunk4PX5UVANcjs.getLogLevel.call(void 0, config.logLevel) >= _chunkIRCFHYKZcjs.LogLevel.DEBUG ? "full" : "none";
244
+ }
245
+ if (config.skipConfigLogging !== void 0) {
246
+ process.env[`${prefix}SKIP_CONFIG_LOGGING`] = String(
247
+ config.skipConfigLogging
248
+ );
249
+ }
250
+ process.env[`${prefix}CONFIG`] = JSON.stringify(config);
251
+ for (const key of Object.keys(_nullishCoalesce(config.extensions, () => ( {})))) {
252
+ if (config.extensions[key] && Object.keys(config.extensions[key])) {
253
+ setExtensionEnv(key, config.extensions[key]);
254
+ }
255
+ }
256
+ };
257
+ var setThemeColorConfigEnv = (prefix, config) => {
258
+ return _optionalChain([config, 'optionalAccess', _19 => _19.light, 'optionalAccess', _20 => _20.brand]) || _optionalChain([config, 'optionalAccess', _21 => _21.dark, 'optionalAccess', _22 => _22.brand]) ? setMultiThemeColorConfigEnv(prefix, config) : setSingleThemeColorConfigEnv(prefix, config);
259
+ };
260
+ var setSingleThemeColorConfigEnv = (prefix, config) => {
261
+ if (config.dark) {
262
+ process.env[`${prefix}DARK`] = config.dark;
263
+ }
264
+ if (config.light) {
265
+ process.env[`${prefix}LIGHT`] = config.light;
266
+ }
267
+ if (config.brand) {
268
+ process.env[`${prefix}BRAND`] = config.brand;
269
+ }
270
+ if (config.alternate) {
271
+ process.env[`${prefix}ALTERNATE`] = config.alternate;
272
+ }
273
+ if (config.accent) {
274
+ process.env[`${prefix}ACCENT`] = config.accent;
275
+ }
276
+ if (config.link) {
277
+ process.env[`${prefix}LINK`] = config.link;
278
+ }
279
+ if (config.help) {
280
+ process.env[`${prefix}HELP`] = config.help;
281
+ }
282
+ if (config.success) {
283
+ process.env[`${prefix}SUCCESS`] = config.success;
284
+ }
285
+ if (config.info) {
286
+ process.env[`${prefix}INFO`] = config.info;
287
+ }
288
+ if (config.warning) {
289
+ process.env[`${prefix}WARNING`] = config.warning;
290
+ }
291
+ if (config.danger) {
292
+ process.env[`${prefix}DANGER`] = config.danger;
293
+ }
294
+ if (config.fatal) {
295
+ process.env[`${prefix}FATAL`] = config.fatal;
296
+ }
297
+ if (config.positive) {
298
+ process.env[`${prefix}POSITIVE`] = config.positive;
299
+ }
300
+ if (config.negative) {
301
+ process.env[`${prefix}NEGATIVE`] = config.negative;
302
+ }
303
+ };
304
+ var setMultiThemeColorConfigEnv = (prefix, config) => {
305
+ return {
306
+ light: setBaseThemeColorConfigEnv(`${prefix}LIGHT_`, config.light),
307
+ dark: setBaseThemeColorConfigEnv(`${prefix}DARK_`, config.dark)
308
+ };
309
+ };
310
+ var setBaseThemeColorConfigEnv = (prefix, config) => {
311
+ if (config.foreground) {
312
+ process.env[`${prefix}FOREGROUND`] = config.foreground;
313
+ }
314
+ if (config.background) {
315
+ process.env[`${prefix}BACKGROUND`] = config.background;
316
+ }
317
+ if (config.brand) {
318
+ process.env[`${prefix}BRAND`] = config.brand;
319
+ }
320
+ if (config.alternate) {
321
+ process.env[`${prefix}ALTERNATE`] = config.alternate;
322
+ }
323
+ if (config.accent) {
324
+ process.env[`${prefix}ACCENT`] = config.accent;
325
+ }
326
+ if (config.link) {
327
+ process.env[`${prefix}LINK`] = config.link;
328
+ }
329
+ if (config.help) {
330
+ process.env[`${prefix}HELP`] = config.help;
331
+ }
332
+ if (config.success) {
333
+ process.env[`${prefix}SUCCESS`] = config.success;
334
+ }
335
+ if (config.info) {
336
+ process.env[`${prefix}INFO`] = config.info;
337
+ }
338
+ if (config.warning) {
339
+ process.env[`${prefix}WARNING`] = config.warning;
340
+ }
341
+ if (config.danger) {
342
+ process.env[`${prefix}DANGER`] = config.danger;
343
+ }
344
+ if (config.fatal) {
345
+ process.env[`${prefix}FATAL`] = config.fatal;
346
+ }
347
+ if (config.positive) {
348
+ process.env[`${prefix}POSITIVE`] = config.positive;
349
+ }
350
+ if (config.negative) {
351
+ process.env[`${prefix}NEGATIVE`] = config.negative;
352
+ }
353
+ };
354
+
355
+
356
+
357
+
358
+ exports.setExtensionEnv = setExtensionEnv; exports.setConfigEnv = setConfigEnv;
@@ -0,0 +1,39 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
+
3
+ var _chunkXGOYEDHPcjs = require('./chunk-XGOYEDHP.cjs');
4
+
5
+ // src/utilities/colors.ts
6
+ function getColorConfig(config) {
7
+ if (!_optionalChain([config, 'optionalAccess', _ => _.colors]) || typeof config.colors !== "object" || !config.colors["dark"] && (!config.colors["base"] || typeof config.colors !== "object" || !_optionalChain([config, 'access', _2 => _2.colors, 'access', _3 => _3["base"], 'optionalAccess', _4 => _4["dark"]]))) {
8
+ return _chunkXGOYEDHPcjs.DEFAULT_COLOR_CONFIG;
9
+ }
10
+ if (config.colors["base"]) {
11
+ if (typeof config.colors["base"]["dark"] === "object") {
12
+ return config.colors["base"]["dark"];
13
+ } else if (config.colors["base"]["dark"] === "string") {
14
+ return config.colors["base"];
15
+ }
16
+ }
17
+ if (typeof config.colors["dark"] === "object") {
18
+ return config.colors["dark"];
19
+ }
20
+ return _nullishCoalesce(config.colors, () => ( _chunkXGOYEDHPcjs.DEFAULT_COLOR_CONFIG));
21
+ }
22
+ function getColor(key, config) {
23
+ const colors = getColorConfig(config);
24
+ const result = (typeof colors["dark"] === "object" ? colors["dark"][key] : colors[key]) || _chunkXGOYEDHPcjs.DEFAULT_COLOR_CONFIG["dark"][key] || _chunkXGOYEDHPcjs.DEFAULT_COLOR_CONFIG[key];
25
+ if (result) {
26
+ return result;
27
+ }
28
+ if (key === "link") {
29
+ return getColor("info", config);
30
+ } else if (key === "fatal") {
31
+ return getColor("danger", config);
32
+ }
33
+ return getColor("brand", config);
34
+ }
35
+
36
+
37
+
38
+
39
+ exports.getColorConfig = getColorConfig; exports.getColor = getColor;
@@ -0,0 +1,131 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
+
3
+ var _chunkZAEOJ4NDcjs = require('./chunk-ZAEOJ4ND.cjs');
4
+
5
+
6
+ var _chunkM3REM2FUcjs = require('./chunk-M3REM2FU.cjs');
7
+
8
+ // src/utilities/get-default-config.ts
9
+
10
+
11
+
12
+ var _config = require('@storm-software/config');
13
+ var _fs = require('fs');
14
+ var _promises = require('fs/promises');
15
+ var _path = require('path');
16
+ var DEFAULT_COLOR_CONFIG = {
17
+ light: {
18
+ background: "#fafafa",
19
+ foreground: "#1d1e22",
20
+ brand: "#1fb2a6",
21
+ alternate: "#db2777",
22
+ help: "#5C4EE5",
23
+ success: "#087f5b",
24
+ info: "#0550ae",
25
+ warning: "#e3b341",
26
+ danger: "#D8314A",
27
+ positive: "#22c55e",
28
+ negative: "#dc2626"
29
+ },
30
+ dark: {
31
+ background: "#1d1e22",
32
+ foreground: "#cbd5e1",
33
+ brand: "#2dd4bf",
34
+ alternate: "#db2777",
35
+ help: "#818cf8",
36
+ success: "#10b981",
37
+ info: "#58a6ff",
38
+ warning: "#f3d371",
39
+ danger: "#D8314A",
40
+ positive: "#22c55e",
41
+ negative: "#dc2626"
42
+ }
43
+ };
44
+ async function getPackageJsonConfig(root) {
45
+ let license = _config.STORM_DEFAULT_LICENSE;
46
+ let homepage = void 0;
47
+ let support = void 0;
48
+ let name = void 0;
49
+ let namespace = void 0;
50
+ let repository = void 0;
51
+ const workspaceRoot = _chunkZAEOJ4NDcjs.findWorkspaceRoot.call(void 0, root);
52
+ if (_fs.existsSync.call(void 0, _path.join.call(void 0, workspaceRoot, "package.json"))) {
53
+ const file = await _promises.readFile.call(void 0,
54
+ _chunkM3REM2FUcjs.joinPaths.call(void 0, workspaceRoot, "package.json"),
55
+ "utf8"
56
+ );
57
+ if (file) {
58
+ const packageJson = JSON.parse(file);
59
+ if (packageJson.name) {
60
+ name = packageJson.name;
61
+ }
62
+ if (packageJson.namespace) {
63
+ namespace = packageJson.namespace;
64
+ }
65
+ if (packageJson.repository) {
66
+ if (typeof packageJson.repository === "string") {
67
+ repository = packageJson.repository;
68
+ } else if (packageJson.repository.url) {
69
+ repository = packageJson.repository.url;
70
+ }
71
+ }
72
+ if (packageJson.license) {
73
+ license = packageJson.license;
74
+ }
75
+ if (packageJson.homepage) {
76
+ homepage = packageJson.homepage;
77
+ }
78
+ if (packageJson.bugs) {
79
+ if (typeof packageJson.bugs === "string") {
80
+ support = packageJson.bugs;
81
+ } else if (packageJson.bugs.url) {
82
+ support = packageJson.bugs.url;
83
+ }
84
+ }
85
+ }
86
+ }
87
+ return {
88
+ workspaceRoot,
89
+ name,
90
+ namespace,
91
+ repository,
92
+ license,
93
+ homepage,
94
+ support
95
+ };
96
+ }
97
+ function applyDefaultConfig(config) {
98
+ if (!config.support && config.contact) {
99
+ config.support = config.contact;
100
+ }
101
+ if (!config.contact && config.support) {
102
+ config.contact = config.support;
103
+ }
104
+ if (config.homepage) {
105
+ if (!config.docs) {
106
+ config.docs = `${config.homepage}/docs`;
107
+ }
108
+ if (!config.license) {
109
+ config.license = `${config.homepage}/license`;
110
+ }
111
+ if (!config.support) {
112
+ config.support = `${config.homepage}/support`;
113
+ }
114
+ if (!config.contact) {
115
+ config.contact = `${config.homepage}/contact`;
116
+ }
117
+ if (!_optionalChain([config, 'access', _ => _.error, 'optionalAccess', _2 => _2.codesFile]) || !_optionalChain([config, 'optionalAccess', _3 => _3.error, 'optionalAccess', _4 => _4.url])) {
118
+ config.error ??= { codesFile: _config.STORM_DEFAULT_ERROR_CODES_FILE };
119
+ if (config.homepage) {
120
+ config.error.url ??= `${config.homepage}/errors`;
121
+ }
122
+ }
123
+ }
124
+ return config;
125
+ }
126
+
127
+
128
+
129
+
130
+
131
+ exports.DEFAULT_COLOR_CONFIG = DEFAULT_COLOR_CONFIG; exports.getPackageJsonConfig = getPackageJsonConfig; exports.applyDefaultConfig = applyDefaultConfig;
@@ -0,0 +1,55 @@
1
+ import {
2
+ writeError,
3
+ writeFatal,
4
+ writeSuccess,
5
+ writeTrace
6
+ } from "./chunk-PQFFXKJC.js";
7
+
8
+ // src/utilities/process-handler.ts
9
+ var exitWithError = (config) => {
10
+ writeFatal("Exiting script with an error status...", config);
11
+ process.exit(1);
12
+ };
13
+ var exitWithSuccess = (config) => {
14
+ writeSuccess("Script completed successfully. Exiting...", config);
15
+ process.exit(0);
16
+ };
17
+ var handleProcess = (config) => {
18
+ writeTrace(
19
+ `Using the following arguments to process the script: ${process.argv.join(", ")}`,
20
+ config
21
+ );
22
+ process.on("unhandledRejection", (error) => {
23
+ writeError(
24
+ `An Unhandled Rejection occurred while running the program: ${error}`,
25
+ config
26
+ );
27
+ exitWithError(config);
28
+ });
29
+ process.on("uncaughtException", (error) => {
30
+ writeError(
31
+ `An Uncaught Exception occurred while running the program: ${error.message}
32
+ Stacktrace: ${error.stack}`,
33
+ config
34
+ );
35
+ exitWithError(config);
36
+ });
37
+ process.on("SIGTERM", (signal) => {
38
+ writeError(`The program terminated with signal code: ${signal}`, config);
39
+ exitWithError(config);
40
+ });
41
+ process.on("SIGINT", (signal) => {
42
+ writeError(`The program terminated with signal code: ${signal}`, config);
43
+ exitWithError(config);
44
+ });
45
+ process.on("SIGHUP", (signal) => {
46
+ writeError(`The program terminated with signal code: ${signal}`, config);
47
+ exitWithError(config);
48
+ });
49
+ };
50
+
51
+ export {
52
+ exitWithError,
53
+ exitWithSuccess,
54
+ handleProcess
55
+ };
@@ -0,0 +1,82 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
2
+
3
+ var _chunkM3REM2FUcjs = require('./chunk-M3REM2FU.cjs');
4
+
5
+
6
+ var _chunkN3UX6L7Xcjs = require('./chunk-N3UX6L7X.cjs');
7
+
8
+ // src/utilities/find-workspace-root.ts
9
+ var rootFiles = [
10
+ "storm-workspace.json",
11
+ "storm-workspace.json",
12
+ "storm-workspace.yaml",
13
+ "storm-workspace.yml",
14
+ "storm-workspace.js",
15
+ "storm-workspace.ts",
16
+ ".storm-workspace.json",
17
+ ".storm-workspace.yaml",
18
+ ".storm-workspace.yml",
19
+ ".storm-workspace.js",
20
+ ".storm-workspace.ts",
21
+ "lerna.json",
22
+ "nx.json",
23
+ "turbo.json",
24
+ "npm-workspace.json",
25
+ "yarn-workspace.json",
26
+ "pnpm-workspace.json",
27
+ "npm-workspace.yaml",
28
+ "yarn-workspace.yaml",
29
+ "pnpm-workspace.yaml",
30
+ "npm-workspace.yml",
31
+ "yarn-workspace.yml",
32
+ "pnpm-workspace.yml",
33
+ "npm-lock.json",
34
+ "yarn-lock.json",
35
+ "pnpm-lock.json",
36
+ "npm-lock.yaml",
37
+ "yarn-lock.yaml",
38
+ "pnpm-lock.yaml",
39
+ "npm-lock.yml",
40
+ "yarn-lock.yml",
41
+ "pnpm-lock.yml",
42
+ "bun.lockb"
43
+ ];
44
+ var rootDirectories = [
45
+ ".storm-workspace",
46
+ ".nx",
47
+ ".github",
48
+ ".vscode",
49
+ ".verdaccio"
50
+ ];
51
+ function findWorkspaceRootSafe(pathInsideMonorepo) {
52
+ if (process.env.STORM_WORKSPACE_ROOT || process.env.NX_WORKSPACE_ROOT_PATH) {
53
+ return _chunkM3REM2FUcjs.correctPaths.call(void 0,
54
+ _nullishCoalesce(process.env.STORM_WORKSPACE_ROOT, () => ( process.env.NX_WORKSPACE_ROOT_PATH))
55
+ );
56
+ }
57
+ return _chunkM3REM2FUcjs.correctPaths.call(void 0,
58
+ _chunkN3UX6L7Xcjs.findFolderUp.call(void 0,
59
+ _nullishCoalesce(pathInsideMonorepo, () => ( process.cwd())),
60
+ rootFiles,
61
+ rootDirectories
62
+ )
63
+ );
64
+ }
65
+ function findWorkspaceRoot(pathInsideMonorepo) {
66
+ const result = findWorkspaceRootSafe(pathInsideMonorepo);
67
+ if (!result) {
68
+ throw new Error(
69
+ `Cannot find workspace root upwards from known path. Files search list includes:
70
+ ${rootFiles.join(
71
+ "\n"
72
+ )}
73
+ Path: ${pathInsideMonorepo ? pathInsideMonorepo : process.cwd()}`
74
+ );
75
+ }
76
+ return result;
77
+ }
78
+
79
+
80
+
81
+
82
+ exports.findWorkspaceRootSafe = findWorkspaceRootSafe; exports.findWorkspaceRoot = findWorkspaceRoot;