@storm-software/config-tools 1.163.25 → 1.163.27
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 -2
- package/bin/config.cjs +298 -205
- package/bin/config.js +308 -208
- package/dist/chunk-42TCRG4H.js +38 -0
- package/dist/{chunk-E5AUC34G.cjs → chunk-4JREL2GQ.cjs} +31 -43
- package/dist/{chunk-NKHVLY3K.js → chunk-4XRV4CVP.js} +6 -9
- package/dist/{chunk-GBY7M6XX.cjs → chunk-56NGBR4S.cjs} +51 -40
- package/dist/{chunk-2HSUVM5I.js → chunk-64DXC5WM.js} +4 -8
- package/dist/{chunk-7HCO3WBN.cjs → chunk-7BZWQZUV.cjs} +6 -9
- package/dist/{chunk-4AM2CTWO.cjs → chunk-7HCUD67D.cjs} +34 -21
- package/dist/{chunk-DLO4KL2Z.cjs → chunk-7SIKKF62.cjs} +78 -61
- package/dist/{chunk-6LIPH2JW.cjs → chunk-AEZINHEA.cjs} +19 -12
- package/dist/{chunk-WZSBZDAU.cjs → chunk-AQ2NOVJF.cjs} +32 -16
- package/dist/{chunk-JT77N7TT.js → chunk-BAWQ37NK.js} +13 -12
- package/dist/chunk-BJ2W75ZO.cjs +135 -0
- package/dist/{chunk-SFDIRWJY.js → chunk-ELNIDXR5.js} +20 -14
- package/dist/chunk-FCWF3I34.cjs +55 -0
- package/dist/{chunk-D6E6GZD2.js → chunk-FRR2ZRWD.js} +30 -42
- package/dist/{chunk-YSSMM2WQ.cjs → chunk-GIXUQACB.cjs} +11 -8
- package/dist/chunk-H2GU4JMJ.cjs +40 -0
- package/dist/{chunk-2LQBYJT5.cjs → chunk-H425P7G5.cjs} +54 -35
- package/dist/{chunk-CERDEPKZ.js → chunk-IETV2DPL.js} +32 -16
- package/dist/{chunk-ZFRJR2OY.cjs → chunk-J2LCTMCI.cjs} +11 -15
- package/dist/{chunk-2V4WR4HU.js → chunk-JX5NLB4S.js} +12 -9
- package/dist/chunk-NS5PJ2RM.cjs +32 -0
- package/dist/{chunk-FVYBJYYR.js → chunk-OJP4XIBV.js} +2 -5
- package/dist/{chunk-OSY5X2AI.cjs → chunk-PLLCZVZO.cjs} +1 -6
- package/dist/{chunk-KBPYCUVG.cjs → chunk-PSHJQ2NP.cjs} +2 -5
- package/dist/{chunk-OB4WNEXN.js → chunk-QDJMKPQQ.js} +2 -6
- package/dist/{chunk-XDS6C7HI.js → chunk-QJUAU656.js} +68 -51
- package/dist/chunk-QNDF3RQL.cjs +8 -0
- package/dist/{chunk-AWCU6JTS.js → chunk-R6A4VPC4.js} +0 -5
- package/dist/{chunk-G2XISPLW.cjs → chunk-RKGXITNB.cjs} +7 -8
- package/dist/{chunk-QRKAMMHF.js → chunk-RSKVXFI5.js} +45 -34
- package/dist/{chunk-NQFXB5CV.js → chunk-RWBPUJIZ.js} +6 -7
- package/dist/chunk-T3MUE32G.js +32 -0
- package/dist/{chunk-VULQ4N4Z.cjs → chunk-T4ZMKMEG.cjs} +21 -8
- package/dist/{chunk-K6PUXRK3.js → chunk-VLWSWYG7.js} +19 -12
- package/dist/{chunk-BC2QD5QZ.js → chunk-WITKEKZ5.js} +50 -33
- package/dist/chunk-XEZGYUS2.js +8 -0
- package/dist/{chunk-GYFE7GKG.js → chunk-XO6ICAFH.js} +32 -19
- package/dist/{chunk-ETZGNPAA.js → chunk-XS7LVKAI.js} +46 -27
- package/dist/{chunk-CHA6766N.cjs → chunk-ZGLOKOL3.cjs} +5 -9
- package/dist/config-file/get-config-file.cjs +16 -17
- package/dist/config-file/get-config-file.js +15 -16
- package/dist/config-file/index.cjs +16 -17
- package/dist/config-file/index.js +15 -16
- package/dist/create-storm-config.cjs +19 -20
- package/dist/create-storm-config.js +18 -19
- package/dist/env/get-env.cjs +4 -5
- package/dist/env/get-env.js +3 -4
- package/dist/env/index.cjs +5 -6
- package/dist/env/index.js +4 -5
- package/dist/env/set-env.cjs +4 -5
- package/dist/env/set-env.js +3 -4
- package/dist/get-config.cjs +20 -21
- package/dist/get-config.js +19 -20
- package/dist/index.cjs +23 -22
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +22 -21
- package/dist/logger/chalk.cjs +2 -3
- package/dist/logger/chalk.js +1 -2
- package/dist/logger/console-icons.cjs +3 -4
- package/dist/logger/console-icons.js +2 -3
- package/dist/logger/console.cjs +11 -12
- package/dist/logger/console.js +10 -11
- package/dist/logger/create-logger.cjs +12 -13
- package/dist/logger/create-logger.js +11 -12
- package/dist/logger/format-timestamp.cjs +2 -3
- package/dist/logger/format-timestamp.js +1 -2
- package/dist/logger/get-log-level.cjs +2 -3
- package/dist/logger/get-log-level.js +1 -2
- package/dist/logger/index.cjs +12 -13
- package/dist/logger/index.js +11 -12
- package/dist/logger/is-unicode-supported.cjs +2 -3
- package/dist/logger/is-unicode-supported.js +1 -2
- package/dist/types.cjs +0 -1
- package/dist/types.js +0 -1
- package/dist/utilities/apply-workspace-tokens.cjs +5 -6
- package/dist/utilities/apply-workspace-tokens.js +4 -5
- package/dist/utilities/correct-paths.cjs +2 -3
- package/dist/utilities/correct-paths.js +1 -2
- package/dist/utilities/file-path-utils.cjs +5 -3
- package/dist/utilities/file-path-utils.d.cts +42 -2
- package/dist/utilities/file-path-utils.d.ts +42 -2
- package/dist/utilities/file-path-utils.js +4 -2
- package/dist/utilities/find-up.cjs +2 -3
- package/dist/utilities/find-up.js +1 -2
- package/dist/utilities/find-workspace-root.cjs +4 -5
- package/dist/utilities/find-workspace-root.js +3 -4
- package/dist/utilities/get-default-config.cjs +5 -6
- package/dist/utilities/get-default-config.js +4 -5
- package/dist/utilities/index.cjs +17 -16
- package/dist/utilities/index.d.cts +1 -1
- package/dist/utilities/index.d.ts +1 -1
- package/dist/utilities/index.js +16 -15
- package/dist/utilities/process-handler.cjs +12 -13
- package/dist/utilities/process-handler.js +11 -12
- package/dist/utilities/run.cjs +2 -3
- package/dist/utilities/run.js +1 -2
- package/package.json +1 -1
- package/dist/chunk-75PQRIWX.js +0 -25
- package/dist/chunk-7DEX73IB.js +0 -36
- package/dist/chunk-HFKBN5GE.cjs +0 -118
- package/dist/chunk-IGUYFX5B.cjs +0 -12
- package/dist/chunk-SHUYVCID.js +0 -6
- package/dist/chunk-SIU3CSEY.cjs +0 -49
- package/dist/chunk-TKQCRNGC.js +0 -12
- package/dist/chunk-USNT2KNT.cjs +0 -6
- package/dist/chunk-VICC23NV.cjs +0 -36
- package/dist/chunk-VKTQOXWO.cjs +0 -39
package/bin/config.cjs
CHANGED
|
@@ -5,7 +5,6 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
9
8
|
var __export = (target, all) => {
|
|
10
9
|
for (var name in all)
|
|
11
10
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -83,11 +82,10 @@ function normalizeWindowsPath(input = "") {
|
|
|
83
82
|
}
|
|
84
83
|
return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
|
|
85
84
|
}
|
|
86
|
-
__name(normalizeWindowsPath, "normalizeWindowsPath");
|
|
87
85
|
var _UNC_REGEX = /^[/\\]{2}/;
|
|
88
86
|
var _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
|
|
89
87
|
var _DRIVE_LETTER_RE = /^[A-Za-z]:$/;
|
|
90
|
-
var correctPaths =
|
|
88
|
+
var correctPaths = function(path) {
|
|
91
89
|
if (!path || path.length === 0) {
|
|
92
90
|
return ".";
|
|
93
91
|
}
|
|
@@ -115,8 +113,8 @@ var correctPaths = /* @__PURE__ */ __name(function(path) {
|
|
|
115
113
|
return `//${path}`;
|
|
116
114
|
}
|
|
117
115
|
return isPathAbsolute && !isAbsolute(path) ? `/${path}` : path;
|
|
118
|
-
}
|
|
119
|
-
var joinPaths =
|
|
116
|
+
};
|
|
117
|
+
var joinPaths = function(...segments) {
|
|
120
118
|
let path = "";
|
|
121
119
|
for (const seg of segments) {
|
|
122
120
|
if (!seg) {
|
|
@@ -136,7 +134,7 @@ var joinPaths = /* @__PURE__ */ __name(function(...segments) {
|
|
|
136
134
|
}
|
|
137
135
|
}
|
|
138
136
|
return correctPaths(path);
|
|
139
|
-
}
|
|
137
|
+
};
|
|
140
138
|
function normalizeString(path, allowAboveRoot) {
|
|
141
139
|
let res = "";
|
|
142
140
|
let lastSegmentLength = 0;
|
|
@@ -197,10 +195,9 @@ function normalizeString(path, allowAboveRoot) {
|
|
|
197
195
|
}
|
|
198
196
|
return res;
|
|
199
197
|
}
|
|
200
|
-
|
|
201
|
-
var isAbsolute = /* @__PURE__ */ __name(function(p) {
|
|
198
|
+
var isAbsolute = function(p) {
|
|
202
199
|
return _IS_ABSOLUTE_RE.test(p);
|
|
203
|
-
}
|
|
200
|
+
};
|
|
204
201
|
|
|
205
202
|
// src/utilities/find-up.ts
|
|
206
203
|
var import_node_fs = require("fs");
|
|
@@ -209,10 +206,14 @@ var MAX_PATH_SEARCH_DEPTH = 30;
|
|
|
209
206
|
var depth = 0;
|
|
210
207
|
function findFolderUp(startPath, endFileNames = [], endDirectoryNames = []) {
|
|
211
208
|
const _startPath = startPath ?? process.cwd();
|
|
212
|
-
if (endDirectoryNames.some(
|
|
209
|
+
if (endDirectoryNames.some(
|
|
210
|
+
(endDirName) => (0, import_node_fs.existsSync)((0, import_node_path.join)(_startPath, endDirName))
|
|
211
|
+
)) {
|
|
213
212
|
return _startPath;
|
|
214
213
|
}
|
|
215
|
-
if (endFileNames.some(
|
|
214
|
+
if (endFileNames.some(
|
|
215
|
+
(endFileName) => (0, import_node_fs.existsSync)((0, import_node_path.join)(_startPath, endFileName))
|
|
216
|
+
)) {
|
|
216
217
|
return _startPath;
|
|
217
218
|
}
|
|
218
219
|
if (_startPath !== "/" && depth++ < MAX_PATH_SEARCH_DEPTH) {
|
|
@@ -221,7 +222,6 @@ function findFolderUp(startPath, endFileNames = [], endDirectoryNames = []) {
|
|
|
221
222
|
}
|
|
222
223
|
return void 0;
|
|
223
224
|
}
|
|
224
|
-
__name(findFolderUp, "findFolderUp");
|
|
225
225
|
|
|
226
226
|
// src/utilities/find-workspace-root.ts
|
|
227
227
|
var rootFiles = [
|
|
@@ -268,21 +268,31 @@ var rootDirectories = [
|
|
|
268
268
|
];
|
|
269
269
|
function findWorkspaceRootSafe(pathInsideMonorepo) {
|
|
270
270
|
if (process.env.STORM_WORKSPACE_ROOT || process.env.NX_WORKSPACE_ROOT_PATH) {
|
|
271
|
-
return correctPaths(
|
|
272
|
-
|
|
273
|
-
|
|
271
|
+
return correctPaths(
|
|
272
|
+
process.env.STORM_WORKSPACE_ROOT ?? process.env.NX_WORKSPACE_ROOT_PATH
|
|
273
|
+
);
|
|
274
|
+
}
|
|
275
|
+
return correctPaths(
|
|
276
|
+
findFolderUp(
|
|
277
|
+
pathInsideMonorepo ?? process.cwd(),
|
|
278
|
+
rootFiles,
|
|
279
|
+
rootDirectories
|
|
280
|
+
)
|
|
281
|
+
);
|
|
274
282
|
}
|
|
275
|
-
__name(findWorkspaceRootSafe, "findWorkspaceRootSafe");
|
|
276
283
|
function findWorkspaceRoot(pathInsideMonorepo) {
|
|
277
284
|
const result = findWorkspaceRootSafe(pathInsideMonorepo);
|
|
278
285
|
if (!result) {
|
|
279
|
-
throw new Error(
|
|
280
|
-
|
|
281
|
-
|
|
286
|
+
throw new Error(
|
|
287
|
+
`Cannot find workspace root upwards from known path. Files search list includes:
|
|
288
|
+
${rootFiles.join(
|
|
289
|
+
"\n"
|
|
290
|
+
)}
|
|
291
|
+
Path: ${pathInsideMonorepo ? pathInsideMonorepo : process.cwd()}`
|
|
292
|
+
);
|
|
282
293
|
}
|
|
283
294
|
return result;
|
|
284
295
|
}
|
|
285
|
-
__name(findWorkspaceRoot, "findWorkspaceRoot");
|
|
286
296
|
|
|
287
297
|
// src/utilities/get-default-config.ts
|
|
288
298
|
var DEFAULT_COLOR_CONFIG = {
|
|
@@ -313,7 +323,7 @@ var DEFAULT_COLOR_CONFIG = {
|
|
|
313
323
|
negative: "#dc2626"
|
|
314
324
|
}
|
|
315
325
|
};
|
|
316
|
-
var getDefaultConfig =
|
|
326
|
+
var getDefaultConfig = async (root) => {
|
|
317
327
|
let license = import_config.STORM_DEFAULT_LICENSE;
|
|
318
328
|
let homepage = import_config.STORM_DEFAULT_HOMEPAGE;
|
|
319
329
|
let name = void 0;
|
|
@@ -321,7 +331,10 @@ var getDefaultConfig = /* @__PURE__ */ __name(async (root) => {
|
|
|
321
331
|
let repository = void 0;
|
|
322
332
|
const workspaceRoot = findWorkspaceRoot(root);
|
|
323
333
|
if ((0, import_node_fs2.existsSync)((0, import_node_path2.join)(workspaceRoot, "package.json"))) {
|
|
324
|
-
const file = await (0, import_promises.readFile)(
|
|
334
|
+
const file = await (0, import_promises.readFile)(
|
|
335
|
+
joinPaths(workspaceRoot, "package.json"),
|
|
336
|
+
"utf8"
|
|
337
|
+
);
|
|
325
338
|
if (file) {
|
|
326
339
|
const packageJson = JSON.parse(file);
|
|
327
340
|
if (packageJson.name) {
|
|
@@ -358,36 +371,36 @@ var getDefaultConfig = /* @__PURE__ */ __name(async (root) => {
|
|
|
358
371
|
url: `${homepage || import_config.STORM_DEFAULT_HOMEPAGE}/errors`
|
|
359
372
|
}
|
|
360
373
|
};
|
|
361
|
-
}
|
|
374
|
+
};
|
|
362
375
|
|
|
363
376
|
// src/logger/chalk.ts
|
|
364
377
|
var import_chalk = __toESM(require("chalk"), 1);
|
|
365
378
|
var chalkDefault = {
|
|
366
|
-
hex:
|
|
367
|
-
bgHex:
|
|
368
|
-
whiteBright:
|
|
369
|
-
}),
|
|
370
|
-
whiteBright:
|
|
371
|
-
gray:
|
|
379
|
+
hex: (_) => (message) => message,
|
|
380
|
+
bgHex: (_) => ({
|
|
381
|
+
whiteBright: (message) => message
|
|
382
|
+
}),
|
|
383
|
+
whiteBright: (message) => message,
|
|
384
|
+
gray: (message) => message,
|
|
372
385
|
bold: {
|
|
373
|
-
hex:
|
|
374
|
-
bgHex:
|
|
375
|
-
whiteBright:
|
|
376
|
-
}),
|
|
377
|
-
whiteBright:
|
|
386
|
+
hex: (_) => (message) => message,
|
|
387
|
+
bgHex: (_) => ({
|
|
388
|
+
whiteBright: (message) => message
|
|
389
|
+
}),
|
|
390
|
+
whiteBright: (message) => message
|
|
378
391
|
},
|
|
379
392
|
dim: {
|
|
380
|
-
hex:
|
|
381
|
-
gray:
|
|
393
|
+
hex: (_) => (message) => message,
|
|
394
|
+
gray: (message) => message
|
|
382
395
|
}
|
|
383
396
|
};
|
|
384
|
-
var getChalk =
|
|
397
|
+
var getChalk = () => {
|
|
385
398
|
let _chalk = import_chalk.default;
|
|
386
399
|
if (!_chalk?.hex || !_chalk?.bold?.hex || !_chalk?.bgHex || !_chalk?.whiteBright) {
|
|
387
400
|
_chalk = chalkDefault;
|
|
388
401
|
}
|
|
389
402
|
return _chalk;
|
|
390
|
-
}
|
|
403
|
+
};
|
|
391
404
|
|
|
392
405
|
// src/logger/is-unicode-supported.ts
|
|
393
406
|
function isUnicodeSupported() {
|
|
@@ -399,10 +412,9 @@ function isUnicodeSupported() {
|
|
|
399
412
|
process.env.ConEmuTask === "{cmd::Cmder}" || // ConEmu and cmder
|
|
400
413
|
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";
|
|
401
414
|
}
|
|
402
|
-
__name(isUnicodeSupported, "isUnicodeSupported");
|
|
403
415
|
|
|
404
416
|
// src/logger/console-icons.ts
|
|
405
|
-
var useIcon =
|
|
417
|
+
var useIcon = (c, fallback) => isUnicodeSupported() ? c : fallback;
|
|
406
418
|
var CONSOLE_ICONS = {
|
|
407
419
|
[LogLevelLabel.ERROR]: useIcon("\u2718", "\xD7"),
|
|
408
420
|
[LogLevelLabel.FATAL]: useIcon("\u{1F480}", "\xD7"),
|
|
@@ -415,12 +427,12 @@ var CONSOLE_ICONS = {
|
|
|
415
427
|
};
|
|
416
428
|
|
|
417
429
|
// src/logger/format-timestamp.ts
|
|
418
|
-
var formatTimestamp =
|
|
430
|
+
var formatTimestamp = (date = /* @__PURE__ */ new Date()) => {
|
|
419
431
|
return `${date.toLocaleDateString()} ${date.toLocaleTimeString()}`;
|
|
420
|
-
}
|
|
432
|
+
};
|
|
421
433
|
|
|
422
434
|
// src/logger/get-log-level.ts
|
|
423
|
-
var getLogLevel =
|
|
435
|
+
var getLogLevel = (label) => {
|
|
424
436
|
switch (label) {
|
|
425
437
|
case "all":
|
|
426
438
|
return LogLevel.ALL;
|
|
@@ -441,8 +453,8 @@ var getLogLevel = /* @__PURE__ */ __name((label) => {
|
|
|
441
453
|
default:
|
|
442
454
|
return LogLevel.INFO;
|
|
443
455
|
}
|
|
444
|
-
}
|
|
445
|
-
var getLogLevelLabel =
|
|
456
|
+
};
|
|
457
|
+
var getLogLevelLabel = (logLevel = LogLevel.INFO) => {
|
|
446
458
|
if (logLevel >= LogLevel.ALL) {
|
|
447
459
|
return LogLevelLabel.ALL;
|
|
448
460
|
}
|
|
@@ -468,10 +480,10 @@ var getLogLevelLabel = /* @__PURE__ */ __name((logLevel = LogLevel.INFO) => {
|
|
|
468
480
|
return LogLevelLabel.SILENT;
|
|
469
481
|
}
|
|
470
482
|
return LogLevelLabel.INFO;
|
|
471
|
-
}
|
|
483
|
+
};
|
|
472
484
|
|
|
473
485
|
// src/logger/console.ts
|
|
474
|
-
var getLogFn =
|
|
486
|
+
var getLogFn = (logLevel = LogLevel.INFO, config = {}, _chalk = getChalk()) => {
|
|
475
487
|
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;
|
|
476
488
|
const configLogLevel = config.logLevel || process.env.STORM_LOG_LEVEL || LogLevelLabel.INFO;
|
|
477
489
|
if (logLevel > getLogLevel(configLogLevel) || logLevel <= LogLevel.SILENT || getLogLevel(configLogLevel) <= LogLevel.SILENT) {
|
|
@@ -480,108 +492,133 @@ var getLogFn = /* @__PURE__ */ __name((logLevel = LogLevel.INFO, config = {}, _c
|
|
|
480
492
|
}
|
|
481
493
|
if (typeof logLevel === "number" && LogLevel.FATAL >= logLevel) {
|
|
482
494
|
return (message) => {
|
|
483
|
-
console.error(
|
|
495
|
+
console.error(
|
|
496
|
+
`
|
|
484
497
|
${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.fatal ?? "#7d1a1a")(`[${CONSOLE_ICONS[LogLevelLabel.FATAL]} Fatal] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
|
|
485
|
-
`
|
|
498
|
+
`
|
|
499
|
+
);
|
|
486
500
|
};
|
|
487
501
|
}
|
|
488
502
|
if (typeof logLevel === "number" && LogLevel.ERROR >= logLevel) {
|
|
489
503
|
return (message) => {
|
|
490
|
-
console.error(
|
|
504
|
+
console.error(
|
|
505
|
+
`
|
|
491
506
|
${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.danger ?? "#f85149")(`[${CONSOLE_ICONS[LogLevelLabel.ERROR]} Error] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
|
|
492
|
-
`
|
|
507
|
+
`
|
|
508
|
+
);
|
|
493
509
|
};
|
|
494
510
|
}
|
|
495
511
|
if (typeof logLevel === "number" && LogLevel.WARN >= logLevel) {
|
|
496
512
|
return (message) => {
|
|
497
|
-
console.warn(
|
|
513
|
+
console.warn(
|
|
514
|
+
`
|
|
498
515
|
${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.warning ?? "#e3b341")(`[${CONSOLE_ICONS[LogLevelLabel.WARN]} Warn] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
|
|
499
|
-
`
|
|
516
|
+
`
|
|
517
|
+
);
|
|
500
518
|
};
|
|
501
519
|
}
|
|
502
520
|
if (typeof logLevel === "number" && LogLevel.SUCCESS >= logLevel) {
|
|
503
521
|
return (message) => {
|
|
504
|
-
console.info(
|
|
522
|
+
console.info(
|
|
523
|
+
`
|
|
505
524
|
${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.success ?? "#56d364")(`[${CONSOLE_ICONS[LogLevelLabel.SUCCESS]} Success] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
|
|
506
|
-
`
|
|
525
|
+
`
|
|
526
|
+
);
|
|
507
527
|
};
|
|
508
528
|
}
|
|
509
529
|
if (typeof logLevel === "number" && LogLevel.INFO >= logLevel) {
|
|
510
530
|
return (message) => {
|
|
511
|
-
console.info(
|
|
531
|
+
console.info(
|
|
532
|
+
`
|
|
512
533
|
${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.info ?? "#58a6ff")(`[${CONSOLE_ICONS[LogLevelLabel.INFO]} Info] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
|
|
513
|
-
`
|
|
534
|
+
`
|
|
535
|
+
);
|
|
514
536
|
};
|
|
515
537
|
}
|
|
516
538
|
if (typeof logLevel === "number" && LogLevel.DEBUG >= logLevel) {
|
|
517
539
|
return (message) => {
|
|
518
|
-
console.debug(
|
|
540
|
+
console.debug(
|
|
541
|
+
`
|
|
519
542
|
${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.brand ?? "#1fb2a6")(`[${CONSOLE_ICONS[LogLevelLabel.DEBUG]} Debug] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
|
|
520
|
-
`
|
|
543
|
+
`
|
|
544
|
+
);
|
|
521
545
|
};
|
|
522
546
|
}
|
|
523
547
|
if (typeof logLevel === "number" && LogLevel.TRACE >= logLevel) {
|
|
524
548
|
return (message) => {
|
|
525
|
-
console.debug(
|
|
549
|
+
console.debug(
|
|
550
|
+
`
|
|
526
551
|
${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.brand ?? "#1fb2a6")(`[${CONSOLE_ICONS[LogLevelLabel.TRACE]} Trace] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
|
|
527
|
-
`
|
|
552
|
+
`
|
|
553
|
+
);
|
|
528
554
|
};
|
|
529
555
|
}
|
|
530
556
|
return (message) => {
|
|
531
|
-
console.log(
|
|
557
|
+
console.log(
|
|
558
|
+
`
|
|
532
559
|
${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.brand ?? "#1fb2a6")(`[${CONSOLE_ICONS[LogLevelLabel.ALL]} System] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
|
|
533
|
-
`
|
|
560
|
+
`
|
|
561
|
+
);
|
|
534
562
|
};
|
|
535
|
-
}
|
|
536
|
-
var writeFatal =
|
|
537
|
-
var writeError =
|
|
538
|
-
var writeWarning =
|
|
539
|
-
var writeInfo =
|
|
540
|
-
var writeSuccess =
|
|
541
|
-
var writeTrace =
|
|
563
|
+
};
|
|
564
|
+
var writeFatal = (message, config) => getLogFn(LogLevel.FATAL, config)(message);
|
|
565
|
+
var writeError = (message, config) => getLogFn(LogLevel.ERROR, config)(message);
|
|
566
|
+
var writeWarning = (message, config) => getLogFn(LogLevel.WARN, config)(message);
|
|
567
|
+
var writeInfo = (message, config) => getLogFn(LogLevel.INFO, config)(message);
|
|
568
|
+
var writeSuccess = (message, config) => getLogFn(LogLevel.SUCCESS, config)(message);
|
|
569
|
+
var writeTrace = (message, config) => getLogFn(LogLevel.TRACE, config)(message);
|
|
542
570
|
var MAX_DEPTH = 4;
|
|
543
|
-
var formatLogMessage =
|
|
571
|
+
var formatLogMessage = (message, options = {}, depth2 = 0) => {
|
|
544
572
|
if (depth2 > MAX_DEPTH) {
|
|
545
573
|
return "<max depth>";
|
|
546
574
|
}
|
|
547
575
|
const prefix = options.prefix ?? "-";
|
|
548
576
|
const skip = options.skip ?? [];
|
|
549
577
|
return typeof message === "undefined" || message === null || !message && typeof message !== "boolean" ? "<none>" : typeof message === "string" ? message : Array.isArray(message) ? `
|
|
550
|
-
${message.map((item, index) => ` ${prefix}> #${index} = ${formatLogMessage(item, {
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
}
|
|
559
|
-
var _isFunction =
|
|
578
|
+
${message.map((item, index) => ` ${prefix}> #${index} = ${formatLogMessage(item, { prefix: `${prefix}-`, skip }, depth2 + 1)}`).join("\n")}` : typeof message === "object" ? `
|
|
579
|
+
${Object.keys(message).filter((key) => !skip.includes(key)).map(
|
|
580
|
+
(key) => ` ${prefix}> ${key} = ${_isFunction(message[key]) ? "<function>" : typeof message[key] === "object" ? formatLogMessage(
|
|
581
|
+
message[key],
|
|
582
|
+
{ prefix: `${prefix}-`, skip },
|
|
583
|
+
depth2 + 1
|
|
584
|
+
) : message[key]}`
|
|
585
|
+
).join("\n")}` : message;
|
|
586
|
+
};
|
|
587
|
+
var _isFunction = (value) => {
|
|
560
588
|
try {
|
|
561
589
|
return value instanceof Function || typeof value === "function" || !!(value?.constructor && value?.call && value?.apply);
|
|
562
590
|
} catch (e) {
|
|
563
591
|
return false;
|
|
564
592
|
}
|
|
565
|
-
}
|
|
593
|
+
};
|
|
566
594
|
|
|
567
595
|
// src/utilities/process-handler.ts
|
|
568
|
-
var exitWithError =
|
|
596
|
+
var exitWithError = (config) => {
|
|
569
597
|
writeFatal("Exiting script with an error status...", config);
|
|
570
598
|
process.exit(1);
|
|
571
|
-
}
|
|
572
|
-
var exitWithSuccess =
|
|
599
|
+
};
|
|
600
|
+
var exitWithSuccess = (config) => {
|
|
573
601
|
writeSuccess("Script completed successfully. Exiting...", config);
|
|
574
602
|
process.exit(0);
|
|
575
|
-
}
|
|
576
|
-
var handleProcess =
|
|
577
|
-
writeTrace(
|
|
603
|
+
};
|
|
604
|
+
var handleProcess = (config) => {
|
|
605
|
+
writeTrace(
|
|
606
|
+
`Using the following arguments to process the script: ${process.argv.join(", ")}`,
|
|
607
|
+
config
|
|
608
|
+
);
|
|
578
609
|
process.on("unhandledRejection", (error) => {
|
|
579
|
-
writeError(
|
|
610
|
+
writeError(
|
|
611
|
+
`An Unhandled Rejection occurred while running the program: ${error}`,
|
|
612
|
+
config
|
|
613
|
+
);
|
|
580
614
|
exitWithError(config);
|
|
581
615
|
});
|
|
582
616
|
process.on("uncaughtException", (error) => {
|
|
583
|
-
writeError(
|
|
584
|
-
|
|
617
|
+
writeError(
|
|
618
|
+
`An Uncaught Exception occurred while running the program: ${error.message}
|
|
619
|
+
Stacktrace: ${error.stack}`,
|
|
620
|
+
config
|
|
621
|
+
);
|
|
585
622
|
exitWithError(config);
|
|
586
623
|
});
|
|
587
624
|
process.on("SIGTERM", (signal) => {
|
|
@@ -596,10 +633,10 @@ Stacktrace: ${error.stack}`, config);
|
|
|
596
633
|
writeError(`The program terminated with signal code: ${signal}`, config);
|
|
597
634
|
exitWithError(config);
|
|
598
635
|
});
|
|
599
|
-
}
|
|
636
|
+
};
|
|
600
637
|
|
|
601
638
|
// src/config-file/get-config-file.ts
|
|
602
|
-
var getConfigFileByName =
|
|
639
|
+
var getConfigFileByName = async (fileName, filePath, options = {}) => {
|
|
603
640
|
const workspacePath = filePath || findWorkspaceRoot(filePath);
|
|
604
641
|
const configs = await Promise.all([
|
|
605
642
|
(0, import_c12.loadConfig)({
|
|
@@ -609,7 +646,10 @@ var getConfigFileByName = /* @__PURE__ */ __name(async (fileName, filePath, opti
|
|
|
609
646
|
envName: fileName?.toUpperCase(),
|
|
610
647
|
jitiOptions: {
|
|
611
648
|
debug: false,
|
|
612
|
-
fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : joinPaths(
|
|
649
|
+
fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : joinPaths(
|
|
650
|
+
process.env.STORM_CACHE_DIR || "node_modules/.cache/storm",
|
|
651
|
+
"jiti"
|
|
652
|
+
)
|
|
613
653
|
},
|
|
614
654
|
...options
|
|
615
655
|
}),
|
|
@@ -620,32 +660,45 @@ var getConfigFileByName = /* @__PURE__ */ __name(async (fileName, filePath, opti
|
|
|
620
660
|
envName: fileName?.toUpperCase(),
|
|
621
661
|
jitiOptions: {
|
|
622
662
|
debug: false,
|
|
623
|
-
fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : joinPaths(
|
|
663
|
+
fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : joinPaths(
|
|
664
|
+
process.env.STORM_CACHE_DIR || "node_modules/.cache/storm",
|
|
665
|
+
"jiti"
|
|
666
|
+
)
|
|
624
667
|
},
|
|
625
668
|
configFile: fileName,
|
|
626
669
|
...options
|
|
627
670
|
})
|
|
628
671
|
]);
|
|
629
672
|
return (0, import_defu.default)(configs[0] ?? {}, configs[1] ?? {});
|
|
630
|
-
}
|
|
631
|
-
var getConfigFile =
|
|
673
|
+
};
|
|
674
|
+
var getConfigFile = async (filePath, additionalFileNames = []) => {
|
|
632
675
|
const workspacePath = filePath ? filePath : findWorkspaceRoot(filePath);
|
|
633
676
|
const result = await getConfigFileByName("storm-workspace", workspacePath);
|
|
634
677
|
let config = result.config;
|
|
635
678
|
const configFile = result.configFile;
|
|
636
679
|
if (config && configFile && Object.keys(config).length > 0 && !config.skipConfigLogging) {
|
|
637
|
-
writeTrace(
|
|
638
|
-
|
|
639
|
-
|
|
680
|
+
writeTrace(
|
|
681
|
+
`Found Storm configuration file "${configFile.includes(`${workspacePath}/`) ? configFile.replace(`${workspacePath}/`, "") : configFile}" at "${workspacePath}"`,
|
|
682
|
+
{
|
|
683
|
+
logLevel: "all"
|
|
684
|
+
}
|
|
685
|
+
);
|
|
640
686
|
}
|
|
641
687
|
if (additionalFileNames && additionalFileNames.length > 0) {
|
|
642
|
-
const results = await Promise.all(
|
|
688
|
+
const results = await Promise.all(
|
|
689
|
+
additionalFileNames.map(
|
|
690
|
+
(fileName) => getConfigFileByName(fileName, workspacePath)
|
|
691
|
+
)
|
|
692
|
+
);
|
|
643
693
|
for (const result2 of results) {
|
|
644
694
|
if (result2?.config && result2?.configFile && Object.keys(result2.config).length > 0) {
|
|
645
695
|
if (!config.skipConfigLogging && !result2.config.skipConfigLogging) {
|
|
646
|
-
writeTrace(
|
|
647
|
-
|
|
648
|
-
|
|
696
|
+
writeTrace(
|
|
697
|
+
`Found alternative configuration file "${result2.configFile.includes(`${workspacePath}/`) ? result2.configFile.replace(`${workspacePath}/`, "") : result2.configFile}" at "${workspacePath}"`,
|
|
698
|
+
{
|
|
699
|
+
logLevel: "all"
|
|
700
|
+
}
|
|
701
|
+
);
|
|
649
702
|
}
|
|
650
703
|
config = (0, import_defu.default)(result2.config ?? {}, config ?? {});
|
|
651
704
|
}
|
|
@@ -656,21 +709,23 @@ var getConfigFile = /* @__PURE__ */ __name(async (filePath, additionalFileNames
|
|
|
656
709
|
}
|
|
657
710
|
config.configFile = configFile;
|
|
658
711
|
return config;
|
|
659
|
-
}
|
|
712
|
+
};
|
|
660
713
|
|
|
661
714
|
// src/env/get-env.ts
|
|
662
715
|
var import_config2 = require("@storm-software/config");
|
|
663
|
-
var getExtensionEnv =
|
|
716
|
+
var getExtensionEnv = (extensionName) => {
|
|
664
717
|
const prefix = `STORM_EXTENSION_${extensionName.toUpperCase()}_`;
|
|
665
718
|
return Object.keys(process.env).filter((key) => key.startsWith(prefix)).reduce((ret, key) => {
|
|
666
|
-
const name = key.replace(prefix, "").split("_").map(
|
|
719
|
+
const name = key.replace(prefix, "").split("_").map(
|
|
720
|
+
(i) => i.length > 0 ? i.trim().charAt(0).toUpperCase() + i.trim().slice(1) : ""
|
|
721
|
+
).join("");
|
|
667
722
|
if (name) {
|
|
668
723
|
ret[name] = process.env[key];
|
|
669
724
|
}
|
|
670
725
|
return ret;
|
|
671
726
|
}, {});
|
|
672
|
-
}
|
|
673
|
-
var getConfigEnv =
|
|
727
|
+
};
|
|
728
|
+
var getConfigEnv = () => {
|
|
674
729
|
const prefix = "STORM_";
|
|
675
730
|
let config = {
|
|
676
731
|
extends: process.env[`${prefix}EXTENDS`] || void 0,
|
|
@@ -738,14 +793,25 @@ var getConfigEnv = /* @__PURE__ */ __name(() => {
|
|
|
738
793
|
cyclone: process.env[`${prefix}REGISTRY_CYCLONE`] || void 0,
|
|
739
794
|
container: process.env[`${prefix}REGISTRY_CONTAINER`] || void 0
|
|
740
795
|
},
|
|
741
|
-
logLevel: process.env[`${prefix}LOG_LEVEL`] !== null && process.env[`${prefix}LOG_LEVEL`] !== void 0 ? process.env[`${prefix}LOG_LEVEL`] && Number.isSafeInteger(
|
|
796
|
+
logLevel: process.env[`${prefix}LOG_LEVEL`] !== null && process.env[`${prefix}LOG_LEVEL`] !== void 0 ? process.env[`${prefix}LOG_LEVEL`] && Number.isSafeInteger(
|
|
797
|
+
Number.parseInt(process.env[`${prefix}LOG_LEVEL`])
|
|
798
|
+
) ? getLogLevelLabel(
|
|
799
|
+
Number.parseInt(process.env[`${prefix}LOG_LEVEL`])
|
|
800
|
+
) : process.env[`${prefix}LOG_LEVEL`] : void 0,
|
|
742
801
|
skipConfigLogging: process.env[`${prefix}SKIP_CONFIG_LOGGING`] !== void 0 ? Boolean(process.env[`${prefix}SKIP_CONFIG_LOGGING`]) : void 0
|
|
743
802
|
};
|
|
744
|
-
const themeNames = Object.keys(process.env).filter(
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
803
|
+
const themeNames = Object.keys(process.env).filter(
|
|
804
|
+
(envKey) => envKey.startsWith(`${prefix}COLOR_`) && import_config2.COLOR_KEYS.every(
|
|
805
|
+
(colorKey) => !envKey.startsWith(`${prefix}COLOR_LIGHT_${colorKey}`) && !envKey.startsWith(`${prefix}COLOR_DARK_${colorKey}`)
|
|
806
|
+
)
|
|
807
|
+
);
|
|
808
|
+
config.colors = themeNames.length > 0 ? themeNames.reduce(
|
|
809
|
+
(ret, themeName) => {
|
|
810
|
+
ret[themeName] = getThemeColorConfigEnv(prefix, themeName);
|
|
811
|
+
return ret;
|
|
812
|
+
},
|
|
813
|
+
{}
|
|
814
|
+
) : getThemeColorConfigEnv(prefix);
|
|
749
815
|
if (config.docs === import_config2.STORM_DEFAULT_DOCS) {
|
|
750
816
|
if (config.homepage === import_config2.STORM_DEFAULT_HOMEPAGE) {
|
|
751
817
|
config.docs = `${import_config2.STORM_DEFAULT_HOMEPAGE}/projects/${config.name}/docs`;
|
|
@@ -766,23 +832,17 @@ var getConfigEnv = /* @__PURE__ */ __name(() => {
|
|
|
766
832
|
config = {
|
|
767
833
|
...config,
|
|
768
834
|
...parsed,
|
|
769
|
-
colors: {
|
|
770
|
-
|
|
771
|
-
...parsed.colors
|
|
772
|
-
},
|
|
773
|
-
extensions: {
|
|
774
|
-
...config.extensions,
|
|
775
|
-
...parsed.extensions
|
|
776
|
-
}
|
|
835
|
+
colors: { ...config.colors, ...parsed.colors },
|
|
836
|
+
extensions: { ...config.extensions, ...parsed.extensions }
|
|
777
837
|
};
|
|
778
838
|
}
|
|
779
839
|
return config;
|
|
780
|
-
}
|
|
781
|
-
var getThemeColorConfigEnv =
|
|
840
|
+
};
|
|
841
|
+
var getThemeColorConfigEnv = (prefix, theme) => {
|
|
782
842
|
const themeName = `COLOR_${theme && theme !== "base" ? `${theme}_` : ""}`.toUpperCase();
|
|
783
843
|
return process.env[`${prefix}${themeName}LIGHT_BRAND`] || process.env[`${prefix}${themeName}DARK_BRAND`] ? getMultiThemeColorConfigEnv(prefix + themeName) : getSingleThemeColorConfigEnv(prefix + themeName);
|
|
784
|
-
}
|
|
785
|
-
var getSingleThemeColorConfigEnv =
|
|
844
|
+
};
|
|
845
|
+
var getSingleThemeColorConfigEnv = (prefix) => {
|
|
786
846
|
return {
|
|
787
847
|
dark: process.env[`${prefix}DARK`],
|
|
788
848
|
light: process.env[`${prefix}LIGHT`],
|
|
@@ -799,14 +859,16 @@ var getSingleThemeColorConfigEnv = /* @__PURE__ */ __name((prefix) => {
|
|
|
799
859
|
positive: process.env[`${prefix}POSITIVE`],
|
|
800
860
|
negative: process.env[`${prefix}NEGATIVE`]
|
|
801
861
|
};
|
|
802
|
-
}
|
|
803
|
-
var getMultiThemeColorConfigEnv =
|
|
862
|
+
};
|
|
863
|
+
var getMultiThemeColorConfigEnv = (prefix) => {
|
|
804
864
|
return {
|
|
805
|
-
light: getBaseThemeColorConfigEnv(
|
|
865
|
+
light: getBaseThemeColorConfigEnv(
|
|
866
|
+
`${prefix}_LIGHT_`
|
|
867
|
+
),
|
|
806
868
|
dark: getBaseThemeColorConfigEnv(`${prefix}_DARK_`)
|
|
807
869
|
};
|
|
808
|
-
}
|
|
809
|
-
var getBaseThemeColorConfigEnv =
|
|
870
|
+
};
|
|
871
|
+
var getBaseThemeColorConfigEnv = (prefix) => {
|
|
810
872
|
return {
|
|
811
873
|
foreground: process.env[`${prefix}FOREGROUND`],
|
|
812
874
|
background: process.env[`${prefix}BACKGROUND`],
|
|
@@ -823,13 +885,16 @@ var getBaseThemeColorConfigEnv = /* @__PURE__ */ __name((prefix) => {
|
|
|
823
885
|
positive: process.env[`${prefix}POSITIVE`],
|
|
824
886
|
negative: process.env[`${prefix}NEGATIVE`]
|
|
825
887
|
};
|
|
826
|
-
}
|
|
888
|
+
};
|
|
827
889
|
|
|
828
890
|
// src/env/set-env.ts
|
|
829
|
-
var setExtensionEnv =
|
|
891
|
+
var setExtensionEnv = (extensionName, extension) => {
|
|
830
892
|
for (const key of Object.keys(extension ?? {})) {
|
|
831
893
|
if (extension[key]) {
|
|
832
|
-
const result = key?.replace(
|
|
894
|
+
const result = key?.replace(
|
|
895
|
+
/([A-Z])+/g,
|
|
896
|
+
(input) => input ? input[0]?.toUpperCase() + input.slice(1) : ""
|
|
897
|
+
).split(/(?=[A-Z])|[.\-\s_]/).map((x) => x.toLowerCase()) ?? [];
|
|
833
898
|
let extensionKey;
|
|
834
899
|
if (result.length === 0) {
|
|
835
900
|
return;
|
|
@@ -844,8 +909,8 @@ var setExtensionEnv = /* @__PURE__ */ __name((extensionName, extension) => {
|
|
|
844
909
|
process.env[`STORM_EXTENSION_${extensionName.toUpperCase()}_${extensionKey.toUpperCase()}`] = extension[key];
|
|
845
910
|
}
|
|
846
911
|
}
|
|
847
|
-
}
|
|
848
|
-
var setConfigEnv =
|
|
912
|
+
};
|
|
913
|
+
var setConfigEnv = (config) => {
|
|
849
914
|
const prefix = "STORM_";
|
|
850
915
|
if (config.extends) {
|
|
851
916
|
process.env[`${prefix}EXTENDS`] = Array.isArray(config.extends) ? JSON.stringify(config.extends) : config.extends;
|
|
@@ -934,7 +999,9 @@ var setConfigEnv = /* @__PURE__ */ __name((config) => {
|
|
|
934
999
|
}
|
|
935
1000
|
if (config.directories) {
|
|
936
1001
|
if (!config.skipCache && config.directories.cache) {
|
|
937
|
-
process.env[`${prefix}CACHE_DIR`] = correctPaths(
|
|
1002
|
+
process.env[`${prefix}CACHE_DIR`] = correctPaths(
|
|
1003
|
+
config.directories.cache
|
|
1004
|
+
);
|
|
938
1005
|
process.env[`${prefix}CACHE_DIRECTORY`] = process.env[`${prefix}CACHE_DIR`];
|
|
939
1006
|
}
|
|
940
1007
|
if (config.directories.data) {
|
|
@@ -942,7 +1009,9 @@ var setConfigEnv = /* @__PURE__ */ __name((config) => {
|
|
|
942
1009
|
process.env[`${prefix}DATA_DIRECTORY`] = process.env[`${prefix}DATA_DIR`];
|
|
943
1010
|
}
|
|
944
1011
|
if (config.directories.config) {
|
|
945
|
-
process.env[`${prefix}CONFIG_DIR`] = correctPaths(
|
|
1012
|
+
process.env[`${prefix}CONFIG_DIR`] = correctPaths(
|
|
1013
|
+
config.directories.config
|
|
1014
|
+
);
|
|
946
1015
|
process.env[`${prefix}CONFIG_DIRECTORY`] = process.env[`${prefix}CONFIG_DIR`];
|
|
947
1016
|
}
|
|
948
1017
|
if (config.directories.temp) {
|
|
@@ -954,7 +1023,9 @@ var setConfigEnv = /* @__PURE__ */ __name((config) => {
|
|
|
954
1023
|
process.env[`${prefix}LOG_DIRECTORY`] = process.env[`${prefix}LOG_DIR`];
|
|
955
1024
|
}
|
|
956
1025
|
if (config.directories.build) {
|
|
957
|
-
process.env[`${prefix}BUILD_DIR`] = correctPaths(
|
|
1026
|
+
process.env[`${prefix}BUILD_DIR`] = correctPaths(
|
|
1027
|
+
config.directories.build
|
|
1028
|
+
);
|
|
958
1029
|
process.env[`${prefix}BUILD_DIRECTORY`] = process.env[`${prefix}BUILD_DIR`];
|
|
959
1030
|
}
|
|
960
1031
|
}
|
|
@@ -975,7 +1046,10 @@ var setConfigEnv = /* @__PURE__ */ __name((config) => {
|
|
|
975
1046
|
setThemeColorConfigEnv(`${prefix}COLOR_${key}_`, config.colors[key]);
|
|
976
1047
|
}
|
|
977
1048
|
} else {
|
|
978
|
-
setThemeColorConfigEnv(
|
|
1049
|
+
setThemeColorConfigEnv(
|
|
1050
|
+
`${prefix}COLOR_`,
|
|
1051
|
+
config.colors
|
|
1052
|
+
);
|
|
979
1053
|
}
|
|
980
1054
|
if (config.repository) {
|
|
981
1055
|
process.env[`${prefix}REPOSITORY`] = config.repository;
|
|
@@ -987,7 +1061,9 @@ var setConfigEnv = /* @__PURE__ */ __name((config) => {
|
|
|
987
1061
|
process.env[`${prefix}PRE_ID`] = String(config.preid);
|
|
988
1062
|
}
|
|
989
1063
|
if (config.externalPackagePatterns) {
|
|
990
|
-
process.env[`${prefix}EXTERNAL_PACKAGE_PATTERNS`] = JSON.stringify(
|
|
1064
|
+
process.env[`${prefix}EXTERNAL_PACKAGE_PATTERNS`] = JSON.stringify(
|
|
1065
|
+
config.externalPackagePatterns
|
|
1066
|
+
);
|
|
991
1067
|
}
|
|
992
1068
|
if (config.registry) {
|
|
993
1069
|
if (config.registry.github) {
|
|
@@ -1000,20 +1076,28 @@ var setConfigEnv = /* @__PURE__ */ __name((config) => {
|
|
|
1000
1076
|
process.env[`${prefix}REGISTRY_CARGO`] = String(config.registry.cargo);
|
|
1001
1077
|
}
|
|
1002
1078
|
if (config.registry.cyclone) {
|
|
1003
|
-
process.env[`${prefix}REGISTRY_CYCLONE`] = String(
|
|
1079
|
+
process.env[`${prefix}REGISTRY_CYCLONE`] = String(
|
|
1080
|
+
config.registry.cyclone
|
|
1081
|
+
);
|
|
1004
1082
|
}
|
|
1005
1083
|
if (config.registry.container) {
|
|
1006
|
-
process.env[`${prefix}REGISTRY_CONTAINER`] = String(
|
|
1084
|
+
process.env[`${prefix}REGISTRY_CONTAINER`] = String(
|
|
1085
|
+
config.registry.container
|
|
1086
|
+
);
|
|
1007
1087
|
}
|
|
1008
1088
|
}
|
|
1009
1089
|
if (config.logLevel) {
|
|
1010
1090
|
process.env[`${prefix}LOG_LEVEL`] = String(config.logLevel);
|
|
1011
1091
|
process.env.LOG_LEVEL = String(config.logLevel);
|
|
1012
|
-
process.env.NX_VERBOSE_LOGGING = String(
|
|
1092
|
+
process.env.NX_VERBOSE_LOGGING = String(
|
|
1093
|
+
getLogLevel(config.logLevel) >= LogLevel.DEBUG ? true : false
|
|
1094
|
+
);
|
|
1013
1095
|
process.env.RUST_BACKTRACE = getLogLevel(config.logLevel) >= LogLevel.DEBUG ? "full" : "none";
|
|
1014
1096
|
}
|
|
1015
1097
|
if (config.skipConfigLogging !== void 0) {
|
|
1016
|
-
process.env[`${prefix}SKIP_CONFIG_LOGGING`] = String(
|
|
1098
|
+
process.env[`${prefix}SKIP_CONFIG_LOGGING`] = String(
|
|
1099
|
+
config.skipConfigLogging
|
|
1100
|
+
);
|
|
1017
1101
|
}
|
|
1018
1102
|
process.env[`${prefix}CONFIG`] = JSON.stringify(config);
|
|
1019
1103
|
for (const key of Object.keys(config.extensions ?? {})) {
|
|
@@ -1021,11 +1105,11 @@ var setConfigEnv = /* @__PURE__ */ __name((config) => {
|
|
|
1021
1105
|
setExtensionEnv(key, config.extensions[key]);
|
|
1022
1106
|
}
|
|
1023
1107
|
}
|
|
1024
|
-
}
|
|
1025
|
-
var setThemeColorConfigEnv =
|
|
1108
|
+
};
|
|
1109
|
+
var setThemeColorConfigEnv = (prefix, config) => {
|
|
1026
1110
|
return config?.light?.brand || config?.dark?.brand ? setMultiThemeColorConfigEnv(prefix, config) : setSingleThemeColorConfigEnv(prefix, config);
|
|
1027
|
-
}
|
|
1028
|
-
var setSingleThemeColorConfigEnv =
|
|
1111
|
+
};
|
|
1112
|
+
var setSingleThemeColorConfigEnv = (prefix, config) => {
|
|
1029
1113
|
if (config.dark) {
|
|
1030
1114
|
process.env[`${prefix}DARK`] = config.dark;
|
|
1031
1115
|
}
|
|
@@ -1068,14 +1152,14 @@ var setSingleThemeColorConfigEnv = /* @__PURE__ */ __name((prefix, config) => {
|
|
|
1068
1152
|
if (config.negative) {
|
|
1069
1153
|
process.env[`${prefix}NEGATIVE`] = config.negative;
|
|
1070
1154
|
}
|
|
1071
|
-
}
|
|
1072
|
-
var setMultiThemeColorConfigEnv =
|
|
1155
|
+
};
|
|
1156
|
+
var setMultiThemeColorConfigEnv = (prefix, config) => {
|
|
1073
1157
|
return {
|
|
1074
1158
|
light: setBaseThemeColorConfigEnv(`${prefix}LIGHT_`, config.light),
|
|
1075
1159
|
dark: setBaseThemeColorConfigEnv(`${prefix}DARK_`, config.dark)
|
|
1076
1160
|
};
|
|
1077
|
-
}
|
|
1078
|
-
var setBaseThemeColorConfigEnv =
|
|
1161
|
+
};
|
|
1162
|
+
var setBaseThemeColorConfigEnv = (prefix, config) => {
|
|
1079
1163
|
if (config.foreground) {
|
|
1080
1164
|
process.env[`${prefix}FOREGROUND`] = config.foreground;
|
|
1081
1165
|
}
|
|
@@ -1118,12 +1202,12 @@ var setBaseThemeColorConfigEnv = /* @__PURE__ */ __name((prefix, config) => {
|
|
|
1118
1202
|
if (config.negative) {
|
|
1119
1203
|
process.env[`${prefix}NEGATIVE`] = config.negative;
|
|
1120
1204
|
}
|
|
1121
|
-
}
|
|
1205
|
+
};
|
|
1122
1206
|
|
|
1123
1207
|
// src/create-storm-config.ts
|
|
1124
1208
|
var _extension_cache = /* @__PURE__ */ new WeakMap();
|
|
1125
1209
|
var _static_cache = void 0;
|
|
1126
|
-
var createStormWorkspaceConfig =
|
|
1210
|
+
var createStormWorkspaceConfig = async (extensionName, schema, workspaceRoot, skipLogs = false, useDefault = true) => {
|
|
1127
1211
|
let result;
|
|
1128
1212
|
if (!_static_cache?.data || !_static_cache?.timestamp || _static_cache.timestamp < Date.now() - 8e3) {
|
|
1129
1213
|
let _workspaceRoot = workspaceRoot;
|
|
@@ -1134,16 +1218,19 @@ var createStormWorkspaceConfig = /* @__PURE__ */ __name(async (extensionName, sc
|
|
|
1134
1218
|
const configFile = await getConfigFile(_workspaceRoot);
|
|
1135
1219
|
if (!configFile) {
|
|
1136
1220
|
if (!skipLogs) {
|
|
1137
|
-
writeWarning(
|
|
1138
|
-
|
|
1139
|
-
|
|
1221
|
+
writeWarning(
|
|
1222
|
+
"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",
|
|
1223
|
+
{ logLevel: "all" }
|
|
1224
|
+
);
|
|
1140
1225
|
}
|
|
1141
1226
|
if (useDefault === false) {
|
|
1142
1227
|
return void 0;
|
|
1143
1228
|
}
|
|
1144
1229
|
}
|
|
1145
1230
|
const defaultConfig = await getDefaultConfig(_workspaceRoot);
|
|
1146
|
-
result = await import_schema.stormWorkspaceConfigSchema.parseAsync(
|
|
1231
|
+
result = await import_schema.stormWorkspaceConfigSchema.parseAsync(
|
|
1232
|
+
(0, import_defu2.default)(configEnv, configFile, defaultConfig)
|
|
1233
|
+
);
|
|
1147
1234
|
result.workspaceRoot ??= _workspaceRoot;
|
|
1148
1235
|
} else {
|
|
1149
1236
|
result = _static_cache.data;
|
|
@@ -1159,11 +1246,9 @@ var createStormWorkspaceConfig = /* @__PURE__ */ __name(async (extensionName, sc
|
|
|
1159
1246
|
data: result
|
|
1160
1247
|
};
|
|
1161
1248
|
return result;
|
|
1162
|
-
}
|
|
1163
|
-
var createConfigExtension =
|
|
1164
|
-
const extension_cache_key = {
|
|
1165
|
-
extensionName
|
|
1166
|
-
};
|
|
1249
|
+
};
|
|
1250
|
+
var createConfigExtension = (extensionName, schema) => {
|
|
1251
|
+
const extension_cache_key = { extensionName };
|
|
1167
1252
|
if (_extension_cache.has(extension_cache_key)) {
|
|
1168
1253
|
return _extension_cache.get(extension_cache_key);
|
|
1169
1254
|
}
|
|
@@ -1173,66 +1258,73 @@ var createConfigExtension = /* @__PURE__ */ __name((extensionName, schema) => {
|
|
|
1173
1258
|
}
|
|
1174
1259
|
_extension_cache.set(extension_cache_key, extension);
|
|
1175
1260
|
return extension;
|
|
1176
|
-
}
|
|
1177
|
-
var loadStormWorkspaceConfig =
|
|
1178
|
-
const config = await createStormWorkspaceConfig(
|
|
1261
|
+
};
|
|
1262
|
+
var loadStormWorkspaceConfig = async (workspaceRoot, skipLogs = false) => {
|
|
1263
|
+
const config = await createStormWorkspaceConfig(
|
|
1264
|
+
void 0,
|
|
1265
|
+
void 0,
|
|
1266
|
+
workspaceRoot,
|
|
1267
|
+
skipLogs,
|
|
1268
|
+
true
|
|
1269
|
+
);
|
|
1179
1270
|
setConfigEnv(config);
|
|
1180
1271
|
if (!skipLogs && !config.skipConfigLogging) {
|
|
1181
|
-
writeTrace(
|
|
1182
|
-
|
|
1272
|
+
writeTrace(
|
|
1273
|
+
`\u2699\uFE0F Using Storm Workspace configuration:
|
|
1274
|
+
${formatLogMessage(config)}`,
|
|
1275
|
+
config
|
|
1276
|
+
);
|
|
1183
1277
|
}
|
|
1184
1278
|
return config;
|
|
1185
|
-
}
|
|
1279
|
+
};
|
|
1186
1280
|
|
|
1187
1281
|
// src/get-config.ts
|
|
1188
|
-
var getConfig =
|
|
1282
|
+
var getConfig = (workspaceRoot, skipLogs = false) => {
|
|
1189
1283
|
return loadStormWorkspaceConfig(workspaceRoot, skipLogs);
|
|
1190
|
-
}
|
|
1284
|
+
};
|
|
1191
1285
|
|
|
1192
1286
|
// bin/config.ts
|
|
1193
1287
|
var import_chalk3 = __toESM(require("chalk"), 1);
|
|
1194
1288
|
function createProgram() {
|
|
1195
|
-
writeInfo("\u26A1 Running Storm Configuration Tools", {
|
|
1196
|
-
logLevel: "all"
|
|
1197
|
-
});
|
|
1289
|
+
writeInfo("\u26A1 Running Storm Configuration Tools", { logLevel: "all" });
|
|
1198
1290
|
const root = findWorkspaceRootSafe(process.cwd());
|
|
1199
1291
|
process.env.STORM_WORKSPACE_ROOT ??= root;
|
|
1200
1292
|
process.env.NX_WORKSPACE_ROOT_PATH ??= root;
|
|
1201
1293
|
root && process.chdir(root);
|
|
1202
1294
|
const program = new import_commander.Command("storm-config");
|
|
1203
1295
|
program.version("1.0.0", "-v --version", "display CLI version");
|
|
1204
|
-
const directory = new import_commander.Option(
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1296
|
+
const directory = new import_commander.Option(
|
|
1297
|
+
"-d --dir <path>",
|
|
1298
|
+
"A directory that exists inside the workspace root"
|
|
1299
|
+
).default(process.cwd());
|
|
1300
|
+
program.command("view", { isDefault: true }).description("View the current Storm configuration for the workspace.").addOption(directory).action(viewAction);
|
|
1208
1301
|
return program;
|
|
1209
1302
|
}
|
|
1210
|
-
__name(createProgram, "createProgram");
|
|
1211
1303
|
async function viewAction({ dir }) {
|
|
1212
|
-
writeInfo(
|
|
1213
|
-
|
|
1214
|
-
|
|
1304
|
+
writeInfo(
|
|
1305
|
+
`\u{1F50D} Searching for Storm configuration for the workspace at "${dir}"...`,
|
|
1306
|
+
{
|
|
1307
|
+
logLevel: "all"
|
|
1308
|
+
}
|
|
1309
|
+
);
|
|
1215
1310
|
const config = await getConfig(findWorkspaceRootSafe(dir), true);
|
|
1216
1311
|
if (config) {
|
|
1217
|
-
writeSuccess(
|
|
1312
|
+
writeSuccess(
|
|
1313
|
+
`The following Storm configuration values have been found for this repository:
|
|
1218
1314
|
|
|
1219
|
-
${formatLogMessage({
|
|
1220
|
-
...config,
|
|
1221
|
-
colors: void 0
|
|
1222
|
-
})}
|
|
1315
|
+
${formatLogMessage({ ...config, colors: void 0 })}
|
|
1223
1316
|
|
|
1224
1317
|
${typeof config.colors.light === "string" ? formatSingleThemeColors(config.colors) : formatMultiThemeColors(config.colors)}
|
|
1225
|
-
`,
|
|
1226
|
-
...config,
|
|
1227
|
-
|
|
1228
|
-
});
|
|
1318
|
+
`,
|
|
1319
|
+
{ ...config, logLevel: "all" }
|
|
1320
|
+
);
|
|
1229
1321
|
} else {
|
|
1230
|
-
writeError(
|
|
1231
|
-
|
|
1232
|
-
|
|
1322
|
+
writeError(
|
|
1323
|
+
"No Storm config file found in the current workspace. Please ensure this is the expected behavior - you can add a `storm.json` file to the root of your workspace if it is not.\n",
|
|
1324
|
+
{ logLevel: "all" }
|
|
1325
|
+
);
|
|
1233
1326
|
}
|
|
1234
1327
|
}
|
|
1235
|
-
__name(viewAction, "viewAction");
|
|
1236
1328
|
void (async () => {
|
|
1237
1329
|
try {
|
|
1238
1330
|
handleProcess();
|
|
@@ -1240,28 +1332,29 @@ void (async () => {
|
|
|
1240
1332
|
await program.parseAsync(process.argv);
|
|
1241
1333
|
exitWithSuccess();
|
|
1242
1334
|
} catch (error) {
|
|
1243
|
-
writeFatal(
|
|
1335
|
+
writeFatal(
|
|
1336
|
+
`A fatal error occurred while running the Storm Git tool:
|
|
1244
1337
|
${error?.message ? error.message : JSON.stringify(error)}${error?.stack ? `
|
|
1245
|
-
Stack Trace: ${error.stack}` : ""}`,
|
|
1246
|
-
logLevel: "all"
|
|
1247
|
-
|
|
1338
|
+
Stack Trace: ${error.stack}` : ""}`,
|
|
1339
|
+
{ logLevel: "all" }
|
|
1340
|
+
);
|
|
1248
1341
|
exitWithError();
|
|
1249
1342
|
process.exit(1);
|
|
1250
1343
|
}
|
|
1251
1344
|
})();
|
|
1252
|
-
var formatSingleThemeColors =
|
|
1345
|
+
var formatSingleThemeColors = (config) => {
|
|
1253
1346
|
return `---- Theme Colors ----
|
|
1254
1347
|
${Object.entries(config).filter(([key, value]) => typeof value === "string" && value.length > 0).map(([key, value]) => import_chalk3.default.hex(value)(`${key}: ${import_chalk3.default.bold(value)}`)).join(" \n")}
|
|
1255
1348
|
`;
|
|
1256
|
-
}
|
|
1257
|
-
var formatMultiThemeColors =
|
|
1349
|
+
};
|
|
1350
|
+
var formatMultiThemeColors = (config) => {
|
|
1258
1351
|
return ` ---- Light Theme Colors ----
|
|
1259
1352
|
${Object.entries(config.light).filter(([key, value]) => typeof value === "string" && value.length > 0).map(([key, value]) => import_chalk3.default.hex(value)(`${key}: ${import_chalk3.default.bold(value)}`)).join(" \n")}
|
|
1260
1353
|
|
|
1261
1354
|
---- Dark Theme Colors ----
|
|
1262
1355
|
${Object.entries(config.dark).filter(([key, value]) => typeof value === "string" && value.length > 0).map(([key, value]) => import_chalk3.default.hex(value)(`${key}: ${import_chalk3.default.bold(value)}`)).join(" \n")}
|
|
1263
1356
|
`;
|
|
1264
|
-
}
|
|
1357
|
+
};
|
|
1265
1358
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1266
1359
|
0 && (module.exports = {
|
|
1267
1360
|
createProgram,
|