@storm-software/config-tools 1.14.2 → 1.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/index.cjs +281 -101
- package/index.js +271 -100
- package/meta.cjs.json +1 -1
- package/meta.esm.json +1 -1
- package/package.json +2 -1
- package/utilities/find-workspace-root.cjs +7 -7
- package/utilities/find-workspace-root.js +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [1.14.3](https://github.com/storm-software/storm-ops/compare/config-tools-v1.14.2...config-tools-v1.14.3) (2024-01-15)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **workspace-tools:** Many code quality improvements and enhanced linting rules ([d2123cf](https://github.com/storm-software/storm-ops/commit/d2123cf87850b1442b8e7c1ed4b3ccc07f2a8673))
|
|
7
|
+
|
|
8
|
+
## [1.14.2](https://github.com/storm-software/storm-ops/compare/config-tools-v1.14.1...config-tools-v1.14.2) (2024-01-15)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* **git-tools:** Added dependency override for `request` package to prevent request forgery exposure ([1f42b96](https://github.com/storm-software/storm-ops/commit/1f42b96518e944a3b1e5a3e38dfc1c7dc1a7241f))
|
|
14
|
+
|
|
1
15
|
## [1.14.1](https://github.com/storm-software/storm-ops/compare/config-tools-v1.14.0...config-tools-v1.14.1) (2024-01-15)
|
|
2
16
|
|
|
3
17
|
|
package/index.cjs
CHANGED
|
@@ -44,11 +44,20 @@ __export(src_exports, {
|
|
|
44
44
|
getConfigFile: () => getConfigFile,
|
|
45
45
|
getDefaultConfig: () => getDefaultConfig,
|
|
46
46
|
getExtensionEnv: () => getExtensionEnv,
|
|
47
|
+
getLogFn: () => getLogFn,
|
|
47
48
|
getLogLevel: () => getLogLevel,
|
|
48
49
|
getLogLevelLabel: () => getLogLevelLabel,
|
|
49
50
|
loadStormConfig: () => loadStormConfig,
|
|
50
51
|
setConfigEnv: () => setConfigEnv,
|
|
51
|
-
setExtensionEnv: () => setExtensionEnv
|
|
52
|
+
setExtensionEnv: () => setExtensionEnv,
|
|
53
|
+
writeDebug: () => writeDebug,
|
|
54
|
+
writeError: () => writeError,
|
|
55
|
+
writeFatal: () => writeFatal,
|
|
56
|
+
writeInfo: () => writeInfo,
|
|
57
|
+
writeSuccess: () => writeSuccess,
|
|
58
|
+
writeSystem: () => writeSystem,
|
|
59
|
+
writeTrace: () => writeTrace,
|
|
60
|
+
writeWarning: () => writeWarning
|
|
52
61
|
});
|
|
53
62
|
module.exports = __toCommonJS(src_exports);
|
|
54
63
|
|
|
@@ -98,8 +107,10 @@ var LogLevel = {
|
|
|
98
107
|
ERROR: 20,
|
|
99
108
|
WARN: 30,
|
|
100
109
|
INFO: 40,
|
|
110
|
+
SUCCESS: 45,
|
|
101
111
|
DEBUG: 60,
|
|
102
|
-
TRACE: 70
|
|
112
|
+
TRACE: 70,
|
|
113
|
+
ALL: 100
|
|
103
114
|
};
|
|
104
115
|
var LogLevelLabel = {
|
|
105
116
|
SILENT: "silent",
|
|
@@ -108,7 +119,8 @@ var LogLevelLabel = {
|
|
|
108
119
|
WARN: "warn",
|
|
109
120
|
INFO: "info",
|
|
110
121
|
DEBUG: "debug",
|
|
111
|
-
TRACE: "trace"
|
|
122
|
+
TRACE: "trace",
|
|
123
|
+
ALL: "all"
|
|
112
124
|
};
|
|
113
125
|
|
|
114
126
|
// packages/config-tools/src/utilities/find-up.ts
|
|
@@ -117,15 +129,15 @@ var import_path = require("path");
|
|
|
117
129
|
var MAX_PATH_SEARCH_DEPTH = 30;
|
|
118
130
|
var depth = 0;
|
|
119
131
|
function findFolderUp(startPath, endFileNames) {
|
|
120
|
-
|
|
121
|
-
if (endFileNames.some((endFileName) => (0, import_fs.existsSync)((0, import_path.join)(
|
|
122
|
-
return
|
|
123
|
-
}
|
|
124
|
-
|
|
132
|
+
const _startPath = startPath ?? process.cwd();
|
|
133
|
+
if (endFileNames.some((endFileName) => (0, import_fs.existsSync)((0, import_path.join)(_startPath, endFileName)))) {
|
|
134
|
+
return _startPath;
|
|
135
|
+
}
|
|
136
|
+
if (_startPath !== "/" && depth++ < MAX_PATH_SEARCH_DEPTH) {
|
|
137
|
+
const parent = (0, import_path.join)(_startPath, "..");
|
|
125
138
|
return findFolderUp(parent, endFileNames);
|
|
126
|
-
} else {
|
|
127
|
-
return void 0;
|
|
128
139
|
}
|
|
140
|
+
return void 0;
|
|
129
141
|
}
|
|
130
142
|
|
|
131
143
|
// packages/config-tools/src/utilities/find-workspace-root.ts
|
|
@@ -203,17 +215,13 @@ var StormConfigSchema = z.object({
|
|
|
203
215
|
license: z.string().trim().default("Apache License 2.0").describe("The root directory of the package"),
|
|
204
216
|
homepage: z.string().trim().url().default("https://stormsoftware.org").describe("The homepage of the workspace"),
|
|
205
217
|
branch: z.string().trim().default("main").describe("The branch of the workspace"),
|
|
206
|
-
preMajor: z.boolean().default(false).describe(
|
|
207
|
-
"An indicator specifying if the package is still in it's pre-major version"
|
|
208
|
-
),
|
|
218
|
+
preMajor: z.boolean().default(false).describe("An indicator specifying if the package is still in it's pre-major version"),
|
|
209
219
|
owner: z.string().trim().default("@storm-software/development").describe("The owner of the package"),
|
|
210
220
|
worker: z.string().trim().default("stormie-bot").describe(
|
|
211
221
|
"The worker of the package (this is the bot that will be used to perform various tasks)"
|
|
212
222
|
),
|
|
213
223
|
env: z.enum(["development", "staging", "production"]).default("production").describe("The current runtime environment of the package"),
|
|
214
|
-
ci: z.boolean().default(true).describe(
|
|
215
|
-
"An indicator specifying if the current environment is a CI environment"
|
|
216
|
-
),
|
|
224
|
+
ci: z.boolean().default(true).describe("An indicator specifying if the current environment is a CI environment"),
|
|
217
225
|
workspaceRoot: z.string().trim().optional().describe("The root directory of the workspace"),
|
|
218
226
|
packageDirectory: z.string().trim().optional().describe("The root directory of the package"),
|
|
219
227
|
buildDirectory: z.string().trim().default("dist").describe("The build directory for the workspace"),
|
|
@@ -224,7 +232,7 @@ var StormConfigSchema = z.object({
|
|
|
224
232
|
packageManager: z.enum(["npm", "yarn", "pnpm", "bun"]).default("npm").describe("The package manager used by the repository"),
|
|
225
233
|
timezone: z.string().trim().default("America/New_York").describe("The default timezone of the workspace"),
|
|
226
234
|
locale: z.string().trim().default("en-US").describe("The default locale of the workspace"),
|
|
227
|
-
logLevel: z.enum(["silent", "fatal", "error", "warn", "info", "debug", "trace"]).default("debug").describe(
|
|
235
|
+
logLevel: z.enum(["silent", "fatal", "error", "warn", "info", "debug", "trace", "all"]).default("debug").describe(
|
|
228
236
|
"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`)."
|
|
229
237
|
),
|
|
230
238
|
configFile: z.string().trim().nullable().default(null).describe(
|
|
@@ -282,11 +290,21 @@ var getDefaultConfig = (config = {}, root) => {
|
|
|
282
290
|
});
|
|
283
291
|
if (file) {
|
|
284
292
|
const packageJson = JSON.parse(file);
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
293
|
+
if (packageJson.name) {
|
|
294
|
+
name = packageJson.name;
|
|
295
|
+
}
|
|
296
|
+
if (packageJson.namespace) {
|
|
297
|
+
namespace = packageJson.namespace;
|
|
298
|
+
}
|
|
299
|
+
if (packageJson.repository?.url) {
|
|
300
|
+
repository = packageJson.repository?.url;
|
|
301
|
+
}
|
|
302
|
+
if (packageJson.license) {
|
|
303
|
+
license = packageJson.license;
|
|
304
|
+
}
|
|
305
|
+
if (packageJson.homepage) {
|
|
306
|
+
homepage = packageJson.homepage;
|
|
307
|
+
}
|
|
290
308
|
}
|
|
291
309
|
}
|
|
292
310
|
return StormConfigSchema.parse({
|
|
@@ -308,6 +326,8 @@ var getDefaultConfig = (config = {}, root) => {
|
|
|
308
326
|
// packages/config-tools/src/utilities/get-log-level.ts
|
|
309
327
|
var getLogLevel = (label) => {
|
|
310
328
|
switch (label) {
|
|
329
|
+
case "all":
|
|
330
|
+
return LogLevel.ALL;
|
|
311
331
|
case "trace":
|
|
312
332
|
return LogLevel.TRACE;
|
|
313
333
|
case "debug":
|
|
@@ -327,38 +347,131 @@ var getLogLevel = (label) => {
|
|
|
327
347
|
}
|
|
328
348
|
};
|
|
329
349
|
var getLogLevelLabel = (logLevel) => {
|
|
350
|
+
if (logLevel >= LogLevel.ALL) {
|
|
351
|
+
return LogLevelLabel.ALL;
|
|
352
|
+
}
|
|
330
353
|
if (logLevel >= LogLevel.TRACE) {
|
|
331
354
|
return LogLevelLabel.TRACE;
|
|
332
|
-
}
|
|
355
|
+
}
|
|
356
|
+
if (logLevel >= LogLevel.DEBUG) {
|
|
333
357
|
return LogLevelLabel.DEBUG;
|
|
334
|
-
}
|
|
358
|
+
}
|
|
359
|
+
if (logLevel >= LogLevel.INFO) {
|
|
335
360
|
return LogLevelLabel.INFO;
|
|
336
|
-
}
|
|
361
|
+
}
|
|
362
|
+
if (logLevel >= LogLevel.WARN) {
|
|
337
363
|
return LogLevelLabel.WARN;
|
|
338
|
-
}
|
|
364
|
+
}
|
|
365
|
+
if (logLevel >= LogLevel.ERROR) {
|
|
339
366
|
return LogLevelLabel.ERROR;
|
|
340
|
-
}
|
|
367
|
+
}
|
|
368
|
+
if (logLevel >= LogLevel.FATAL) {
|
|
341
369
|
return LogLevelLabel.FATAL;
|
|
342
|
-
}
|
|
370
|
+
}
|
|
371
|
+
if (logLevel <= LogLevel.SILENT) {
|
|
343
372
|
return LogLevelLabel.SILENT;
|
|
344
|
-
} else {
|
|
345
|
-
return LogLevelLabel.INFO;
|
|
346
373
|
}
|
|
374
|
+
return LogLevelLabel.INFO;
|
|
347
375
|
};
|
|
348
376
|
|
|
377
|
+
// packages/config-tools/src/utilities/logger.ts
|
|
378
|
+
var chalk = __toESM(require("chalk"), 1);
|
|
379
|
+
var getLogFn = (config = {}, logLevel = LogLevel.INFO) => {
|
|
380
|
+
if (typeof logLevel === "number" && (logLevel >= getLogLevel(config.logLevel ?? process.env?.STORM_LOG_LEVEL) || logLevel <= LogLevel.SILENT) || typeof logLevel === "string" && getLogLevel(logLevel) >= getLogLevel(config.logLevel ?? process.env?.STORM_LOG_LEVEL)) {
|
|
381
|
+
return (message) => {
|
|
382
|
+
};
|
|
383
|
+
}
|
|
384
|
+
if (typeof logLevel === "number" && LogLevel.FATAL >= logLevel || typeof logLevel === "string" && LogLevel.FATAL >= getLogLevel(logLevel)) {
|
|
385
|
+
return (message) => {
|
|
386
|
+
console.error(
|
|
387
|
+
` ${chalk.bold.bgHex(config?.colors?.fatal ? config.colors.fatal : "#1fb2a6").inverse("\n\n \u{1F480} Fatal ")} ${chalk.reset.hex(
|
|
388
|
+
config?.colors?.fatal ? config.colors.fatal : "#1fb2a6"
|
|
389
|
+
)(message)}
|
|
390
|
+
`
|
|
391
|
+
);
|
|
392
|
+
};
|
|
393
|
+
}
|
|
394
|
+
if (typeof logLevel === "number" && LogLevel.ERROR >= logLevel || typeof logLevel === "string" && LogLevel.ERROR >= getLogLevel(logLevel)) {
|
|
395
|
+
return (message) => {
|
|
396
|
+
console.error(
|
|
397
|
+
` ${chalk.bold.bgHex(config?.colors?.error ? config.colors.error : "#7d1a1a").inverse("\n\n \u{1F6D1} Error ")} ${chalk.reset.hex(
|
|
398
|
+
config?.colors?.error ? config.colors.error : "#7d1a1a"
|
|
399
|
+
)(message)}
|
|
400
|
+
`
|
|
401
|
+
);
|
|
402
|
+
};
|
|
403
|
+
}
|
|
404
|
+
if (typeof logLevel === "number" && LogLevel.WARN >= logLevel || typeof logLevel === "string" && LogLevel.WARN >= getLogLevel(logLevel)) {
|
|
405
|
+
return (message) => {
|
|
406
|
+
console.warn(
|
|
407
|
+
` ${chalk.bold.bgHex(config?.colors?.warning ? config.colors.warning : "#fcc419").inverse("\n\n \u26A0\uFE0F Warn ")} ${chalk.reset.hex(
|
|
408
|
+
config?.colors?.warning ? config.colors.warning : "#fcc419"
|
|
409
|
+
)(message)}
|
|
410
|
+
`
|
|
411
|
+
);
|
|
412
|
+
};
|
|
413
|
+
}
|
|
414
|
+
if (typeof logLevel === "number" && LogLevel.INFO >= logLevel || typeof logLevel === "string" && LogLevel.INFO >= getLogLevel(logLevel)) {
|
|
415
|
+
return (message) => {
|
|
416
|
+
console.info(
|
|
417
|
+
` ${chalk.bold.bgHex(config?.colors?.info ? config.colors.info : "#0ea5e9").inverse("\n\n \u{1F4EC} Info ")} ${chalk.reset.hex(
|
|
418
|
+
config?.colors?.info ? config.colors.info : "#0ea5e9"
|
|
419
|
+
)(message)}
|
|
420
|
+
`
|
|
421
|
+
);
|
|
422
|
+
};
|
|
423
|
+
}
|
|
424
|
+
if (typeof logLevel === "number" && LogLevel.INFO >= logLevel || typeof logLevel === "string" && LogLevel.INFO >= getLogLevel(logLevel)) {
|
|
425
|
+
return (message) => {
|
|
426
|
+
console.info(
|
|
427
|
+
` ${chalk.bold.bgHex(config?.colors?.success ? config.colors.success : "#087f5b").inverse("\n\n \u{1F389} Success ")} ${chalk.reset.hex(
|
|
428
|
+
config?.colors?.success ? config.colors.success : "#087f5b"
|
|
429
|
+
)(message)}
|
|
430
|
+
`
|
|
431
|
+
);
|
|
432
|
+
};
|
|
433
|
+
}
|
|
434
|
+
if (typeof logLevel === "number" && LogLevel.DEBUG >= logLevel || typeof logLevel === "string" && LogLevel.DEBUG >= getLogLevel(logLevel)) {
|
|
435
|
+
return (message) => {
|
|
436
|
+
console.debug(
|
|
437
|
+
` ${chalk.bold.bgHex(config?.colors?.primary ? config.colors.primary : "#1fb2a6").inverse("\n\n \u{1F9EA} Debug ")} ${chalk.reset.hex(
|
|
438
|
+
config?.colors?.primary ? config.colors.primary : "#1fb2a6"
|
|
439
|
+
)(message)}
|
|
440
|
+
`
|
|
441
|
+
);
|
|
442
|
+
};
|
|
443
|
+
}
|
|
444
|
+
return (message) => {
|
|
445
|
+
console.log(
|
|
446
|
+
` ${chalk.bold.bgHex(config?.colors?.primary ? config.colors.primary : "#1fb2a6").inverse("\n\n \u{1F4E2} System ")} ${chalk.bold.hex(
|
|
447
|
+
config?.colors?.primary ? config.colors.primary : "#1fb2a6"
|
|
448
|
+
)(message)}
|
|
449
|
+
`
|
|
450
|
+
);
|
|
451
|
+
};
|
|
452
|
+
};
|
|
453
|
+
var writeFatal = (config, message) => getLogFn(config, LogLevel.FATAL)(message);
|
|
454
|
+
var writeError = (config, message) => getLogFn(config, LogLevel.ERROR)(message);
|
|
455
|
+
var writeWarning = (config, message) => getLogFn(config, LogLevel.WARN)(message);
|
|
456
|
+
var writeInfo = (config, message) => getLogFn(config, LogLevel.INFO)(message);
|
|
457
|
+
var writeSuccess = (config, message) => getLogFn(config, LogLevel.SUCCESS)(message);
|
|
458
|
+
var writeDebug = (config, message) => getLogFn(config, LogLevel.DEBUG)(message);
|
|
459
|
+
var writeTrace = (config, message) => getLogFn(config, LogLevel.TRACE)(message);
|
|
460
|
+
var writeSystem = (config, message) => getLogFn(config, LogLevel.ALL)(message);
|
|
461
|
+
|
|
349
462
|
// packages/config-tools/src/env/get-env.ts
|
|
350
463
|
var getExtensionEnv = (extensionName) => {
|
|
351
464
|
const prefix = `STORM_EXTENSION_${extensionName.toUpperCase()}_`;
|
|
352
465
|
return Object.keys(process.env).filter((key) => key.startsWith(prefix)).reduce((ret, key) => {
|
|
353
|
-
const name = key.replace(prefix, "").split("_").map(
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
466
|
+
const name = key.replace(prefix, "").split("_").map((i) => i.length > 0 ? i.trim().charAt(0).toUpperCase() + i.trim().slice(1) : "").join("");
|
|
467
|
+
if (name) {
|
|
468
|
+
ret[name] = process.env[key];
|
|
469
|
+
}
|
|
357
470
|
return ret;
|
|
358
471
|
}, {});
|
|
359
472
|
};
|
|
360
473
|
var getConfigEnv = () => {
|
|
361
|
-
const prefix =
|
|
474
|
+
const prefix = "STORM_";
|
|
362
475
|
let config = {
|
|
363
476
|
name: process.env[`${prefix}NAME`],
|
|
364
477
|
namespace: process.env[`${prefix}NAMESPACE`],
|
|
@@ -377,9 +490,7 @@ var getConfigEnv = () => {
|
|
|
377
490
|
runtimeVersion: process.env[`${prefix}RUNTIME_VERSION`],
|
|
378
491
|
runtimeDirectory: process.env[`${prefix}RUNTIME_DIRECTORY`],
|
|
379
492
|
env: process.env[`${prefix}ENV`] ?? process.env.NODE_ENV ?? process.env.ENVIRONMENT,
|
|
380
|
-
ci: Boolean(
|
|
381
|
-
process.env[`${prefix}CI`] ?? process.env.CI ?? process.env.CONTINUOUS_INTEGRATION
|
|
382
|
-
),
|
|
493
|
+
ci: Boolean(process.env[`${prefix}CI`] ?? process.env.CI ?? process.env.CONTINUOUS_INTEGRATION),
|
|
383
494
|
colors: {
|
|
384
495
|
primary: process.env[`${prefix}COLOR_PRIMARY`],
|
|
385
496
|
background: process.env[`${prefix}COLOR_BACKGROUND`],
|
|
@@ -392,9 +503,7 @@ var getConfigEnv = () => {
|
|
|
392
503
|
repository: process.env[`${prefix}REPOSITORY`],
|
|
393
504
|
branch: process.env[`${prefix}BRANCH`],
|
|
394
505
|
preMajor: Boolean(process.env[`${prefix}PRE_MAJOR`]),
|
|
395
|
-
logLevel: process.env[`${prefix}LOG_LEVEL`] !== null && process.env[`${prefix}LOG_LEVEL`] !== void 0 ? Number.isSafeInteger(
|
|
396
|
-
Number.parseInt(process.env[`${prefix}LOG_LEVEL`])
|
|
397
|
-
) ? getLogLevelLabel(Number.parseInt(process.env[`${prefix}LOG_LEVEL`])) : process.env[`${prefix}LOG_LEVEL`] : LogLevelLabel.INFO,
|
|
506
|
+
logLevel: process.env[`${prefix}LOG_LEVEL`] !== null && process.env[`${prefix}LOG_LEVEL`] !== void 0 ? Number.isSafeInteger(Number.parseInt(process.env[`${prefix}LOG_LEVEL`])) ? getLogLevelLabel(Number.parseInt(process.env[`${prefix}LOG_LEVEL`])) : process.env[`${prefix}LOG_LEVEL`] : LogLevelLabel.INFO,
|
|
398
507
|
extensions: {}
|
|
399
508
|
};
|
|
400
509
|
const serializedConfig = process.env[`${prefix}CONFIG`];
|
|
@@ -409,26 +518,27 @@ var getConfigEnv = () => {
|
|
|
409
518
|
}
|
|
410
519
|
const extensionPrefix = `${prefix}EXTENSION_`;
|
|
411
520
|
return Object.keys(process.env).filter((key) => key.startsWith(extensionPrefix)).reduce((ret, key) => {
|
|
412
|
-
const extensionName = key.substring(prefix.length, key.indexOf("_", prefix.length)).split("_").map(
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
521
|
+
const extensionName = key.substring(prefix.length, key.indexOf("_", prefix.length)).split("_").map((i) => i.length > 0 ? i.trim().charAt(0).toUpperCase() + i.trim().slice(1) : "").join("");
|
|
522
|
+
if (extensionName) {
|
|
523
|
+
ret.extensions[extensionName] = getExtensionEnv(extensionName);
|
|
524
|
+
}
|
|
416
525
|
return ret;
|
|
417
526
|
}, config);
|
|
418
527
|
};
|
|
419
528
|
|
|
420
529
|
// packages/config-tools/src/env/set-env.ts
|
|
421
530
|
var setExtensionEnv = (extensionName, extension) => {
|
|
422
|
-
Object.keys(extension ?? {})
|
|
531
|
+
for (const key of Object.keys(extension ?? {})) {
|
|
423
532
|
if (extension[key]) {
|
|
424
|
-
|
|
533
|
+
const result = key?.replace(
|
|
425
534
|
/([A-Z])+/g,
|
|
426
535
|
(input) => input ? input[0].toUpperCase() + input.slice(1) : ""
|
|
427
536
|
).split(/(?=[A-Z])|[\.\-\s_]/).map((x) => x.toLowerCase()) ?? [];
|
|
428
537
|
let extensionKey;
|
|
429
538
|
if (result.length === 0) {
|
|
430
539
|
return;
|
|
431
|
-
}
|
|
540
|
+
}
|
|
541
|
+
if (result.length === 1) {
|
|
432
542
|
extensionKey = result[0].toUpperCase();
|
|
433
543
|
} else {
|
|
434
544
|
extensionKey = result.reduce((ret, part) => {
|
|
@@ -437,59 +547,117 @@ var setExtensionEnv = (extensionName, extension) => {
|
|
|
437
547
|
}
|
|
438
548
|
process.env[`STORM_EXTENSION_${extensionName.toUpperCase()}_${extensionKey.toUpperCase()}`] = extension[key];
|
|
439
549
|
}
|
|
440
|
-
}
|
|
550
|
+
}
|
|
441
551
|
};
|
|
442
552
|
var setConfigEnv = (config) => {
|
|
443
|
-
const prefix =
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
)
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
553
|
+
const prefix = "STORM_";
|
|
554
|
+
if (config.name) {
|
|
555
|
+
process.env[`${prefix}NAME`] = config.name;
|
|
556
|
+
}
|
|
557
|
+
if (config.namespace) {
|
|
558
|
+
process.env[`${prefix}NAMESPACE`] = config.namespace;
|
|
559
|
+
}
|
|
560
|
+
if (config.owner) {
|
|
561
|
+
process.env[`${prefix}OWNER`] = config.owner;
|
|
562
|
+
}
|
|
563
|
+
if (config.worker) {
|
|
564
|
+
process.env[`${prefix}WORKER`] = config.worker;
|
|
565
|
+
}
|
|
566
|
+
if (config.organization) {
|
|
567
|
+
process.env[`${prefix}ORGANIZATION`] = config.organization;
|
|
568
|
+
}
|
|
569
|
+
if (config.packageManager) {
|
|
570
|
+
process.env[`${prefix}PACKAGE_MANAGER`] = config.packageManager;
|
|
571
|
+
}
|
|
572
|
+
if (config.license) {
|
|
573
|
+
process.env[`${prefix}LICENSE`] = config.license;
|
|
574
|
+
}
|
|
575
|
+
if (config.homepage) {
|
|
576
|
+
process.env[`${prefix}HOMEPAGE`] = config.homepage;
|
|
577
|
+
}
|
|
578
|
+
if (config.timezone) {
|
|
579
|
+
process.env[`${prefix}TIMEZONE`] = config.timezone;
|
|
580
|
+
process.env.TZ = config.timezone;
|
|
581
|
+
process.env.DEFAULT_TIMEZONE = config.timezone;
|
|
582
|
+
}
|
|
583
|
+
if (config.locale) {
|
|
584
|
+
process.env[`${prefix}LOCALE`] = config.locale;
|
|
585
|
+
process.env.LOCALE = config.locale;
|
|
586
|
+
process.env.DEFAULT_LOCALE = config.locale;
|
|
587
|
+
process.env.LANG = config.locale ? `${config.locale.replaceAll("-", "_")}.UTF-8` : "en_US.UTF-8";
|
|
588
|
+
}
|
|
589
|
+
if (config.configFile) {
|
|
590
|
+
process.env[`${prefix}CONFIG_FILE`] = config.configFile;
|
|
591
|
+
}
|
|
592
|
+
if (config.workspaceRoot) {
|
|
593
|
+
process.env[`${prefix}WORKSPACE_ROOT`] = config.workspaceRoot;
|
|
594
|
+
process.env.NX_WORKSPACE_ROOT = config.workspaceRoot;
|
|
595
|
+
process.env.NX_WORKSPACE_ROOT_PATH = config.workspaceRoot;
|
|
596
|
+
}
|
|
597
|
+
if (config.packageDirectory) {
|
|
598
|
+
process.env[`${prefix}PACKAGE_DIRECTORY`] = config.packageDirectory;
|
|
599
|
+
}
|
|
600
|
+
if (config.buildDirectory) {
|
|
601
|
+
process.env[`${prefix}BUILD_DIRECTORY`] = config.buildDirectory;
|
|
602
|
+
}
|
|
603
|
+
if (config.runtimeVersion) {
|
|
604
|
+
process.env[`${prefix}RUNTIME_VERSION`] = config.runtimeVersion;
|
|
605
|
+
}
|
|
606
|
+
if (config.runtimeDirectory) {
|
|
607
|
+
process.env[`${prefix}RUNTIME_DIRECTORY`] = config.runtimeDirectory;
|
|
608
|
+
}
|
|
609
|
+
if (config.env) {
|
|
610
|
+
process.env[`${prefix}ENV`] = config.env;
|
|
611
|
+
process.env.NODE_ENV = config.env;
|
|
612
|
+
process.env.ENVIRONMENT = config.env;
|
|
613
|
+
}
|
|
614
|
+
if (config.ci) {
|
|
615
|
+
process.env[`${prefix}CI`] = String(config.ci);
|
|
616
|
+
process.env.CI = String(config.ci);
|
|
617
|
+
process.env.CONTINUOUS_INTEGRATION = String(config.ci);
|
|
618
|
+
}
|
|
619
|
+
if (config.colors.primary) {
|
|
620
|
+
process.env[`${prefix}COLOR_PRIMARY`] = config.colors.primary;
|
|
621
|
+
}
|
|
622
|
+
if (config.colors.background) {
|
|
623
|
+
process.env[`${prefix}COLOR_BACKGROUND`] = config.colors.background;
|
|
624
|
+
}
|
|
625
|
+
if (config.colors.success) {
|
|
626
|
+
process.env[`${prefix}COLOR_SUCCESS`] = config.colors.success;
|
|
627
|
+
}
|
|
628
|
+
if (config.colors.info) {
|
|
629
|
+
process.env[`${prefix}COLOR_INFO`] = config.colors.info;
|
|
630
|
+
}
|
|
631
|
+
if (config.colors.warning) {
|
|
632
|
+
process.env[`${prefix}COLOR_WARNING`] = config.colors.warning;
|
|
633
|
+
}
|
|
634
|
+
if (config.colors.error) {
|
|
635
|
+
process.env[`${prefix}COLOR_ERROR`] = config.colors.error;
|
|
636
|
+
}
|
|
637
|
+
if (config.colors.fatal) {
|
|
638
|
+
process.env[`${prefix}COLOR_FATAL`] = config.colors.fatal;
|
|
639
|
+
}
|
|
640
|
+
if (config.repository) {
|
|
641
|
+
process.env[`${prefix}REPOSITORY`] = config.repository;
|
|
642
|
+
}
|
|
643
|
+
if (config.branch) {
|
|
644
|
+
process.env[`${prefix}BRANCH`] = config.branch;
|
|
645
|
+
}
|
|
646
|
+
if (config.preMajor) {
|
|
647
|
+
process.env[`${prefix}PRE_MAJOR`] = String(config.preMajor);
|
|
648
|
+
}
|
|
649
|
+
if (config.logLevel) {
|
|
650
|
+
process.env[`${prefix}LOG_LEVEL`] = String(config.logLevel);
|
|
651
|
+
process.env.LOG_LEVEL = String(config.logLevel);
|
|
652
|
+
process.env.NX_VERBOSE_LOGGING = String(
|
|
653
|
+
getLogLevel(config.logLevel) >= LogLevel.DEBUG ? true : false
|
|
654
|
+
);
|
|
655
|
+
process.env.RUST_BACKTRACE = getLogLevel(config.logLevel) >= LogLevel.DEBUG ? "full" : "none";
|
|
656
|
+
}
|
|
657
|
+
process.env[`${prefix}CONFIG`] = JSON.stringify(config);
|
|
658
|
+
for (const key of Object.keys(config.extensions ?? {})) {
|
|
491
659
|
config.extensions[key] && Object.keys(config.extensions[key]) && setExtensionEnv(key, config.extensions[key]);
|
|
492
|
-
}
|
|
660
|
+
}
|
|
493
661
|
};
|
|
494
662
|
|
|
495
663
|
// packages/config-tools/src/create-storm-config.ts
|
|
@@ -501,7 +669,7 @@ var createConfig = (workspaceRoot) => {
|
|
|
501
669
|
var createStormConfig = (extensionName, schema, workspaceRoot) => {
|
|
502
670
|
let result;
|
|
503
671
|
if (!_static_cache2) {
|
|
504
|
-
|
|
672
|
+
const config = getConfigEnv();
|
|
505
673
|
const defaultConfig = getDefaultConfig(config, workspaceRoot);
|
|
506
674
|
result = StormConfigSchema.parse({
|
|
507
675
|
...defaultConfig,
|
|
@@ -517,7 +685,10 @@ var createStormConfig = (extensionName, schema, workspaceRoot) => {
|
|
|
517
685
|
if (schema && extensionName) {
|
|
518
686
|
result.extensions = {
|
|
519
687
|
...result.extensions,
|
|
520
|
-
[extensionName]: createConfigExtension(
|
|
688
|
+
[extensionName]: createConfigExtension(
|
|
689
|
+
extensionName,
|
|
690
|
+
schema
|
|
691
|
+
)
|
|
521
692
|
};
|
|
522
693
|
}
|
|
523
694
|
_static_cache2 = result;
|
|
@@ -568,9 +739,18 @@ var loadStormConfig = async (workspaceRoot) => {
|
|
|
568
739
|
getConfigFile,
|
|
569
740
|
getDefaultConfig,
|
|
570
741
|
getExtensionEnv,
|
|
742
|
+
getLogFn,
|
|
571
743
|
getLogLevel,
|
|
572
744
|
getLogLevelLabel,
|
|
573
745
|
loadStormConfig,
|
|
574
746
|
setConfigEnv,
|
|
575
|
-
setExtensionEnv
|
|
747
|
+
setExtensionEnv,
|
|
748
|
+
writeDebug,
|
|
749
|
+
writeError,
|
|
750
|
+
writeFatal,
|
|
751
|
+
writeInfo,
|
|
752
|
+
writeSuccess,
|
|
753
|
+
writeSystem,
|
|
754
|
+
writeTrace,
|
|
755
|
+
writeWarning
|
|
576
756
|
});
|
package/index.js
CHANGED
|
@@ -44,8 +44,10 @@ var LogLevel = {
|
|
|
44
44
|
ERROR: 20,
|
|
45
45
|
WARN: 30,
|
|
46
46
|
INFO: 40,
|
|
47
|
+
SUCCESS: 45,
|
|
47
48
|
DEBUG: 60,
|
|
48
|
-
TRACE: 70
|
|
49
|
+
TRACE: 70,
|
|
50
|
+
ALL: 100
|
|
49
51
|
};
|
|
50
52
|
var LogLevelLabel = {
|
|
51
53
|
SILENT: "silent",
|
|
@@ -54,7 +56,8 @@ var LogLevelLabel = {
|
|
|
54
56
|
WARN: "warn",
|
|
55
57
|
INFO: "info",
|
|
56
58
|
DEBUG: "debug",
|
|
57
|
-
TRACE: "trace"
|
|
59
|
+
TRACE: "trace",
|
|
60
|
+
ALL: "all"
|
|
58
61
|
};
|
|
59
62
|
|
|
60
63
|
// packages/config-tools/src/utilities/find-up.ts
|
|
@@ -63,15 +66,15 @@ import { join } from "path";
|
|
|
63
66
|
var MAX_PATH_SEARCH_DEPTH = 30;
|
|
64
67
|
var depth = 0;
|
|
65
68
|
function findFolderUp(startPath, endFileNames) {
|
|
66
|
-
|
|
67
|
-
if (endFileNames.some((endFileName) => existsSync(join(
|
|
68
|
-
return
|
|
69
|
-
}
|
|
70
|
-
|
|
69
|
+
const _startPath = startPath ?? process.cwd();
|
|
70
|
+
if (endFileNames.some((endFileName) => existsSync(join(_startPath, endFileName)))) {
|
|
71
|
+
return _startPath;
|
|
72
|
+
}
|
|
73
|
+
if (_startPath !== "/" && depth++ < MAX_PATH_SEARCH_DEPTH) {
|
|
74
|
+
const parent = join(_startPath, "..");
|
|
71
75
|
return findFolderUp(parent, endFileNames);
|
|
72
|
-
} else {
|
|
73
|
-
return void 0;
|
|
74
76
|
}
|
|
77
|
+
return void 0;
|
|
75
78
|
}
|
|
76
79
|
|
|
77
80
|
// packages/config-tools/src/utilities/find-workspace-root.ts
|
|
@@ -149,17 +152,13 @@ var StormConfigSchema = z.object({
|
|
|
149
152
|
license: z.string().trim().default("Apache License 2.0").describe("The root directory of the package"),
|
|
150
153
|
homepage: z.string().trim().url().default("https://stormsoftware.org").describe("The homepage of the workspace"),
|
|
151
154
|
branch: z.string().trim().default("main").describe("The branch of the workspace"),
|
|
152
|
-
preMajor: z.boolean().default(false).describe(
|
|
153
|
-
"An indicator specifying if the package is still in it's pre-major version"
|
|
154
|
-
),
|
|
155
|
+
preMajor: z.boolean().default(false).describe("An indicator specifying if the package is still in it's pre-major version"),
|
|
155
156
|
owner: z.string().trim().default("@storm-software/development").describe("The owner of the package"),
|
|
156
157
|
worker: z.string().trim().default("stormie-bot").describe(
|
|
157
158
|
"The worker of the package (this is the bot that will be used to perform various tasks)"
|
|
158
159
|
),
|
|
159
160
|
env: z.enum(["development", "staging", "production"]).default("production").describe("The current runtime environment of the package"),
|
|
160
|
-
ci: z.boolean().default(true).describe(
|
|
161
|
-
"An indicator specifying if the current environment is a CI environment"
|
|
162
|
-
),
|
|
161
|
+
ci: z.boolean().default(true).describe("An indicator specifying if the current environment is a CI environment"),
|
|
163
162
|
workspaceRoot: z.string().trim().optional().describe("The root directory of the workspace"),
|
|
164
163
|
packageDirectory: z.string().trim().optional().describe("The root directory of the package"),
|
|
165
164
|
buildDirectory: z.string().trim().default("dist").describe("The build directory for the workspace"),
|
|
@@ -170,7 +169,7 @@ var StormConfigSchema = z.object({
|
|
|
170
169
|
packageManager: z.enum(["npm", "yarn", "pnpm", "bun"]).default("npm").describe("The package manager used by the repository"),
|
|
171
170
|
timezone: z.string().trim().default("America/New_York").describe("The default timezone of the workspace"),
|
|
172
171
|
locale: z.string().trim().default("en-US").describe("The default locale of the workspace"),
|
|
173
|
-
logLevel: z.enum(["silent", "fatal", "error", "warn", "info", "debug", "trace"]).default("debug").describe(
|
|
172
|
+
logLevel: z.enum(["silent", "fatal", "error", "warn", "info", "debug", "trace", "all"]).default("debug").describe(
|
|
174
173
|
"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`)."
|
|
175
174
|
),
|
|
176
175
|
configFile: z.string().trim().nullable().default(null).describe(
|
|
@@ -228,11 +227,21 @@ var getDefaultConfig = (config = {}, root) => {
|
|
|
228
227
|
});
|
|
229
228
|
if (file) {
|
|
230
229
|
const packageJson = JSON.parse(file);
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
230
|
+
if (packageJson.name) {
|
|
231
|
+
name = packageJson.name;
|
|
232
|
+
}
|
|
233
|
+
if (packageJson.namespace) {
|
|
234
|
+
namespace = packageJson.namespace;
|
|
235
|
+
}
|
|
236
|
+
if (packageJson.repository?.url) {
|
|
237
|
+
repository = packageJson.repository?.url;
|
|
238
|
+
}
|
|
239
|
+
if (packageJson.license) {
|
|
240
|
+
license = packageJson.license;
|
|
241
|
+
}
|
|
242
|
+
if (packageJson.homepage) {
|
|
243
|
+
homepage = packageJson.homepage;
|
|
244
|
+
}
|
|
236
245
|
}
|
|
237
246
|
}
|
|
238
247
|
return StormConfigSchema.parse({
|
|
@@ -254,6 +263,8 @@ var getDefaultConfig = (config = {}, root) => {
|
|
|
254
263
|
// packages/config-tools/src/utilities/get-log-level.ts
|
|
255
264
|
var getLogLevel = (label) => {
|
|
256
265
|
switch (label) {
|
|
266
|
+
case "all":
|
|
267
|
+
return LogLevel.ALL;
|
|
257
268
|
case "trace":
|
|
258
269
|
return LogLevel.TRACE;
|
|
259
270
|
case "debug":
|
|
@@ -273,38 +284,131 @@ var getLogLevel = (label) => {
|
|
|
273
284
|
}
|
|
274
285
|
};
|
|
275
286
|
var getLogLevelLabel = (logLevel) => {
|
|
287
|
+
if (logLevel >= LogLevel.ALL) {
|
|
288
|
+
return LogLevelLabel.ALL;
|
|
289
|
+
}
|
|
276
290
|
if (logLevel >= LogLevel.TRACE) {
|
|
277
291
|
return LogLevelLabel.TRACE;
|
|
278
|
-
}
|
|
292
|
+
}
|
|
293
|
+
if (logLevel >= LogLevel.DEBUG) {
|
|
279
294
|
return LogLevelLabel.DEBUG;
|
|
280
|
-
}
|
|
295
|
+
}
|
|
296
|
+
if (logLevel >= LogLevel.INFO) {
|
|
281
297
|
return LogLevelLabel.INFO;
|
|
282
|
-
}
|
|
298
|
+
}
|
|
299
|
+
if (logLevel >= LogLevel.WARN) {
|
|
283
300
|
return LogLevelLabel.WARN;
|
|
284
|
-
}
|
|
301
|
+
}
|
|
302
|
+
if (logLevel >= LogLevel.ERROR) {
|
|
285
303
|
return LogLevelLabel.ERROR;
|
|
286
|
-
}
|
|
304
|
+
}
|
|
305
|
+
if (logLevel >= LogLevel.FATAL) {
|
|
287
306
|
return LogLevelLabel.FATAL;
|
|
288
|
-
}
|
|
307
|
+
}
|
|
308
|
+
if (logLevel <= LogLevel.SILENT) {
|
|
289
309
|
return LogLevelLabel.SILENT;
|
|
290
|
-
} else {
|
|
291
|
-
return LogLevelLabel.INFO;
|
|
292
310
|
}
|
|
311
|
+
return LogLevelLabel.INFO;
|
|
293
312
|
};
|
|
294
313
|
|
|
314
|
+
// packages/config-tools/src/utilities/logger.ts
|
|
315
|
+
import * as chalk from "chalk";
|
|
316
|
+
var getLogFn = (config = {}, logLevel = LogLevel.INFO) => {
|
|
317
|
+
if (typeof logLevel === "number" && (logLevel >= getLogLevel(config.logLevel ?? process.env?.STORM_LOG_LEVEL) || logLevel <= LogLevel.SILENT) || typeof logLevel === "string" && getLogLevel(logLevel) >= getLogLevel(config.logLevel ?? process.env?.STORM_LOG_LEVEL)) {
|
|
318
|
+
return (message) => {
|
|
319
|
+
};
|
|
320
|
+
}
|
|
321
|
+
if (typeof logLevel === "number" && LogLevel.FATAL >= logLevel || typeof logLevel === "string" && LogLevel.FATAL >= getLogLevel(logLevel)) {
|
|
322
|
+
return (message) => {
|
|
323
|
+
console.error(
|
|
324
|
+
` ${chalk.bold.bgHex(config?.colors?.fatal ? config.colors.fatal : "#1fb2a6").inverse("\n\n \u{1F480} Fatal ")} ${chalk.reset.hex(
|
|
325
|
+
config?.colors?.fatal ? config.colors.fatal : "#1fb2a6"
|
|
326
|
+
)(message)}
|
|
327
|
+
`
|
|
328
|
+
);
|
|
329
|
+
};
|
|
330
|
+
}
|
|
331
|
+
if (typeof logLevel === "number" && LogLevel.ERROR >= logLevel || typeof logLevel === "string" && LogLevel.ERROR >= getLogLevel(logLevel)) {
|
|
332
|
+
return (message) => {
|
|
333
|
+
console.error(
|
|
334
|
+
` ${chalk.bold.bgHex(config?.colors?.error ? config.colors.error : "#7d1a1a").inverse("\n\n \u{1F6D1} Error ")} ${chalk.reset.hex(
|
|
335
|
+
config?.colors?.error ? config.colors.error : "#7d1a1a"
|
|
336
|
+
)(message)}
|
|
337
|
+
`
|
|
338
|
+
);
|
|
339
|
+
};
|
|
340
|
+
}
|
|
341
|
+
if (typeof logLevel === "number" && LogLevel.WARN >= logLevel || typeof logLevel === "string" && LogLevel.WARN >= getLogLevel(logLevel)) {
|
|
342
|
+
return (message) => {
|
|
343
|
+
console.warn(
|
|
344
|
+
` ${chalk.bold.bgHex(config?.colors?.warning ? config.colors.warning : "#fcc419").inverse("\n\n \u26A0\uFE0F Warn ")} ${chalk.reset.hex(
|
|
345
|
+
config?.colors?.warning ? config.colors.warning : "#fcc419"
|
|
346
|
+
)(message)}
|
|
347
|
+
`
|
|
348
|
+
);
|
|
349
|
+
};
|
|
350
|
+
}
|
|
351
|
+
if (typeof logLevel === "number" && LogLevel.INFO >= logLevel || typeof logLevel === "string" && LogLevel.INFO >= getLogLevel(logLevel)) {
|
|
352
|
+
return (message) => {
|
|
353
|
+
console.info(
|
|
354
|
+
` ${chalk.bold.bgHex(config?.colors?.info ? config.colors.info : "#0ea5e9").inverse("\n\n \u{1F4EC} Info ")} ${chalk.reset.hex(
|
|
355
|
+
config?.colors?.info ? config.colors.info : "#0ea5e9"
|
|
356
|
+
)(message)}
|
|
357
|
+
`
|
|
358
|
+
);
|
|
359
|
+
};
|
|
360
|
+
}
|
|
361
|
+
if (typeof logLevel === "number" && LogLevel.INFO >= logLevel || typeof logLevel === "string" && LogLevel.INFO >= getLogLevel(logLevel)) {
|
|
362
|
+
return (message) => {
|
|
363
|
+
console.info(
|
|
364
|
+
` ${chalk.bold.bgHex(config?.colors?.success ? config.colors.success : "#087f5b").inverse("\n\n \u{1F389} Success ")} ${chalk.reset.hex(
|
|
365
|
+
config?.colors?.success ? config.colors.success : "#087f5b"
|
|
366
|
+
)(message)}
|
|
367
|
+
`
|
|
368
|
+
);
|
|
369
|
+
};
|
|
370
|
+
}
|
|
371
|
+
if (typeof logLevel === "number" && LogLevel.DEBUG >= logLevel || typeof logLevel === "string" && LogLevel.DEBUG >= getLogLevel(logLevel)) {
|
|
372
|
+
return (message) => {
|
|
373
|
+
console.debug(
|
|
374
|
+
` ${chalk.bold.bgHex(config?.colors?.primary ? config.colors.primary : "#1fb2a6").inverse("\n\n \u{1F9EA} Debug ")} ${chalk.reset.hex(
|
|
375
|
+
config?.colors?.primary ? config.colors.primary : "#1fb2a6"
|
|
376
|
+
)(message)}
|
|
377
|
+
`
|
|
378
|
+
);
|
|
379
|
+
};
|
|
380
|
+
}
|
|
381
|
+
return (message) => {
|
|
382
|
+
console.log(
|
|
383
|
+
` ${chalk.bold.bgHex(config?.colors?.primary ? config.colors.primary : "#1fb2a6").inverse("\n\n \u{1F4E2} System ")} ${chalk.bold.hex(
|
|
384
|
+
config?.colors?.primary ? config.colors.primary : "#1fb2a6"
|
|
385
|
+
)(message)}
|
|
386
|
+
`
|
|
387
|
+
);
|
|
388
|
+
};
|
|
389
|
+
};
|
|
390
|
+
var writeFatal = (config, message) => getLogFn(config, LogLevel.FATAL)(message);
|
|
391
|
+
var writeError = (config, message) => getLogFn(config, LogLevel.ERROR)(message);
|
|
392
|
+
var writeWarning = (config, message) => getLogFn(config, LogLevel.WARN)(message);
|
|
393
|
+
var writeInfo = (config, message) => getLogFn(config, LogLevel.INFO)(message);
|
|
394
|
+
var writeSuccess = (config, message) => getLogFn(config, LogLevel.SUCCESS)(message);
|
|
395
|
+
var writeDebug = (config, message) => getLogFn(config, LogLevel.DEBUG)(message);
|
|
396
|
+
var writeTrace = (config, message) => getLogFn(config, LogLevel.TRACE)(message);
|
|
397
|
+
var writeSystem = (config, message) => getLogFn(config, LogLevel.ALL)(message);
|
|
398
|
+
|
|
295
399
|
// packages/config-tools/src/env/get-env.ts
|
|
296
400
|
var getExtensionEnv = (extensionName) => {
|
|
297
401
|
const prefix = `STORM_EXTENSION_${extensionName.toUpperCase()}_`;
|
|
298
402
|
return Object.keys(process.env).filter((key) => key.startsWith(prefix)).reduce((ret, key) => {
|
|
299
|
-
const name = key.replace(prefix, "").split("_").map(
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
403
|
+
const name = key.replace(prefix, "").split("_").map((i) => i.length > 0 ? i.trim().charAt(0).toUpperCase() + i.trim().slice(1) : "").join("");
|
|
404
|
+
if (name) {
|
|
405
|
+
ret[name] = process.env[key];
|
|
406
|
+
}
|
|
303
407
|
return ret;
|
|
304
408
|
}, {});
|
|
305
409
|
};
|
|
306
410
|
var getConfigEnv = () => {
|
|
307
|
-
const prefix =
|
|
411
|
+
const prefix = "STORM_";
|
|
308
412
|
let config = {
|
|
309
413
|
name: process.env[`${prefix}NAME`],
|
|
310
414
|
namespace: process.env[`${prefix}NAMESPACE`],
|
|
@@ -323,9 +427,7 @@ var getConfigEnv = () => {
|
|
|
323
427
|
runtimeVersion: process.env[`${prefix}RUNTIME_VERSION`],
|
|
324
428
|
runtimeDirectory: process.env[`${prefix}RUNTIME_DIRECTORY`],
|
|
325
429
|
env: process.env[`${prefix}ENV`] ?? process.env.NODE_ENV ?? process.env.ENVIRONMENT,
|
|
326
|
-
ci: Boolean(
|
|
327
|
-
process.env[`${prefix}CI`] ?? process.env.CI ?? process.env.CONTINUOUS_INTEGRATION
|
|
328
|
-
),
|
|
430
|
+
ci: Boolean(process.env[`${prefix}CI`] ?? process.env.CI ?? process.env.CONTINUOUS_INTEGRATION),
|
|
329
431
|
colors: {
|
|
330
432
|
primary: process.env[`${prefix}COLOR_PRIMARY`],
|
|
331
433
|
background: process.env[`${prefix}COLOR_BACKGROUND`],
|
|
@@ -338,9 +440,7 @@ var getConfigEnv = () => {
|
|
|
338
440
|
repository: process.env[`${prefix}REPOSITORY`],
|
|
339
441
|
branch: process.env[`${prefix}BRANCH`],
|
|
340
442
|
preMajor: Boolean(process.env[`${prefix}PRE_MAJOR`]),
|
|
341
|
-
logLevel: process.env[`${prefix}LOG_LEVEL`] !== null && process.env[`${prefix}LOG_LEVEL`] !== void 0 ? Number.isSafeInteger(
|
|
342
|
-
Number.parseInt(process.env[`${prefix}LOG_LEVEL`])
|
|
343
|
-
) ? getLogLevelLabel(Number.parseInt(process.env[`${prefix}LOG_LEVEL`])) : process.env[`${prefix}LOG_LEVEL`] : LogLevelLabel.INFO,
|
|
443
|
+
logLevel: process.env[`${prefix}LOG_LEVEL`] !== null && process.env[`${prefix}LOG_LEVEL`] !== void 0 ? Number.isSafeInteger(Number.parseInt(process.env[`${prefix}LOG_LEVEL`])) ? getLogLevelLabel(Number.parseInt(process.env[`${prefix}LOG_LEVEL`])) : process.env[`${prefix}LOG_LEVEL`] : LogLevelLabel.INFO,
|
|
344
444
|
extensions: {}
|
|
345
445
|
};
|
|
346
446
|
const serializedConfig = process.env[`${prefix}CONFIG`];
|
|
@@ -355,26 +455,27 @@ var getConfigEnv = () => {
|
|
|
355
455
|
}
|
|
356
456
|
const extensionPrefix = `${prefix}EXTENSION_`;
|
|
357
457
|
return Object.keys(process.env).filter((key) => key.startsWith(extensionPrefix)).reduce((ret, key) => {
|
|
358
|
-
const extensionName = key.substring(prefix.length, key.indexOf("_", prefix.length)).split("_").map(
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
458
|
+
const extensionName = key.substring(prefix.length, key.indexOf("_", prefix.length)).split("_").map((i) => i.length > 0 ? i.trim().charAt(0).toUpperCase() + i.trim().slice(1) : "").join("");
|
|
459
|
+
if (extensionName) {
|
|
460
|
+
ret.extensions[extensionName] = getExtensionEnv(extensionName);
|
|
461
|
+
}
|
|
362
462
|
return ret;
|
|
363
463
|
}, config);
|
|
364
464
|
};
|
|
365
465
|
|
|
366
466
|
// packages/config-tools/src/env/set-env.ts
|
|
367
467
|
var setExtensionEnv = (extensionName, extension) => {
|
|
368
|
-
Object.keys(extension ?? {})
|
|
468
|
+
for (const key of Object.keys(extension ?? {})) {
|
|
369
469
|
if (extension[key]) {
|
|
370
|
-
|
|
470
|
+
const result = key?.replace(
|
|
371
471
|
/([A-Z])+/g,
|
|
372
472
|
(input) => input ? input[0].toUpperCase() + input.slice(1) : ""
|
|
373
473
|
).split(/(?=[A-Z])|[\.\-\s_]/).map((x) => x.toLowerCase()) ?? [];
|
|
374
474
|
let extensionKey;
|
|
375
475
|
if (result.length === 0) {
|
|
376
476
|
return;
|
|
377
|
-
}
|
|
477
|
+
}
|
|
478
|
+
if (result.length === 1) {
|
|
378
479
|
extensionKey = result[0].toUpperCase();
|
|
379
480
|
} else {
|
|
380
481
|
extensionKey = result.reduce((ret, part) => {
|
|
@@ -383,59 +484,117 @@ var setExtensionEnv = (extensionName, extension) => {
|
|
|
383
484
|
}
|
|
384
485
|
process.env[`STORM_EXTENSION_${extensionName.toUpperCase()}_${extensionKey.toUpperCase()}`] = extension[key];
|
|
385
486
|
}
|
|
386
|
-
}
|
|
487
|
+
}
|
|
387
488
|
};
|
|
388
489
|
var setConfigEnv = (config) => {
|
|
389
|
-
const prefix =
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
)
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
490
|
+
const prefix = "STORM_";
|
|
491
|
+
if (config.name) {
|
|
492
|
+
process.env[`${prefix}NAME`] = config.name;
|
|
493
|
+
}
|
|
494
|
+
if (config.namespace) {
|
|
495
|
+
process.env[`${prefix}NAMESPACE`] = config.namespace;
|
|
496
|
+
}
|
|
497
|
+
if (config.owner) {
|
|
498
|
+
process.env[`${prefix}OWNER`] = config.owner;
|
|
499
|
+
}
|
|
500
|
+
if (config.worker) {
|
|
501
|
+
process.env[`${prefix}WORKER`] = config.worker;
|
|
502
|
+
}
|
|
503
|
+
if (config.organization) {
|
|
504
|
+
process.env[`${prefix}ORGANIZATION`] = config.organization;
|
|
505
|
+
}
|
|
506
|
+
if (config.packageManager) {
|
|
507
|
+
process.env[`${prefix}PACKAGE_MANAGER`] = config.packageManager;
|
|
508
|
+
}
|
|
509
|
+
if (config.license) {
|
|
510
|
+
process.env[`${prefix}LICENSE`] = config.license;
|
|
511
|
+
}
|
|
512
|
+
if (config.homepage) {
|
|
513
|
+
process.env[`${prefix}HOMEPAGE`] = config.homepage;
|
|
514
|
+
}
|
|
515
|
+
if (config.timezone) {
|
|
516
|
+
process.env[`${prefix}TIMEZONE`] = config.timezone;
|
|
517
|
+
process.env.TZ = config.timezone;
|
|
518
|
+
process.env.DEFAULT_TIMEZONE = config.timezone;
|
|
519
|
+
}
|
|
520
|
+
if (config.locale) {
|
|
521
|
+
process.env[`${prefix}LOCALE`] = config.locale;
|
|
522
|
+
process.env.LOCALE = config.locale;
|
|
523
|
+
process.env.DEFAULT_LOCALE = config.locale;
|
|
524
|
+
process.env.LANG = config.locale ? `${config.locale.replaceAll("-", "_")}.UTF-8` : "en_US.UTF-8";
|
|
525
|
+
}
|
|
526
|
+
if (config.configFile) {
|
|
527
|
+
process.env[`${prefix}CONFIG_FILE`] = config.configFile;
|
|
528
|
+
}
|
|
529
|
+
if (config.workspaceRoot) {
|
|
530
|
+
process.env[`${prefix}WORKSPACE_ROOT`] = config.workspaceRoot;
|
|
531
|
+
process.env.NX_WORKSPACE_ROOT = config.workspaceRoot;
|
|
532
|
+
process.env.NX_WORKSPACE_ROOT_PATH = config.workspaceRoot;
|
|
533
|
+
}
|
|
534
|
+
if (config.packageDirectory) {
|
|
535
|
+
process.env[`${prefix}PACKAGE_DIRECTORY`] = config.packageDirectory;
|
|
536
|
+
}
|
|
537
|
+
if (config.buildDirectory) {
|
|
538
|
+
process.env[`${prefix}BUILD_DIRECTORY`] = config.buildDirectory;
|
|
539
|
+
}
|
|
540
|
+
if (config.runtimeVersion) {
|
|
541
|
+
process.env[`${prefix}RUNTIME_VERSION`] = config.runtimeVersion;
|
|
542
|
+
}
|
|
543
|
+
if (config.runtimeDirectory) {
|
|
544
|
+
process.env[`${prefix}RUNTIME_DIRECTORY`] = config.runtimeDirectory;
|
|
545
|
+
}
|
|
546
|
+
if (config.env) {
|
|
547
|
+
process.env[`${prefix}ENV`] = config.env;
|
|
548
|
+
process.env.NODE_ENV = config.env;
|
|
549
|
+
process.env.ENVIRONMENT = config.env;
|
|
550
|
+
}
|
|
551
|
+
if (config.ci) {
|
|
552
|
+
process.env[`${prefix}CI`] = String(config.ci);
|
|
553
|
+
process.env.CI = String(config.ci);
|
|
554
|
+
process.env.CONTINUOUS_INTEGRATION = String(config.ci);
|
|
555
|
+
}
|
|
556
|
+
if (config.colors.primary) {
|
|
557
|
+
process.env[`${prefix}COLOR_PRIMARY`] = config.colors.primary;
|
|
558
|
+
}
|
|
559
|
+
if (config.colors.background) {
|
|
560
|
+
process.env[`${prefix}COLOR_BACKGROUND`] = config.colors.background;
|
|
561
|
+
}
|
|
562
|
+
if (config.colors.success) {
|
|
563
|
+
process.env[`${prefix}COLOR_SUCCESS`] = config.colors.success;
|
|
564
|
+
}
|
|
565
|
+
if (config.colors.info) {
|
|
566
|
+
process.env[`${prefix}COLOR_INFO`] = config.colors.info;
|
|
567
|
+
}
|
|
568
|
+
if (config.colors.warning) {
|
|
569
|
+
process.env[`${prefix}COLOR_WARNING`] = config.colors.warning;
|
|
570
|
+
}
|
|
571
|
+
if (config.colors.error) {
|
|
572
|
+
process.env[`${prefix}COLOR_ERROR`] = config.colors.error;
|
|
573
|
+
}
|
|
574
|
+
if (config.colors.fatal) {
|
|
575
|
+
process.env[`${prefix}COLOR_FATAL`] = config.colors.fatal;
|
|
576
|
+
}
|
|
577
|
+
if (config.repository) {
|
|
578
|
+
process.env[`${prefix}REPOSITORY`] = config.repository;
|
|
579
|
+
}
|
|
580
|
+
if (config.branch) {
|
|
581
|
+
process.env[`${prefix}BRANCH`] = config.branch;
|
|
582
|
+
}
|
|
583
|
+
if (config.preMajor) {
|
|
584
|
+
process.env[`${prefix}PRE_MAJOR`] = String(config.preMajor);
|
|
585
|
+
}
|
|
586
|
+
if (config.logLevel) {
|
|
587
|
+
process.env[`${prefix}LOG_LEVEL`] = String(config.logLevel);
|
|
588
|
+
process.env.LOG_LEVEL = String(config.logLevel);
|
|
589
|
+
process.env.NX_VERBOSE_LOGGING = String(
|
|
590
|
+
getLogLevel(config.logLevel) >= LogLevel.DEBUG ? true : false
|
|
591
|
+
);
|
|
592
|
+
process.env.RUST_BACKTRACE = getLogLevel(config.logLevel) >= LogLevel.DEBUG ? "full" : "none";
|
|
593
|
+
}
|
|
594
|
+
process.env[`${prefix}CONFIG`] = JSON.stringify(config);
|
|
595
|
+
for (const key of Object.keys(config.extensions ?? {})) {
|
|
437
596
|
config.extensions[key] && Object.keys(config.extensions[key]) && setExtensionEnv(key, config.extensions[key]);
|
|
438
|
-
}
|
|
597
|
+
}
|
|
439
598
|
};
|
|
440
599
|
|
|
441
600
|
// packages/config-tools/src/create-storm-config.ts
|
|
@@ -447,7 +606,7 @@ var createConfig = (workspaceRoot) => {
|
|
|
447
606
|
var createStormConfig = (extensionName, schema, workspaceRoot) => {
|
|
448
607
|
let result;
|
|
449
608
|
if (!_static_cache2) {
|
|
450
|
-
|
|
609
|
+
const config = getConfigEnv();
|
|
451
610
|
const defaultConfig = getDefaultConfig(config, workspaceRoot);
|
|
452
611
|
result = StormConfigSchema.parse({
|
|
453
612
|
...defaultConfig,
|
|
@@ -463,7 +622,10 @@ var createStormConfig = (extensionName, schema, workspaceRoot) => {
|
|
|
463
622
|
if (schema && extensionName) {
|
|
464
623
|
result.extensions = {
|
|
465
624
|
...result.extensions,
|
|
466
|
-
[extensionName]: createConfigExtension(
|
|
625
|
+
[extensionName]: createConfigExtension(
|
|
626
|
+
extensionName,
|
|
627
|
+
schema
|
|
628
|
+
)
|
|
467
629
|
};
|
|
468
630
|
}
|
|
469
631
|
_static_cache2 = result;
|
|
@@ -513,9 +675,18 @@ export {
|
|
|
513
675
|
getConfigFile,
|
|
514
676
|
getDefaultConfig,
|
|
515
677
|
getExtensionEnv,
|
|
678
|
+
getLogFn,
|
|
516
679
|
getLogLevel,
|
|
517
680
|
getLogLevelLabel,
|
|
518
681
|
loadStormConfig,
|
|
519
682
|
setConfigEnv,
|
|
520
|
-
setExtensionEnv
|
|
683
|
+
setExtensionEnv,
|
|
684
|
+
writeDebug,
|
|
685
|
+
writeError,
|
|
686
|
+
writeFatal,
|
|
687
|
+
writeInfo,
|
|
688
|
+
writeSuccess,
|
|
689
|
+
writeSystem,
|
|
690
|
+
writeTrace,
|
|
691
|
+
writeWarning
|
|
521
692
|
};
|
package/meta.cjs.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"packages/config-tools/src/config-file/get-config-file.ts":{"bytes":
|
|
1
|
+
{"inputs":{"packages/config-tools/src/config-file/get-config-file.ts":{"bytes":2082,"imports":[{"path":"cosmiconfig","kind":"import-statement","external":true}],"format":"esm"},"packages/config-tools/src/config-file/index.ts":{"bytes":35,"imports":[{"path":"packages/config-tools/src/config-file/get-config-file.ts","kind":"import-statement","original":"./get-config-file"}],"format":"esm"},"packages/config-tools/src/types.ts":{"bytes":1532,"imports":[],"format":"esm"},"packages/config-tools/src/utilities/find-up.ts":{"bytes":631,"imports":[{"path":"fs","kind":"import-statement","external":true},{"path":"path","kind":"import-statement","external":true}],"format":"esm"},"packages/config-tools/src/utilities/find-workspace-root.ts":{"bytes":1859,"imports":[{"path":"packages/config-tools/src/utilities/find-up.ts","kind":"import-statement","original":"./find-up"}],"format":"esm"},"packages/config-tools/src/schema.ts":{"bytes":5753,"imports":[{"path":"zod","kind":"import-statement","external":true}],"format":"esm"},"packages/config-tools/src/utilities/get-default-config.ts":{"bytes":2727,"imports":[{"path":"fs","kind":"import-statement","external":true},{"path":"path","kind":"import-statement","external":true},{"path":"packages/config-tools/src/schema.ts","kind":"import-statement","original":"../schema"},{"path":"packages/config-tools/src/utilities/find-workspace-root.ts","kind":"import-statement","original":"./find-workspace-root"}],"format":"esm"},"packages/config-tools/src/utilities/get-log-level.ts":{"bytes":1489,"imports":[{"path":"packages/config-tools/src/types.ts","kind":"import-statement","original":"../types"}],"format":"esm"},"packages/config-tools/src/utilities/logger.ts":{"bytes":6173,"imports":[{"path":"chalk","kind":"import-statement","external":true},{"path":"packages/config-tools/src/types.ts","kind":"import-statement","original":"../types"},{"path":"packages/config-tools/src/utilities/get-log-level.ts","kind":"import-statement","original":"./get-log-level"}],"format":"esm"},"packages/config-tools/src/utilities/index.ts":{"bytes":136,"imports":[{"path":"packages/config-tools/src/utilities/find-workspace-root.ts","kind":"import-statement","original":"./find-workspace-root"},{"path":"packages/config-tools/src/utilities/get-default-config.ts","kind":"import-statement","original":"./get-default-config"},{"path":"packages/config-tools/src/utilities/get-log-level.ts","kind":"import-statement","original":"./get-log-level"},{"path":"packages/config-tools/src/utilities/logger.ts","kind":"import-statement","original":"./logger"}],"format":"esm"},"packages/config-tools/src/env/get-env.ts":{"bytes":4264,"imports":[{"path":"packages/config-tools/src/types.ts","kind":"import-statement","original":"../types"},{"path":"packages/config-tools/src/utilities/index.ts","kind":"import-statement","original":"../utilities"}],"format":"esm"},"packages/config-tools/src/env/set-env.ts":{"bytes":5356,"imports":[{"path":"packages/config-tools/src/types.ts","kind":"import-statement","original":"../types"},{"path":"packages/config-tools/src/utilities/get-log-level.ts","kind":"import-statement","original":"../utilities/get-log-level"}],"format":"esm"},"packages/config-tools/src/create-storm-config.ts":{"bytes":3774,"imports":[{"path":"packages/config-tools/src/config-file/get-config-file.ts","kind":"import-statement","original":"./config-file/get-config-file"},{"path":"packages/config-tools/src/env/get-env.ts","kind":"import-statement","original":"./env/get-env"},{"path":"packages/config-tools/src/env/set-env.ts","kind":"import-statement","original":"./env/set-env"},{"path":"packages/config-tools/src/schema.ts","kind":"import-statement","original":"./schema"},{"path":"packages/config-tools/src/utilities/get-default-config.ts","kind":"import-statement","original":"./utilities/get-default-config"}],"format":"esm"},"packages/config-tools/src/env/index.ts":{"bytes":54,"imports":[{"path":"packages/config-tools/src/env/get-env.ts","kind":"import-statement","original":"./get-env"},{"path":"packages/config-tools/src/env/set-env.ts","kind":"import-statement","original":"./set-env"}],"format":"esm"},"packages/config-tools/src/index.ts":{"bytes":399,"imports":[{"path":"packages/config-tools/src/config-file/index.ts","kind":"import-statement","original":"./config-file"},{"path":"packages/config-tools/src/create-storm-config.ts","kind":"import-statement","original":"./create-storm-config"},{"path":"packages/config-tools/src/env/index.ts","kind":"import-statement","original":"./env"},{"path":"packages/config-tools/src/schema.ts","kind":"import-statement","original":"./schema"},{"path":"packages/config-tools/src/types.ts","kind":"import-statement","original":"./types"},{"path":"packages/config-tools/src/utilities/index.ts","kind":"import-statement","original":"./utilities"}],"format":"esm"}},"outputs":{"dist/packages/config-tools/index.cjs":{"imports":[{"path":"cosmiconfig","kind":"require-call","external":true},{"path":"fs","kind":"require-call","external":true},{"path":"path","kind":"require-call","external":true},{"path":"fs","kind":"require-call","external":true},{"path":"path","kind":"require-call","external":true},{"path":"zod","kind":"require-call","external":true},{"path":"chalk","kind":"require-call","external":true}],"exports":[],"entryPoint":"packages/config-tools/src/index.ts","inputs":{"packages/config-tools/src/index.ts":{"bytesInOutput":1233},"packages/config-tools/src/config-file/get-config-file.ts":{"bytesInOutput":1690},"packages/config-tools/src/config-file/index.ts":{"bytesInOutput":0},"packages/config-tools/src/types.ts":{"bytesInOutput":297},"packages/config-tools/src/utilities/find-up.ts":{"bytesInOutput":550},"packages/config-tools/src/utilities/find-workspace-root.ts":{"bytesInOutput":1259},"packages/config-tools/src/utilities/index.ts":{"bytesInOutput":0},"packages/config-tools/src/utilities/get-default-config.ts":{"bytesInOutput":2185},"packages/config-tools/src/schema.ts":{"bytesInOutput":4597},"packages/config-tools/src/utilities/get-log-level.ts":{"bytesInOutput":1109},"packages/config-tools/src/utilities/logger.ts":{"bytesInOutput":3999},"packages/config-tools/src/env/get-env.ts":{"bytesInOutput":3259},"packages/config-tools/src/env/set-env.ts":{"bytesInOutput":4590},"packages/config-tools/src/create-storm-config.ts":{"bytesInOutput":1804},"packages/config-tools/src/env/index.ts":{"bytesInOutput":0}},"bytes":29223},"dist/packages/config-tools/utilities/find-workspace-root.cjs":{"imports":[{"path":"fs","kind":"require-call","external":true},{"path":"path","kind":"require-call","external":true}],"exports":[],"entryPoint":"packages/config-tools/src/utilities/find-workspace-root.ts","inputs":{"packages/config-tools/src/utilities/find-workspace-root.ts":{"bytesInOutput":1500},"packages/config-tools/src/utilities/find-up.ts":{"bytesInOutput":550}},"bytes":3148}}}
|
package/meta.esm.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"packages/config-tools/src/config-file/get-config-file.ts":{"bytes":
|
|
1
|
+
{"inputs":{"packages/config-tools/src/config-file/get-config-file.ts":{"bytes":2082,"imports":[{"path":"cosmiconfig","kind":"import-statement","external":true}],"format":"esm"},"packages/config-tools/src/config-file/index.ts":{"bytes":35,"imports":[{"path":"packages/config-tools/src/config-file/get-config-file.ts","kind":"import-statement","original":"./get-config-file"}],"format":"esm"},"packages/config-tools/src/types.ts":{"bytes":1532,"imports":[],"format":"esm"},"packages/config-tools/src/utilities/find-up.ts":{"bytes":631,"imports":[{"path":"fs","kind":"import-statement","external":true},{"path":"path","kind":"import-statement","external":true}],"format":"esm"},"packages/config-tools/src/utilities/find-workspace-root.ts":{"bytes":1859,"imports":[{"path":"packages/config-tools/src/utilities/find-up.ts","kind":"import-statement","original":"./find-up"}],"format":"esm"},"packages/config-tools/src/schema.ts":{"bytes":5753,"imports":[{"path":"zod","kind":"import-statement","external":true}],"format":"esm"},"packages/config-tools/src/utilities/get-default-config.ts":{"bytes":2727,"imports":[{"path":"fs","kind":"import-statement","external":true},{"path":"path","kind":"import-statement","external":true},{"path":"packages/config-tools/src/schema.ts","kind":"import-statement","original":"../schema"},{"path":"packages/config-tools/src/utilities/find-workspace-root.ts","kind":"import-statement","original":"./find-workspace-root"}],"format":"esm"},"packages/config-tools/src/utilities/get-log-level.ts":{"bytes":1489,"imports":[{"path":"packages/config-tools/src/types.ts","kind":"import-statement","original":"../types"}],"format":"esm"},"packages/config-tools/src/utilities/logger.ts":{"bytes":6173,"imports":[{"path":"chalk","kind":"import-statement","external":true},{"path":"packages/config-tools/src/types.ts","kind":"import-statement","original":"../types"},{"path":"packages/config-tools/src/utilities/get-log-level.ts","kind":"import-statement","original":"./get-log-level"}],"format":"esm"},"packages/config-tools/src/utilities/index.ts":{"bytes":136,"imports":[{"path":"packages/config-tools/src/utilities/find-workspace-root.ts","kind":"import-statement","original":"./find-workspace-root"},{"path":"packages/config-tools/src/utilities/get-default-config.ts","kind":"import-statement","original":"./get-default-config"},{"path":"packages/config-tools/src/utilities/get-log-level.ts","kind":"import-statement","original":"./get-log-level"},{"path":"packages/config-tools/src/utilities/logger.ts","kind":"import-statement","original":"./logger"}],"format":"esm"},"packages/config-tools/src/env/get-env.ts":{"bytes":4264,"imports":[{"path":"packages/config-tools/src/types.ts","kind":"import-statement","original":"../types"},{"path":"packages/config-tools/src/utilities/index.ts","kind":"import-statement","original":"../utilities"}],"format":"esm"},"packages/config-tools/src/env/set-env.ts":{"bytes":5356,"imports":[{"path":"packages/config-tools/src/types.ts","kind":"import-statement","original":"../types"},{"path":"packages/config-tools/src/utilities/get-log-level.ts","kind":"import-statement","original":"../utilities/get-log-level"}],"format":"esm"},"packages/config-tools/src/create-storm-config.ts":{"bytes":3774,"imports":[{"path":"packages/config-tools/src/config-file/get-config-file.ts","kind":"import-statement","original":"./config-file/get-config-file"},{"path":"packages/config-tools/src/env/get-env.ts","kind":"import-statement","original":"./env/get-env"},{"path":"packages/config-tools/src/env/set-env.ts","kind":"import-statement","original":"./env/set-env"},{"path":"packages/config-tools/src/schema.ts","kind":"import-statement","original":"./schema"},{"path":"packages/config-tools/src/utilities/get-default-config.ts","kind":"import-statement","original":"./utilities/get-default-config"}],"format":"esm"},"packages/config-tools/src/env/index.ts":{"bytes":54,"imports":[{"path":"packages/config-tools/src/env/get-env.ts","kind":"import-statement","original":"./get-env"},{"path":"packages/config-tools/src/env/set-env.ts","kind":"import-statement","original":"./set-env"}],"format":"esm"},"packages/config-tools/src/index.ts":{"bytes":399,"imports":[{"path":"packages/config-tools/src/config-file/index.ts","kind":"import-statement","original":"./config-file"},{"path":"packages/config-tools/src/create-storm-config.ts","kind":"import-statement","original":"./create-storm-config"},{"path":"packages/config-tools/src/env/index.ts","kind":"import-statement","original":"./env"},{"path":"packages/config-tools/src/schema.ts","kind":"import-statement","original":"./schema"},{"path":"packages/config-tools/src/types.ts","kind":"import-statement","original":"./types"},{"path":"packages/config-tools/src/utilities/index.ts","kind":"import-statement","original":"./utilities"}],"format":"esm"}},"outputs":{"dist/packages/config-tools/index.js":{"imports":[{"path":"cosmiconfig","kind":"import-statement","external":true},{"path":"fs","kind":"import-statement","external":true},{"path":"path","kind":"import-statement","external":true},{"path":"fs","kind":"import-statement","external":true},{"path":"path","kind":"import-statement","external":true},{"path":"zod","kind":"import-statement","external":true},{"path":"chalk","kind":"import-statement","external":true}],"exports":["ColorConfigSchema","DefaultColorConfig","DefaultStormConfig","LogLevel","LogLevelLabel","StormConfigSchema","createConfig","createConfigExtension","createStormConfig","findWorkspaceRoot","findWorkspaceRootSafe","getConfigEnv","getConfigFile","getDefaultConfig","getExtensionEnv","getLogFn","getLogLevel","getLogLevelLabel","loadStormConfig","setConfigEnv","setExtensionEnv","writeDebug","writeError","writeFatal","writeInfo","writeSuccess","writeSystem","writeTrace","writeWarning"],"entryPoint":"packages/config-tools/src/index.ts","inputs":{"packages/config-tools/src/config-file/get-config-file.ts":{"bytesInOutput":1660},"packages/config-tools/src/config-file/index.ts":{"bytesInOutput":0},"packages/config-tools/src/index.ts":{"bytesInOutput":0},"packages/config-tools/src/types.ts":{"bytesInOutput":297},"packages/config-tools/src/utilities/find-up.ts":{"bytesInOutput":497},"packages/config-tools/src/utilities/find-workspace-root.ts":{"bytesInOutput":1259},"packages/config-tools/src/utilities/index.ts":{"bytesInOutput":0},"packages/config-tools/src/utilities/get-default-config.ts":{"bytesInOutput":2152},"packages/config-tools/src/schema.ts":{"bytesInOutput":4587},"packages/config-tools/src/utilities/get-log-level.ts":{"bytesInOutput":1109},"packages/config-tools/src/utilities/logger.ts":{"bytesInOutput":3989},"packages/config-tools/src/env/get-env.ts":{"bytesInOutput":3259},"packages/config-tools/src/env/set-env.ts":{"bytesInOutput":4590},"packages/config-tools/src/create-storm-config.ts":{"bytesInOutput":1804},"packages/config-tools/src/env/index.ts":{"bytesInOutput":0}},"bytes":26353},"dist/packages/config-tools/utilities/find-workspace-root.js":{"imports":[{"path":"fs","kind":"import-statement","external":true},{"path":"path","kind":"import-statement","external":true}],"exports":["findWorkspaceRoot","findWorkspaceRootSafe"],"entryPoint":"packages/config-tools/src/utilities/find-workspace-root.ts","inputs":{"packages/config-tools/src/utilities/find-up.ts":{"bytesInOutput":497},"packages/config-tools/src/utilities/find-workspace-root.ts":{"bytesInOutput":1259}},"bytes":1926}}}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storm-software/config-tools",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.15.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "⚡The Storm-Ops monorepo contains utility applications, tools, and various libraries to create modern and scalable web applications.",
|
|
6
6
|
"repository": {
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
"module": "./index.js",
|
|
14
14
|
"types": "declarations.d.ts",
|
|
15
15
|
"dependencies": {
|
|
16
|
+
"chalk": "4.1.0",
|
|
16
17
|
"cosmiconfig": "^9.0.0",
|
|
17
18
|
"find-up": "^7.0.0",
|
|
18
19
|
"locate-path": "^7.2.0",
|
|
@@ -30,15 +30,15 @@ var import_path = require("path");
|
|
|
30
30
|
var MAX_PATH_SEARCH_DEPTH = 30;
|
|
31
31
|
var depth = 0;
|
|
32
32
|
function findFolderUp(startPath, endFileNames) {
|
|
33
|
-
|
|
34
|
-
if (endFileNames.some((endFileName) => (0, import_fs.existsSync)((0, import_path.join)(
|
|
35
|
-
return
|
|
36
|
-
}
|
|
37
|
-
|
|
33
|
+
const _startPath = startPath ?? process.cwd();
|
|
34
|
+
if (endFileNames.some((endFileName) => (0, import_fs.existsSync)((0, import_path.join)(_startPath, endFileName)))) {
|
|
35
|
+
return _startPath;
|
|
36
|
+
}
|
|
37
|
+
if (_startPath !== "/" && depth++ < MAX_PATH_SEARCH_DEPTH) {
|
|
38
|
+
const parent = (0, import_path.join)(_startPath, "..");
|
|
38
39
|
return findFolderUp(parent, endFileNames);
|
|
39
|
-
} else {
|
|
40
|
-
return void 0;
|
|
41
40
|
}
|
|
41
|
+
return void 0;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
// packages/config-tools/src/utilities/find-workspace-root.ts
|
|
@@ -4,15 +4,15 @@ import { join } from "path";
|
|
|
4
4
|
var MAX_PATH_SEARCH_DEPTH = 30;
|
|
5
5
|
var depth = 0;
|
|
6
6
|
function findFolderUp(startPath, endFileNames) {
|
|
7
|
-
|
|
8
|
-
if (endFileNames.some((endFileName) => existsSync(join(
|
|
9
|
-
return
|
|
10
|
-
}
|
|
11
|
-
|
|
7
|
+
const _startPath = startPath ?? process.cwd();
|
|
8
|
+
if (endFileNames.some((endFileName) => existsSync(join(_startPath, endFileName)))) {
|
|
9
|
+
return _startPath;
|
|
10
|
+
}
|
|
11
|
+
if (_startPath !== "/" && depth++ < MAX_PATH_SEARCH_DEPTH) {
|
|
12
|
+
const parent = join(_startPath, "..");
|
|
12
13
|
return findFolderUp(parent, endFileNames);
|
|
13
|
-
} else {
|
|
14
|
-
return void 0;
|
|
15
14
|
}
|
|
15
|
+
return void 0;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
// packages/config-tools/src/utilities/find-workspace-root.ts
|