@storm-software/config-tools 1.14.1 → 1.14.3
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 +170 -99
- package/index.js +170 -99
- package/meta.cjs.json +1 -1
- package/meta.esm.json +1 -1
- package/package.json +1 -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.2](https://github.com/storm-software/storm-ops/compare/config-tools-v1.14.1...config-tools-v1.14.2) (2024-01-15)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **git-tools:** Added dependency override for `request` package to prevent request forgery exposure ([1f42b96](https://github.com/storm-software/storm-ops/commit/1f42b96518e944a3b1e5a3e38dfc1c7dc1a7241f))
|
|
7
|
+
|
|
8
|
+
## [1.14.1](https://github.com/storm-software/storm-ops/compare/config-tools-v1.14.0...config-tools-v1.14.1) (2024-01-15)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* **linting-tools:** Resolve Dependabot Alerts [#1](https://github.com/storm-software/storm-ops/issues/1), [#2](https://github.com/storm-software/storm-ops/issues/2), [#3](https://github.com/storm-software/storm-ops/issues/3), and [#4](https://github.com/storm-software/storm-ops/issues/4) ([88253ba](https://github.com/storm-software/storm-ops/commit/88253ba59b21442d7af2f1f3cb958d9e9d13289e))
|
|
14
|
+
|
|
1
15
|
# [1.14.0](https://github.com/storm-software/storm-ops/compare/config-tools-v1.13.1...config-tools-v1.14.0) (2024-01-15)
|
|
2
16
|
|
|
3
17
|
|
package/index.cjs
CHANGED
|
@@ -99,7 +99,8 @@ var LogLevel = {
|
|
|
99
99
|
WARN: 30,
|
|
100
100
|
INFO: 40,
|
|
101
101
|
DEBUG: 60,
|
|
102
|
-
TRACE: 70
|
|
102
|
+
TRACE: 70,
|
|
103
|
+
ALL: 100
|
|
103
104
|
};
|
|
104
105
|
var LogLevelLabel = {
|
|
105
106
|
SILENT: "silent",
|
|
@@ -108,7 +109,8 @@ var LogLevelLabel = {
|
|
|
108
109
|
WARN: "warn",
|
|
109
110
|
INFO: "info",
|
|
110
111
|
DEBUG: "debug",
|
|
111
|
-
TRACE: "trace"
|
|
112
|
+
TRACE: "trace",
|
|
113
|
+
ALL: "all"
|
|
112
114
|
};
|
|
113
115
|
|
|
114
116
|
// packages/config-tools/src/utilities/find-up.ts
|
|
@@ -117,15 +119,15 @@ var import_path = require("path");
|
|
|
117
119
|
var MAX_PATH_SEARCH_DEPTH = 30;
|
|
118
120
|
var depth = 0;
|
|
119
121
|
function findFolderUp(startPath, endFileNames) {
|
|
120
|
-
|
|
121
|
-
if (endFileNames.some((endFileName) => (0, import_fs.existsSync)((0, import_path.join)(
|
|
122
|
-
return
|
|
123
|
-
}
|
|
124
|
-
|
|
122
|
+
const _startPath = startPath ?? process.cwd();
|
|
123
|
+
if (endFileNames.some((endFileName) => (0, import_fs.existsSync)((0, import_path.join)(_startPath, endFileName)))) {
|
|
124
|
+
return _startPath;
|
|
125
|
+
}
|
|
126
|
+
if (_startPath !== "/" && depth++ < MAX_PATH_SEARCH_DEPTH) {
|
|
127
|
+
const parent = (0, import_path.join)(_startPath, "..");
|
|
125
128
|
return findFolderUp(parent, endFileNames);
|
|
126
|
-
} else {
|
|
127
|
-
return void 0;
|
|
128
129
|
}
|
|
130
|
+
return void 0;
|
|
129
131
|
}
|
|
130
132
|
|
|
131
133
|
// packages/config-tools/src/utilities/find-workspace-root.ts
|
|
@@ -203,17 +205,13 @@ var StormConfigSchema = z.object({
|
|
|
203
205
|
license: z.string().trim().default("Apache License 2.0").describe("The root directory of the package"),
|
|
204
206
|
homepage: z.string().trim().url().default("https://stormsoftware.org").describe("The homepage of the workspace"),
|
|
205
207
|
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
|
-
),
|
|
208
|
+
preMajor: z.boolean().default(false).describe("An indicator specifying if the package is still in it's pre-major version"),
|
|
209
209
|
owner: z.string().trim().default("@storm-software/development").describe("The owner of the package"),
|
|
210
210
|
worker: z.string().trim().default("stormie-bot").describe(
|
|
211
211
|
"The worker of the package (this is the bot that will be used to perform various tasks)"
|
|
212
212
|
),
|
|
213
213
|
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
|
-
),
|
|
214
|
+
ci: z.boolean().default(true).describe("An indicator specifying if the current environment is a CI environment"),
|
|
217
215
|
workspaceRoot: z.string().trim().optional().describe("The root directory of the workspace"),
|
|
218
216
|
packageDirectory: z.string().trim().optional().describe("The root directory of the package"),
|
|
219
217
|
buildDirectory: z.string().trim().default("dist").describe("The build directory for the workspace"),
|
|
@@ -224,7 +222,7 @@ var StormConfigSchema = z.object({
|
|
|
224
222
|
packageManager: z.enum(["npm", "yarn", "pnpm", "bun"]).default("npm").describe("The package manager used by the repository"),
|
|
225
223
|
timezone: z.string().trim().default("America/New_York").describe("The default timezone of the workspace"),
|
|
226
224
|
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(
|
|
225
|
+
logLevel: z.enum(["silent", "fatal", "error", "warn", "info", "debug", "trace", "all"]).default("debug").describe(
|
|
228
226
|
"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
227
|
),
|
|
230
228
|
configFile: z.string().trim().nullable().default(null).describe(
|
|
@@ -282,11 +280,21 @@ var getDefaultConfig = (config = {}, root) => {
|
|
|
282
280
|
});
|
|
283
281
|
if (file) {
|
|
284
282
|
const packageJson = JSON.parse(file);
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
283
|
+
if (packageJson.name) {
|
|
284
|
+
name = packageJson.name;
|
|
285
|
+
}
|
|
286
|
+
if (packageJson.namespace) {
|
|
287
|
+
namespace = packageJson.namespace;
|
|
288
|
+
}
|
|
289
|
+
if (packageJson.repository?.url) {
|
|
290
|
+
repository = packageJson.repository?.url;
|
|
291
|
+
}
|
|
292
|
+
if (packageJson.license) {
|
|
293
|
+
license = packageJson.license;
|
|
294
|
+
}
|
|
295
|
+
if (packageJson.homepage) {
|
|
296
|
+
homepage = packageJson.homepage;
|
|
297
|
+
}
|
|
290
298
|
}
|
|
291
299
|
}
|
|
292
300
|
return StormConfigSchema.parse({
|
|
@@ -329,36 +337,41 @@ var getLogLevel = (label) => {
|
|
|
329
337
|
var getLogLevelLabel = (logLevel) => {
|
|
330
338
|
if (logLevel >= LogLevel.TRACE) {
|
|
331
339
|
return LogLevelLabel.TRACE;
|
|
332
|
-
}
|
|
340
|
+
}
|
|
341
|
+
if (logLevel >= LogLevel.DEBUG) {
|
|
333
342
|
return LogLevelLabel.DEBUG;
|
|
334
|
-
}
|
|
343
|
+
}
|
|
344
|
+
if (logLevel >= LogLevel.INFO) {
|
|
335
345
|
return LogLevelLabel.INFO;
|
|
336
|
-
}
|
|
346
|
+
}
|
|
347
|
+
if (logLevel >= LogLevel.WARN) {
|
|
337
348
|
return LogLevelLabel.WARN;
|
|
338
|
-
}
|
|
349
|
+
}
|
|
350
|
+
if (logLevel >= LogLevel.ERROR) {
|
|
339
351
|
return LogLevelLabel.ERROR;
|
|
340
|
-
}
|
|
352
|
+
}
|
|
353
|
+
if (logLevel >= LogLevel.FATAL) {
|
|
341
354
|
return LogLevelLabel.FATAL;
|
|
342
|
-
}
|
|
355
|
+
}
|
|
356
|
+
if (logLevel <= LogLevel.SILENT) {
|
|
343
357
|
return LogLevelLabel.SILENT;
|
|
344
|
-
} else {
|
|
345
|
-
return LogLevelLabel.INFO;
|
|
346
358
|
}
|
|
359
|
+
return LogLevelLabel.INFO;
|
|
347
360
|
};
|
|
348
361
|
|
|
349
362
|
// packages/config-tools/src/env/get-env.ts
|
|
350
363
|
var getExtensionEnv = (extensionName) => {
|
|
351
364
|
const prefix = `STORM_EXTENSION_${extensionName.toUpperCase()}_`;
|
|
352
365
|
return Object.keys(process.env).filter((key) => key.startsWith(prefix)).reduce((ret, key) => {
|
|
353
|
-
const name = key.replace(prefix, "").split("_").map(
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
366
|
+
const name = key.replace(prefix, "").split("_").map((i) => i.length > 0 ? i.trim().charAt(0).toUpperCase() + i.trim().slice(1) : "").join("");
|
|
367
|
+
if (name) {
|
|
368
|
+
ret[name] = process.env[key];
|
|
369
|
+
}
|
|
357
370
|
return ret;
|
|
358
371
|
}, {});
|
|
359
372
|
};
|
|
360
373
|
var getConfigEnv = () => {
|
|
361
|
-
const prefix =
|
|
374
|
+
const prefix = "STORM_";
|
|
362
375
|
let config = {
|
|
363
376
|
name: process.env[`${prefix}NAME`],
|
|
364
377
|
namespace: process.env[`${prefix}NAMESPACE`],
|
|
@@ -377,9 +390,7 @@ var getConfigEnv = () => {
|
|
|
377
390
|
runtimeVersion: process.env[`${prefix}RUNTIME_VERSION`],
|
|
378
391
|
runtimeDirectory: process.env[`${prefix}RUNTIME_DIRECTORY`],
|
|
379
392
|
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
|
-
),
|
|
393
|
+
ci: Boolean(process.env[`${prefix}CI`] ?? process.env.CI ?? process.env.CONTINUOUS_INTEGRATION),
|
|
383
394
|
colors: {
|
|
384
395
|
primary: process.env[`${prefix}COLOR_PRIMARY`],
|
|
385
396
|
background: process.env[`${prefix}COLOR_BACKGROUND`],
|
|
@@ -392,9 +403,7 @@ var getConfigEnv = () => {
|
|
|
392
403
|
repository: process.env[`${prefix}REPOSITORY`],
|
|
393
404
|
branch: process.env[`${prefix}BRANCH`],
|
|
394
405
|
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,
|
|
406
|
+
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
407
|
extensions: {}
|
|
399
408
|
};
|
|
400
409
|
const serializedConfig = process.env[`${prefix}CONFIG`];
|
|
@@ -409,26 +418,27 @@ var getConfigEnv = () => {
|
|
|
409
418
|
}
|
|
410
419
|
const extensionPrefix = `${prefix}EXTENSION_`;
|
|
411
420
|
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
|
-
|
|
421
|
+
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("");
|
|
422
|
+
if (extensionName) {
|
|
423
|
+
ret.extensions[extensionName] = getExtensionEnv(extensionName);
|
|
424
|
+
}
|
|
416
425
|
return ret;
|
|
417
426
|
}, config);
|
|
418
427
|
};
|
|
419
428
|
|
|
420
429
|
// packages/config-tools/src/env/set-env.ts
|
|
421
430
|
var setExtensionEnv = (extensionName, extension) => {
|
|
422
|
-
Object.keys(extension ?? {})
|
|
431
|
+
for (const key of Object.keys(extension ?? {})) {
|
|
423
432
|
if (extension[key]) {
|
|
424
|
-
|
|
433
|
+
const result = key?.replace(
|
|
425
434
|
/([A-Z])+/g,
|
|
426
435
|
(input) => input ? input[0].toUpperCase() + input.slice(1) : ""
|
|
427
436
|
).split(/(?=[A-Z])|[\.\-\s_]/).map((x) => x.toLowerCase()) ?? [];
|
|
428
437
|
let extensionKey;
|
|
429
438
|
if (result.length === 0) {
|
|
430
439
|
return;
|
|
431
|
-
}
|
|
440
|
+
}
|
|
441
|
+
if (result.length === 1) {
|
|
432
442
|
extensionKey = result[0].toUpperCase();
|
|
433
443
|
} else {
|
|
434
444
|
extensionKey = result.reduce((ret, part) => {
|
|
@@ -437,59 +447,117 @@ var setExtensionEnv = (extensionName, extension) => {
|
|
|
437
447
|
}
|
|
438
448
|
process.env[`STORM_EXTENSION_${extensionName.toUpperCase()}_${extensionKey.toUpperCase()}`] = extension[key];
|
|
439
449
|
}
|
|
440
|
-
}
|
|
450
|
+
}
|
|
441
451
|
};
|
|
442
452
|
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
|
-
|
|
453
|
+
const prefix = "STORM_";
|
|
454
|
+
if (config.name) {
|
|
455
|
+
process.env[`${prefix}NAME`] = config.name;
|
|
456
|
+
}
|
|
457
|
+
if (config.namespace) {
|
|
458
|
+
process.env[`${prefix}NAMESPACE`] = config.namespace;
|
|
459
|
+
}
|
|
460
|
+
if (config.owner) {
|
|
461
|
+
process.env[`${prefix}OWNER`] = config.owner;
|
|
462
|
+
}
|
|
463
|
+
if (config.worker) {
|
|
464
|
+
process.env[`${prefix}WORKER`] = config.worker;
|
|
465
|
+
}
|
|
466
|
+
if (config.organization) {
|
|
467
|
+
process.env[`${prefix}ORGANIZATION`] = config.organization;
|
|
468
|
+
}
|
|
469
|
+
if (config.packageManager) {
|
|
470
|
+
process.env[`${prefix}PACKAGE_MANAGER`] = config.packageManager;
|
|
471
|
+
}
|
|
472
|
+
if (config.license) {
|
|
473
|
+
process.env[`${prefix}LICENSE`] = config.license;
|
|
474
|
+
}
|
|
475
|
+
if (config.homepage) {
|
|
476
|
+
process.env[`${prefix}HOMEPAGE`] = config.homepage;
|
|
477
|
+
}
|
|
478
|
+
if (config.timezone) {
|
|
479
|
+
process.env[`${prefix}TIMEZONE`] = config.timezone;
|
|
480
|
+
process.env.TZ = config.timezone;
|
|
481
|
+
process.env.DEFAULT_TIMEZONE = config.timezone;
|
|
482
|
+
}
|
|
483
|
+
if (config.locale) {
|
|
484
|
+
process.env[`${prefix}LOCALE`] = config.locale;
|
|
485
|
+
process.env.LOCALE = config.locale;
|
|
486
|
+
process.env.DEFAULT_LOCALE = config.locale;
|
|
487
|
+
process.env.LANG = config.locale ? `${config.locale.replaceAll("-", "_")}.UTF-8` : "en_US.UTF-8";
|
|
488
|
+
}
|
|
489
|
+
if (config.configFile) {
|
|
490
|
+
process.env[`${prefix}CONFIG_FILE`] = config.configFile;
|
|
491
|
+
}
|
|
492
|
+
if (config.workspaceRoot) {
|
|
493
|
+
process.env[`${prefix}WORKSPACE_ROOT`] = config.workspaceRoot;
|
|
494
|
+
process.env.NX_WORKSPACE_ROOT = config.workspaceRoot;
|
|
495
|
+
process.env.NX_WORKSPACE_ROOT_PATH = config.workspaceRoot;
|
|
496
|
+
}
|
|
497
|
+
if (config.packageDirectory) {
|
|
498
|
+
process.env[`${prefix}PACKAGE_DIRECTORY`] = config.packageDirectory;
|
|
499
|
+
}
|
|
500
|
+
if (config.buildDirectory) {
|
|
501
|
+
process.env[`${prefix}BUILD_DIRECTORY`] = config.buildDirectory;
|
|
502
|
+
}
|
|
503
|
+
if (config.runtimeVersion) {
|
|
504
|
+
process.env[`${prefix}RUNTIME_VERSION`] = config.runtimeVersion;
|
|
505
|
+
}
|
|
506
|
+
if (config.runtimeDirectory) {
|
|
507
|
+
process.env[`${prefix}RUNTIME_DIRECTORY`] = config.runtimeDirectory;
|
|
508
|
+
}
|
|
509
|
+
if (config.env) {
|
|
510
|
+
process.env[`${prefix}ENV`] = config.env;
|
|
511
|
+
process.env.NODE_ENV = config.env;
|
|
512
|
+
process.env.ENVIRONMENT = config.env;
|
|
513
|
+
}
|
|
514
|
+
if (config.ci) {
|
|
515
|
+
process.env[`${prefix}CI`] = String(config.ci);
|
|
516
|
+
process.env.CI = String(config.ci);
|
|
517
|
+
process.env.CONTINUOUS_INTEGRATION = String(config.ci);
|
|
518
|
+
}
|
|
519
|
+
if (config.colors.primary) {
|
|
520
|
+
process.env[`${prefix}COLOR_PRIMARY`] = config.colors.primary;
|
|
521
|
+
}
|
|
522
|
+
if (config.colors.background) {
|
|
523
|
+
process.env[`${prefix}COLOR_BACKGROUND`] = config.colors.background;
|
|
524
|
+
}
|
|
525
|
+
if (config.colors.success) {
|
|
526
|
+
process.env[`${prefix}COLOR_SUCCESS`] = config.colors.success;
|
|
527
|
+
}
|
|
528
|
+
if (config.colors.info) {
|
|
529
|
+
process.env[`${prefix}COLOR_INFO`] = config.colors.info;
|
|
530
|
+
}
|
|
531
|
+
if (config.colors.warning) {
|
|
532
|
+
process.env[`${prefix}COLOR_WARNING`] = config.colors.warning;
|
|
533
|
+
}
|
|
534
|
+
if (config.colors.error) {
|
|
535
|
+
process.env[`${prefix}COLOR_ERROR`] = config.colors.error;
|
|
536
|
+
}
|
|
537
|
+
if (config.colors.fatal) {
|
|
538
|
+
process.env[`${prefix}COLOR_FATAL`] = config.colors.fatal;
|
|
539
|
+
}
|
|
540
|
+
if (config.repository) {
|
|
541
|
+
process.env[`${prefix}REPOSITORY`] = config.repository;
|
|
542
|
+
}
|
|
543
|
+
if (config.branch) {
|
|
544
|
+
process.env[`${prefix}BRANCH`] = config.branch;
|
|
545
|
+
}
|
|
546
|
+
if (config.preMajor) {
|
|
547
|
+
process.env[`${prefix}PRE_MAJOR`] = String(config.preMajor);
|
|
548
|
+
}
|
|
549
|
+
if (config.logLevel) {
|
|
550
|
+
process.env[`${prefix}LOG_LEVEL`] = String(config.logLevel);
|
|
551
|
+
process.env.LOG_LEVEL = String(config.logLevel);
|
|
552
|
+
process.env.NX_VERBOSE_LOGGING = String(
|
|
553
|
+
getLogLevel(config.logLevel) >= LogLevel.DEBUG ? true : false
|
|
554
|
+
);
|
|
555
|
+
process.env.RUST_BACKTRACE = getLogLevel(config.logLevel) >= LogLevel.DEBUG ? "full" : "none";
|
|
556
|
+
}
|
|
557
|
+
process.env[`${prefix}CONFIG`] = JSON.stringify(config);
|
|
558
|
+
for (const key of Object.keys(config.extensions ?? {})) {
|
|
491
559
|
config.extensions[key] && Object.keys(config.extensions[key]) && setExtensionEnv(key, config.extensions[key]);
|
|
492
|
-
}
|
|
560
|
+
}
|
|
493
561
|
};
|
|
494
562
|
|
|
495
563
|
// packages/config-tools/src/create-storm-config.ts
|
|
@@ -501,7 +569,7 @@ var createConfig = (workspaceRoot) => {
|
|
|
501
569
|
var createStormConfig = (extensionName, schema, workspaceRoot) => {
|
|
502
570
|
let result;
|
|
503
571
|
if (!_static_cache2) {
|
|
504
|
-
|
|
572
|
+
const config = getConfigEnv();
|
|
505
573
|
const defaultConfig = getDefaultConfig(config, workspaceRoot);
|
|
506
574
|
result = StormConfigSchema.parse({
|
|
507
575
|
...defaultConfig,
|
|
@@ -517,7 +585,10 @@ var createStormConfig = (extensionName, schema, workspaceRoot) => {
|
|
|
517
585
|
if (schema && extensionName) {
|
|
518
586
|
result.extensions = {
|
|
519
587
|
...result.extensions,
|
|
520
|
-
[extensionName]: createConfigExtension(
|
|
588
|
+
[extensionName]: createConfigExtension(
|
|
589
|
+
extensionName,
|
|
590
|
+
schema
|
|
591
|
+
)
|
|
521
592
|
};
|
|
522
593
|
}
|
|
523
594
|
_static_cache2 = result;
|
package/index.js
CHANGED
|
@@ -45,7 +45,8 @@ var LogLevel = {
|
|
|
45
45
|
WARN: 30,
|
|
46
46
|
INFO: 40,
|
|
47
47
|
DEBUG: 60,
|
|
48
|
-
TRACE: 70
|
|
48
|
+
TRACE: 70,
|
|
49
|
+
ALL: 100
|
|
49
50
|
};
|
|
50
51
|
var LogLevelLabel = {
|
|
51
52
|
SILENT: "silent",
|
|
@@ -54,7 +55,8 @@ var LogLevelLabel = {
|
|
|
54
55
|
WARN: "warn",
|
|
55
56
|
INFO: "info",
|
|
56
57
|
DEBUG: "debug",
|
|
57
|
-
TRACE: "trace"
|
|
58
|
+
TRACE: "trace",
|
|
59
|
+
ALL: "all"
|
|
58
60
|
};
|
|
59
61
|
|
|
60
62
|
// packages/config-tools/src/utilities/find-up.ts
|
|
@@ -63,15 +65,15 @@ import { join } from "path";
|
|
|
63
65
|
var MAX_PATH_SEARCH_DEPTH = 30;
|
|
64
66
|
var depth = 0;
|
|
65
67
|
function findFolderUp(startPath, endFileNames) {
|
|
66
|
-
|
|
67
|
-
if (endFileNames.some((endFileName) => existsSync(join(
|
|
68
|
-
return
|
|
69
|
-
}
|
|
70
|
-
|
|
68
|
+
const _startPath = startPath ?? process.cwd();
|
|
69
|
+
if (endFileNames.some((endFileName) => existsSync(join(_startPath, endFileName)))) {
|
|
70
|
+
return _startPath;
|
|
71
|
+
}
|
|
72
|
+
if (_startPath !== "/" && depth++ < MAX_PATH_SEARCH_DEPTH) {
|
|
73
|
+
const parent = join(_startPath, "..");
|
|
71
74
|
return findFolderUp(parent, endFileNames);
|
|
72
|
-
} else {
|
|
73
|
-
return void 0;
|
|
74
75
|
}
|
|
76
|
+
return void 0;
|
|
75
77
|
}
|
|
76
78
|
|
|
77
79
|
// packages/config-tools/src/utilities/find-workspace-root.ts
|
|
@@ -149,17 +151,13 @@ var StormConfigSchema = z.object({
|
|
|
149
151
|
license: z.string().trim().default("Apache License 2.0").describe("The root directory of the package"),
|
|
150
152
|
homepage: z.string().trim().url().default("https://stormsoftware.org").describe("The homepage of the workspace"),
|
|
151
153
|
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
|
-
),
|
|
154
|
+
preMajor: z.boolean().default(false).describe("An indicator specifying if the package is still in it's pre-major version"),
|
|
155
155
|
owner: z.string().trim().default("@storm-software/development").describe("The owner of the package"),
|
|
156
156
|
worker: z.string().trim().default("stormie-bot").describe(
|
|
157
157
|
"The worker of the package (this is the bot that will be used to perform various tasks)"
|
|
158
158
|
),
|
|
159
159
|
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
|
-
),
|
|
160
|
+
ci: z.boolean().default(true).describe("An indicator specifying if the current environment is a CI environment"),
|
|
163
161
|
workspaceRoot: z.string().trim().optional().describe("The root directory of the workspace"),
|
|
164
162
|
packageDirectory: z.string().trim().optional().describe("The root directory of the package"),
|
|
165
163
|
buildDirectory: z.string().trim().default("dist").describe("The build directory for the workspace"),
|
|
@@ -170,7 +168,7 @@ var StormConfigSchema = z.object({
|
|
|
170
168
|
packageManager: z.enum(["npm", "yarn", "pnpm", "bun"]).default("npm").describe("The package manager used by the repository"),
|
|
171
169
|
timezone: z.string().trim().default("America/New_York").describe("The default timezone of the workspace"),
|
|
172
170
|
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(
|
|
171
|
+
logLevel: z.enum(["silent", "fatal", "error", "warn", "info", "debug", "trace", "all"]).default("debug").describe(
|
|
174
172
|
"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
173
|
),
|
|
176
174
|
configFile: z.string().trim().nullable().default(null).describe(
|
|
@@ -228,11 +226,21 @@ var getDefaultConfig = (config = {}, root) => {
|
|
|
228
226
|
});
|
|
229
227
|
if (file) {
|
|
230
228
|
const packageJson = JSON.parse(file);
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
229
|
+
if (packageJson.name) {
|
|
230
|
+
name = packageJson.name;
|
|
231
|
+
}
|
|
232
|
+
if (packageJson.namespace) {
|
|
233
|
+
namespace = packageJson.namespace;
|
|
234
|
+
}
|
|
235
|
+
if (packageJson.repository?.url) {
|
|
236
|
+
repository = packageJson.repository?.url;
|
|
237
|
+
}
|
|
238
|
+
if (packageJson.license) {
|
|
239
|
+
license = packageJson.license;
|
|
240
|
+
}
|
|
241
|
+
if (packageJson.homepage) {
|
|
242
|
+
homepage = packageJson.homepage;
|
|
243
|
+
}
|
|
236
244
|
}
|
|
237
245
|
}
|
|
238
246
|
return StormConfigSchema.parse({
|
|
@@ -275,36 +283,41 @@ var getLogLevel = (label) => {
|
|
|
275
283
|
var getLogLevelLabel = (logLevel) => {
|
|
276
284
|
if (logLevel >= LogLevel.TRACE) {
|
|
277
285
|
return LogLevelLabel.TRACE;
|
|
278
|
-
}
|
|
286
|
+
}
|
|
287
|
+
if (logLevel >= LogLevel.DEBUG) {
|
|
279
288
|
return LogLevelLabel.DEBUG;
|
|
280
|
-
}
|
|
289
|
+
}
|
|
290
|
+
if (logLevel >= LogLevel.INFO) {
|
|
281
291
|
return LogLevelLabel.INFO;
|
|
282
|
-
}
|
|
292
|
+
}
|
|
293
|
+
if (logLevel >= LogLevel.WARN) {
|
|
283
294
|
return LogLevelLabel.WARN;
|
|
284
|
-
}
|
|
295
|
+
}
|
|
296
|
+
if (logLevel >= LogLevel.ERROR) {
|
|
285
297
|
return LogLevelLabel.ERROR;
|
|
286
|
-
}
|
|
298
|
+
}
|
|
299
|
+
if (logLevel >= LogLevel.FATAL) {
|
|
287
300
|
return LogLevelLabel.FATAL;
|
|
288
|
-
}
|
|
301
|
+
}
|
|
302
|
+
if (logLevel <= LogLevel.SILENT) {
|
|
289
303
|
return LogLevelLabel.SILENT;
|
|
290
|
-
} else {
|
|
291
|
-
return LogLevelLabel.INFO;
|
|
292
304
|
}
|
|
305
|
+
return LogLevelLabel.INFO;
|
|
293
306
|
};
|
|
294
307
|
|
|
295
308
|
// packages/config-tools/src/env/get-env.ts
|
|
296
309
|
var getExtensionEnv = (extensionName) => {
|
|
297
310
|
const prefix = `STORM_EXTENSION_${extensionName.toUpperCase()}_`;
|
|
298
311
|
return Object.keys(process.env).filter((key) => key.startsWith(prefix)).reduce((ret, key) => {
|
|
299
|
-
const name = key.replace(prefix, "").split("_").map(
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
312
|
+
const name = key.replace(prefix, "").split("_").map((i) => i.length > 0 ? i.trim().charAt(0).toUpperCase() + i.trim().slice(1) : "").join("");
|
|
313
|
+
if (name) {
|
|
314
|
+
ret[name] = process.env[key];
|
|
315
|
+
}
|
|
303
316
|
return ret;
|
|
304
317
|
}, {});
|
|
305
318
|
};
|
|
306
319
|
var getConfigEnv = () => {
|
|
307
|
-
const prefix =
|
|
320
|
+
const prefix = "STORM_";
|
|
308
321
|
let config = {
|
|
309
322
|
name: process.env[`${prefix}NAME`],
|
|
310
323
|
namespace: process.env[`${prefix}NAMESPACE`],
|
|
@@ -323,9 +336,7 @@ var getConfigEnv = () => {
|
|
|
323
336
|
runtimeVersion: process.env[`${prefix}RUNTIME_VERSION`],
|
|
324
337
|
runtimeDirectory: process.env[`${prefix}RUNTIME_DIRECTORY`],
|
|
325
338
|
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
|
-
),
|
|
339
|
+
ci: Boolean(process.env[`${prefix}CI`] ?? process.env.CI ?? process.env.CONTINUOUS_INTEGRATION),
|
|
329
340
|
colors: {
|
|
330
341
|
primary: process.env[`${prefix}COLOR_PRIMARY`],
|
|
331
342
|
background: process.env[`${prefix}COLOR_BACKGROUND`],
|
|
@@ -338,9 +349,7 @@ var getConfigEnv = () => {
|
|
|
338
349
|
repository: process.env[`${prefix}REPOSITORY`],
|
|
339
350
|
branch: process.env[`${prefix}BRANCH`],
|
|
340
351
|
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,
|
|
352
|
+
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
353
|
extensions: {}
|
|
345
354
|
};
|
|
346
355
|
const serializedConfig = process.env[`${prefix}CONFIG`];
|
|
@@ -355,26 +364,27 @@ var getConfigEnv = () => {
|
|
|
355
364
|
}
|
|
356
365
|
const extensionPrefix = `${prefix}EXTENSION_`;
|
|
357
366
|
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
|
-
|
|
367
|
+
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("");
|
|
368
|
+
if (extensionName) {
|
|
369
|
+
ret.extensions[extensionName] = getExtensionEnv(extensionName);
|
|
370
|
+
}
|
|
362
371
|
return ret;
|
|
363
372
|
}, config);
|
|
364
373
|
};
|
|
365
374
|
|
|
366
375
|
// packages/config-tools/src/env/set-env.ts
|
|
367
376
|
var setExtensionEnv = (extensionName, extension) => {
|
|
368
|
-
Object.keys(extension ?? {})
|
|
377
|
+
for (const key of Object.keys(extension ?? {})) {
|
|
369
378
|
if (extension[key]) {
|
|
370
|
-
|
|
379
|
+
const result = key?.replace(
|
|
371
380
|
/([A-Z])+/g,
|
|
372
381
|
(input) => input ? input[0].toUpperCase() + input.slice(1) : ""
|
|
373
382
|
).split(/(?=[A-Z])|[\.\-\s_]/).map((x) => x.toLowerCase()) ?? [];
|
|
374
383
|
let extensionKey;
|
|
375
384
|
if (result.length === 0) {
|
|
376
385
|
return;
|
|
377
|
-
}
|
|
386
|
+
}
|
|
387
|
+
if (result.length === 1) {
|
|
378
388
|
extensionKey = result[0].toUpperCase();
|
|
379
389
|
} else {
|
|
380
390
|
extensionKey = result.reduce((ret, part) => {
|
|
@@ -383,59 +393,117 @@ var setExtensionEnv = (extensionName, extension) => {
|
|
|
383
393
|
}
|
|
384
394
|
process.env[`STORM_EXTENSION_${extensionName.toUpperCase()}_${extensionKey.toUpperCase()}`] = extension[key];
|
|
385
395
|
}
|
|
386
|
-
}
|
|
396
|
+
}
|
|
387
397
|
};
|
|
388
398
|
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
|
-
|
|
399
|
+
const prefix = "STORM_";
|
|
400
|
+
if (config.name) {
|
|
401
|
+
process.env[`${prefix}NAME`] = config.name;
|
|
402
|
+
}
|
|
403
|
+
if (config.namespace) {
|
|
404
|
+
process.env[`${prefix}NAMESPACE`] = config.namespace;
|
|
405
|
+
}
|
|
406
|
+
if (config.owner) {
|
|
407
|
+
process.env[`${prefix}OWNER`] = config.owner;
|
|
408
|
+
}
|
|
409
|
+
if (config.worker) {
|
|
410
|
+
process.env[`${prefix}WORKER`] = config.worker;
|
|
411
|
+
}
|
|
412
|
+
if (config.organization) {
|
|
413
|
+
process.env[`${prefix}ORGANIZATION`] = config.organization;
|
|
414
|
+
}
|
|
415
|
+
if (config.packageManager) {
|
|
416
|
+
process.env[`${prefix}PACKAGE_MANAGER`] = config.packageManager;
|
|
417
|
+
}
|
|
418
|
+
if (config.license) {
|
|
419
|
+
process.env[`${prefix}LICENSE`] = config.license;
|
|
420
|
+
}
|
|
421
|
+
if (config.homepage) {
|
|
422
|
+
process.env[`${prefix}HOMEPAGE`] = config.homepage;
|
|
423
|
+
}
|
|
424
|
+
if (config.timezone) {
|
|
425
|
+
process.env[`${prefix}TIMEZONE`] = config.timezone;
|
|
426
|
+
process.env.TZ = config.timezone;
|
|
427
|
+
process.env.DEFAULT_TIMEZONE = config.timezone;
|
|
428
|
+
}
|
|
429
|
+
if (config.locale) {
|
|
430
|
+
process.env[`${prefix}LOCALE`] = config.locale;
|
|
431
|
+
process.env.LOCALE = config.locale;
|
|
432
|
+
process.env.DEFAULT_LOCALE = config.locale;
|
|
433
|
+
process.env.LANG = config.locale ? `${config.locale.replaceAll("-", "_")}.UTF-8` : "en_US.UTF-8";
|
|
434
|
+
}
|
|
435
|
+
if (config.configFile) {
|
|
436
|
+
process.env[`${prefix}CONFIG_FILE`] = config.configFile;
|
|
437
|
+
}
|
|
438
|
+
if (config.workspaceRoot) {
|
|
439
|
+
process.env[`${prefix}WORKSPACE_ROOT`] = config.workspaceRoot;
|
|
440
|
+
process.env.NX_WORKSPACE_ROOT = config.workspaceRoot;
|
|
441
|
+
process.env.NX_WORKSPACE_ROOT_PATH = config.workspaceRoot;
|
|
442
|
+
}
|
|
443
|
+
if (config.packageDirectory) {
|
|
444
|
+
process.env[`${prefix}PACKAGE_DIRECTORY`] = config.packageDirectory;
|
|
445
|
+
}
|
|
446
|
+
if (config.buildDirectory) {
|
|
447
|
+
process.env[`${prefix}BUILD_DIRECTORY`] = config.buildDirectory;
|
|
448
|
+
}
|
|
449
|
+
if (config.runtimeVersion) {
|
|
450
|
+
process.env[`${prefix}RUNTIME_VERSION`] = config.runtimeVersion;
|
|
451
|
+
}
|
|
452
|
+
if (config.runtimeDirectory) {
|
|
453
|
+
process.env[`${prefix}RUNTIME_DIRECTORY`] = config.runtimeDirectory;
|
|
454
|
+
}
|
|
455
|
+
if (config.env) {
|
|
456
|
+
process.env[`${prefix}ENV`] = config.env;
|
|
457
|
+
process.env.NODE_ENV = config.env;
|
|
458
|
+
process.env.ENVIRONMENT = config.env;
|
|
459
|
+
}
|
|
460
|
+
if (config.ci) {
|
|
461
|
+
process.env[`${prefix}CI`] = String(config.ci);
|
|
462
|
+
process.env.CI = String(config.ci);
|
|
463
|
+
process.env.CONTINUOUS_INTEGRATION = String(config.ci);
|
|
464
|
+
}
|
|
465
|
+
if (config.colors.primary) {
|
|
466
|
+
process.env[`${prefix}COLOR_PRIMARY`] = config.colors.primary;
|
|
467
|
+
}
|
|
468
|
+
if (config.colors.background) {
|
|
469
|
+
process.env[`${prefix}COLOR_BACKGROUND`] = config.colors.background;
|
|
470
|
+
}
|
|
471
|
+
if (config.colors.success) {
|
|
472
|
+
process.env[`${prefix}COLOR_SUCCESS`] = config.colors.success;
|
|
473
|
+
}
|
|
474
|
+
if (config.colors.info) {
|
|
475
|
+
process.env[`${prefix}COLOR_INFO`] = config.colors.info;
|
|
476
|
+
}
|
|
477
|
+
if (config.colors.warning) {
|
|
478
|
+
process.env[`${prefix}COLOR_WARNING`] = config.colors.warning;
|
|
479
|
+
}
|
|
480
|
+
if (config.colors.error) {
|
|
481
|
+
process.env[`${prefix}COLOR_ERROR`] = config.colors.error;
|
|
482
|
+
}
|
|
483
|
+
if (config.colors.fatal) {
|
|
484
|
+
process.env[`${prefix}COLOR_FATAL`] = config.colors.fatal;
|
|
485
|
+
}
|
|
486
|
+
if (config.repository) {
|
|
487
|
+
process.env[`${prefix}REPOSITORY`] = config.repository;
|
|
488
|
+
}
|
|
489
|
+
if (config.branch) {
|
|
490
|
+
process.env[`${prefix}BRANCH`] = config.branch;
|
|
491
|
+
}
|
|
492
|
+
if (config.preMajor) {
|
|
493
|
+
process.env[`${prefix}PRE_MAJOR`] = String(config.preMajor);
|
|
494
|
+
}
|
|
495
|
+
if (config.logLevel) {
|
|
496
|
+
process.env[`${prefix}LOG_LEVEL`] = String(config.logLevel);
|
|
497
|
+
process.env.LOG_LEVEL = String(config.logLevel);
|
|
498
|
+
process.env.NX_VERBOSE_LOGGING = String(
|
|
499
|
+
getLogLevel(config.logLevel) >= LogLevel.DEBUG ? true : false
|
|
500
|
+
);
|
|
501
|
+
process.env.RUST_BACKTRACE = getLogLevel(config.logLevel) >= LogLevel.DEBUG ? "full" : "none";
|
|
502
|
+
}
|
|
503
|
+
process.env[`${prefix}CONFIG`] = JSON.stringify(config);
|
|
504
|
+
for (const key of Object.keys(config.extensions ?? {})) {
|
|
437
505
|
config.extensions[key] && Object.keys(config.extensions[key]) && setExtensionEnv(key, config.extensions[key]);
|
|
438
|
-
}
|
|
506
|
+
}
|
|
439
507
|
};
|
|
440
508
|
|
|
441
509
|
// packages/config-tools/src/create-storm-config.ts
|
|
@@ -447,7 +515,7 @@ var createConfig = (workspaceRoot) => {
|
|
|
447
515
|
var createStormConfig = (extensionName, schema, workspaceRoot) => {
|
|
448
516
|
let result;
|
|
449
517
|
if (!_static_cache2) {
|
|
450
|
-
|
|
518
|
+
const config = getConfigEnv();
|
|
451
519
|
const defaultConfig = getDefaultConfig(config, workspaceRoot);
|
|
452
520
|
result = StormConfigSchema.parse({
|
|
453
521
|
...defaultConfig,
|
|
@@ -463,7 +531,10 @@ var createStormConfig = (extensionName, schema, workspaceRoot) => {
|
|
|
463
531
|
if (schema && extensionName) {
|
|
464
532
|
result.extensions = {
|
|
465
533
|
...result.extensions,
|
|
466
|
-
[extensionName]: createConfigExtension(
|
|
534
|
+
[extensionName]: createConfigExtension(
|
|
535
|
+
extensionName,
|
|
536
|
+
schema
|
|
537
|
+
)
|
|
467
538
|
};
|
|
468
539
|
}
|
|
469
540
|
_static_cache2 = result;
|
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":1500,"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":1378,"imports":[{"path":"packages/config-tools/src/types.ts","kind":"import-statement","original":"../types"}],"format":"esm"},"packages/config-tools/src/utilities/index.ts":{"bytes":110,"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"}],"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}],"exports":[],"entryPoint":"packages/config-tools/src/index.ts","inputs":{"packages/config-tools/src/index.ts":{"bytesInOutput":941},"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":282},"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":998},"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":24628},"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":1500,"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":1378,"imports":[{"path":"packages/config-tools/src/types.ts","kind":"import-statement","original":"../types"}],"format":"esm"},"packages/config-tools/src/utilities/index.ts":{"bytes":110,"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"}],"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}],"exports":["ColorConfigSchema","DefaultColorConfig","DefaultStormConfig","LogLevel","LogLevelLabel","StormConfigSchema","createConfig","createConfigExtension","createStormConfig","findWorkspaceRoot","findWorkspaceRootSafe","getConfigEnv","getConfigFile","getDefaultConfig","getExtensionEnv","getLogLevel","getLogLevelLabel","loadStormConfig","setConfigEnv","setExtensionEnv"],"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":282},"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":998},"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":22060},"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.14.
|
|
3
|
+
"version": "1.14.3",
|
|
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": {
|
|
@@ -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
|