@storm-software/config-tools 1.190.119 → 1.190.121
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/bin/config.cjs +1213 -1558
- package/bin/config.mjs +1271 -0
- package/dist/_virtual/_rolldown/runtime.cjs +23 -0
- package/dist/config-file/get-config-file.cjs +67 -28
- package/dist/config-file/get-config-file.d.cts +5 -5
- package/dist/config-file/{get-config-file.d.ts → get-config-file.d.mts} +7 -5
- package/dist/config-file/get-config-file.mjs +66 -0
- package/dist/config-file/index.cjs +4 -29
- package/dist/config-file/index.d.cts +2 -3
- package/dist/config-file/index.d.mts +4 -0
- package/dist/config-file/index.mjs +5 -0
- package/dist/create-storm-config.cjs +115 -34
- package/dist/create-storm-config.d.cts +5 -5
- package/dist/{create-storm-config.d.ts → create-storm-config.d.mts} +7 -5
- package/dist/create-storm-config.mjs +113 -0
- package/dist/env/get-env.cjs +202 -11
- package/dist/env/get-env.d.cts +5 -5
- package/dist/env/{get-env.d.ts → get-env.d.mts} +7 -5
- package/dist/env/get-env.mjs +203 -0
- package/dist/env/index.cjs +7 -18
- package/dist/env/index.d.cts +3 -4
- package/dist/env/index.d.mts +5 -0
- package/dist/env/index.mjs +6 -0
- package/dist/env/set-env.cjs +230 -11
- package/dist/env/set-env.d.cts +8 -8
- package/dist/env/{set-env.d.ts → set-env.d.mts} +10 -8
- package/dist/env/set-env.mjs +231 -0
- package/dist/get-config.cjs +46 -34
- package/dist/get-config.d.cts +18 -18
- package/dist/{get-config.d.ts → get-config.d.mts} +20 -18
- package/dist/get-config.mjs +46 -0
- package/dist/index.cjs +98 -201
- package/dist/index.d.cts +27 -28
- package/dist/index.d.mts +29 -0
- package/dist/index.mjs +26 -0
- package/dist/logger/chalk.cjs +43 -6
- package/dist/logger/chalk.d.cts +18 -17
- package/dist/logger/chalk.d.mts +37 -0
- package/dist/logger/chalk.mjs +43 -0
- package/dist/logger/console-icons.cjs +18 -8
- package/dist/logger/console-icons.d.cts +5 -8
- package/dist/logger/console-icons.d.mts +7 -0
- package/dist/logger/console-icons.mjs +20 -0
- package/dist/logger/console.cjs +195 -37
- package/dist/logger/console.d.cts +25 -25
- package/dist/logger/{console.d.ts → console.d.mts} +27 -25
- package/dist/logger/console.mjs +185 -0
- package/dist/logger/create-logger.cjs +34 -14
- package/dist/logger/create-logger.d.cts +5 -6
- package/dist/logger/{create-logger.d.ts → create-logger.d.mts} +7 -6
- package/dist/logger/create-logger.mjs +34 -0
- package/dist/logger/format-timestamp.cjs +14 -6
- package/dist/logger/format-timestamp.d.cts +3 -2
- package/dist/logger/{format-timestamp.d.ts → format-timestamp.d.mts} +5 -2
- package/dist/logger/format-timestamp.mjs +16 -0
- package/dist/logger/get-log-level.cjs +54 -11
- package/dist/logger/get-log-level.d.cts +4 -5
- package/dist/logger/{get-log-level.d.ts → get-log-level.d.mts} +6 -5
- package/dist/logger/get-log-level.mjs +54 -0
- package/dist/logger/index.cjs +29 -61
- package/dist/logger/index.d.cts +8 -10
- package/dist/logger/index.d.mts +10 -0
- package/dist/logger/index.mjs +11 -0
- package/dist/logger/is-unicode-supported.cjs +8 -6
- package/dist/logger/is-unicode-supported.d.cts +3 -2
- package/dist/logger/is-unicode-supported.d.mts +6 -0
- package/dist/logger/is-unicode-supported.mjs +10 -0
- package/dist/types.cjs +29 -8
- package/dist/types.d.cts +39 -41
- package/dist/types.d.mts +53 -0
- package/dist/types.mjs +30 -0
- package/dist/utilities/apply-workspace-tokens.cjs +37 -13
- package/dist/utilities/apply-workspace-tokens.d.cts +4 -5
- package/dist/utilities/{apply-workspace-tokens.d.ts → apply-workspace-tokens.d.mts} +6 -5
- package/dist/utilities/apply-workspace-tokens.mjs +37 -0
- package/dist/utilities/colors.cjs +98 -12
- package/dist/utilities/colors.d.cts +4 -4
- package/dist/utilities/{colors.d.ts → colors.d.mts} +6 -4
- package/dist/utilities/colors.mjs +97 -0
- package/dist/utilities/correct-paths.cjs +201 -32
- package/dist/utilities/correct-paths.d.cts +4 -4
- package/dist/utilities/{correct-paths.d.ts → correct-paths.d.mts} +6 -4
- package/dist/utilities/correct-paths.mjs +190 -0
- package/dist/utilities/file-path-utils.cjs +48 -11
- package/dist/utilities/file-path-utils.d.cts +15 -14
- package/dist/utilities/{file-path-utils.d.ts → file-path-utils.d.mts} +17 -14
- package/dist/utilities/file-path-utils.mjs +48 -0
- package/dist/utilities/find-up.cjs +17 -6
- package/dist/utilities/find-up.d.cts +3 -2
- package/dist/utilities/{find-up.d.ts → find-up.d.mts} +5 -2
- package/dist/utilities/find-up.mjs +19 -0
- package/dist/utilities/find-workspace-root.cjs +72 -10
- package/dist/utilities/find-workspace-root.d.cts +3 -2
- package/dist/utilities/{find-workspace-root.d.ts → find-workspace-root.d.mts} +5 -2
- package/dist/utilities/find-workspace-root.mjs +73 -0
- package/dist/utilities/get-default-config.cjs +73 -11
- package/dist/utilities/get-default-config.d.cts +4 -4
- package/dist/utilities/{get-default-config.d.ts → get-default-config.d.mts} +6 -4
- package/dist/utilities/get-default-config.mjs +74 -0
- package/dist/utilities/index.cjs +49 -109
- package/dist/utilities/index.d.cts +10 -14
- package/dist/utilities/index.d.mts +12 -0
- package/dist/utilities/index.mjs +13 -0
- package/dist/utilities/process-handler.cjs +38 -18
- package/dist/utilities/process-handler.d.cts +4 -4
- package/dist/utilities/process-handler.d.mts +9 -0
- package/dist/utilities/process-handler.mjs +38 -0
- package/dist/utilities/run.cjs +64 -10
- package/dist/utilities/run.d.cts +5 -6
- package/dist/utilities/{run.d.ts → run.d.mts} +7 -6
- package/dist/utilities/run.mjs +64 -0
- package/dist/utilities/toml.cjs +37 -24
- package/dist/utilities/toml.d.cts +148 -147
- package/dist/utilities/toml.d.mts +192 -0
- package/dist/utilities/toml.mjs +33 -0
- package/package.json +106 -158
- package/bin/config.js +0 -1616
- package/dist/chunk-24B36RDB.cjs +0 -81
- package/dist/chunk-27N3QEX5.js +0 -40
- package/dist/chunk-2AVLCXLT.js +0 -0
- package/dist/chunk-2RLMTBVZ.js +0 -233
- package/dist/chunk-2WBD2G3E.cjs +0 -38
- package/dist/chunk-3COHMHPU.cjs +0 -1
- package/dist/chunk-4Q45WJYQ.js +0 -165
- package/dist/chunk-5C7PIENF.js +0 -92
- package/dist/chunk-5J2SS4QU.js +0 -83
- package/dist/chunk-65SWKEHV.cjs +0 -1
- package/dist/chunk-6Y623TCS.cjs +0 -40
- package/dist/chunk-7PV6L7I7.cjs +0 -1
- package/dist/chunk-7QBTVNMR.cjs +0 -30
- package/dist/chunk-BDATZ3UB.cjs +0 -233
- package/dist/chunk-BZRTSWH4.cjs +0 -395
- package/dist/chunk-D3FRXXDE.js +0 -947
- package/dist/chunk-DTGT4OI3.cjs +0 -14
- package/dist/chunk-EC2KPWRG.cjs +0 -24
- package/dist/chunk-EENQN6N2.js +0 -40
- package/dist/chunk-ENI4UUSK.cjs +0 -35
- package/dist/chunk-FJNXECWU.js +0 -395
- package/dist/chunk-FMDVBSP6.cjs +0 -83
- package/dist/chunk-G2MK47WL.js +0 -14
- package/dist/chunk-HFS7WJVW.js +0 -81
- package/dist/chunk-HVVJHTFS.js +0 -36
- package/dist/chunk-IWD6YQKX.cjs +0 -1
- package/dist/chunk-IWQRXQ4N.cjs +0 -84
- package/dist/chunk-JK4TT5IV.js +0 -35
- package/dist/chunk-JWLDCEBZ.cjs +0 -70
- package/dist/chunk-JZAYHDV3.js +0 -8
- package/dist/chunk-KSMN3HSC.js +0 -38
- package/dist/chunk-L6UNTUC4.js +0 -0
- package/dist/chunk-LOY6ICHZ.cjs +0 -36
- package/dist/chunk-MBG2FTBL.cjs +0 -47
- package/dist/chunk-MQG74XF7.js +0 -102
- package/dist/chunk-MSAQEGBK.cjs +0 -92
- package/dist/chunk-NJFLUTGH.cjs +0 -25
- package/dist/chunk-PCYB64MB.cjs +0 -40
- package/dist/chunk-RALMUN5C.js +0 -30
- package/dist/chunk-RRKB32OH.js +0 -0
- package/dist/chunk-RUKM6FCF.js +0 -25
- package/dist/chunk-SIW7AXUG.js +0 -56
- package/dist/chunk-SLICWTO2.cjs +0 -165
- package/dist/chunk-SO3FWVXC.js +0 -84
- package/dist/chunk-SXPH7ILL.js +0 -70
- package/dist/chunk-T7YISGRS.cjs +0 -102
- package/dist/chunk-TZZRLM5J.cjs +0 -947
- package/dist/chunk-UJ77IBHD.cjs +0 -233
- package/dist/chunk-UKGRDKIH.js +0 -0
- package/dist/chunk-V3GMJ4TX.js +0 -233
- package/dist/chunk-WQJYIPSL.cjs +0 -8
- package/dist/chunk-YBVOKYAM.cjs +0 -56
- package/dist/chunk-YX4736HU.js +0 -47
- package/dist/chunk-ZFNAUMQS.js +0 -24
- package/dist/config-file/get-config-file.js +0 -28
- package/dist/config-file/index.d.ts +0 -3
- package/dist/config-file/index.js +0 -29
- package/dist/create-storm-config.js +0 -35
- package/dist/env/get-env.js +0 -11
- package/dist/env/index.d.ts +0 -4
- package/dist/env/index.js +0 -18
- package/dist/env/set-env.js +0 -11
- package/dist/get-config.js +0 -34
- package/dist/index.d.ts +0 -28
- package/dist/index.js +0 -201
- package/dist/logger/chalk.d.ts +0 -34
- package/dist/logger/chalk.js +0 -6
- package/dist/logger/console-icons.d.ts +0 -8
- package/dist/logger/console-icons.js +0 -8
- package/dist/logger/console.js +0 -37
- package/dist/logger/create-logger.js +0 -14
- package/dist/logger/format-timestamp.js +0 -6
- package/dist/logger/get-log-level.js +0 -11
- package/dist/logger/index.d.ts +0 -10
- package/dist/logger/index.js +0 -61
- package/dist/logger/is-unicode-supported.d.ts +0 -3
- package/dist/logger/is-unicode-supported.js +0 -6
- package/dist/types.d.ts +0 -53
- package/dist/types.js +0 -8
- package/dist/utilities/apply-workspace-tokens.js +0 -13
- package/dist/utilities/colors.js +0 -12
- package/dist/utilities/correct-paths.js +0 -32
- package/dist/utilities/file-path-utils.js +0 -11
- package/dist/utilities/find-up.js +0 -6
- package/dist/utilities/find-workspace-root.js +0 -10
- package/dist/utilities/get-default-config.js +0 -11
- package/dist/utilities/index.d.ts +0 -14
- package/dist/utilities/index.js +0 -109
- package/dist/utilities/process-handler.d.ts +0 -7
- package/dist/utilities/process-handler.js +0 -18
- package/dist/utilities/run.js +0 -10
- package/dist/utilities/toml.d.ts +0 -189
- package/dist/utilities/toml.js +0 -24
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
10
|
+
key = keys[i];
|
|
11
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
12
|
+
get: ((k) => from[k]).bind(null, key),
|
|
13
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
|
|
19
|
+
value: mod,
|
|
20
|
+
enumerable: true
|
|
21
|
+
}) : target, mod));
|
|
22
|
+
//#endregion
|
|
23
|
+
exports.__toESM = __toESM;
|
|
@@ -1,28 +1,67 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
require(
|
|
6
|
-
require(
|
|
7
|
-
|
|
8
|
-
require(
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_runtime = require("../_virtual/_rolldown/runtime.cjs");
|
|
3
|
+
const require_logger_console = require("../logger/console.cjs");
|
|
4
|
+
const require_utilities_correct_paths = require("../utilities/correct-paths.cjs");
|
|
5
|
+
const require_utilities_find_workspace_root = require("../utilities/find-workspace-root.cjs");
|
|
6
|
+
let defu = require("defu");
|
|
7
|
+
defu = require_runtime.__toESM(defu, 1);
|
|
8
|
+
let c12 = require("c12");
|
|
9
|
+
//#region src/config-file/get-config-file.ts
|
|
10
|
+
/**
|
|
11
|
+
* Get the config file for the current Storm workspace
|
|
12
|
+
*
|
|
13
|
+
* @param fileName - The name of the config file to search for
|
|
14
|
+
* @param filePath - The path to search for the config file in
|
|
15
|
+
* @returns The config file for the current Storm workspace
|
|
16
|
+
*/
|
|
17
|
+
const getConfigFileByName = async (fileName, filePath, options = {}) => {
|
|
18
|
+
const workspacePath = filePath || require_utilities_find_workspace_root.findWorkspaceRoot(filePath);
|
|
19
|
+
const configs = await Promise.all([(0, c12.loadConfig)({
|
|
20
|
+
cwd: workspacePath,
|
|
21
|
+
packageJson: true,
|
|
22
|
+
name: fileName,
|
|
23
|
+
envName: fileName?.toUpperCase(),
|
|
24
|
+
jitiOptions: {
|
|
25
|
+
debug: false,
|
|
26
|
+
fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : require_utilities_correct_paths.joinPaths(process.env.STORM_CACHE_DIR || "node_modules/.cache/storm", "jiti")
|
|
27
|
+
},
|
|
28
|
+
...options
|
|
29
|
+
}), (0, c12.loadConfig)({
|
|
30
|
+
cwd: workspacePath,
|
|
31
|
+
packageJson: true,
|
|
32
|
+
name: fileName,
|
|
33
|
+
envName: fileName?.toUpperCase(),
|
|
34
|
+
jitiOptions: {
|
|
35
|
+
debug: false,
|
|
36
|
+
fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : require_utilities_correct_paths.joinPaths(process.env.STORM_CACHE_DIR || "node_modules/.cache/storm", "jiti")
|
|
37
|
+
},
|
|
38
|
+
configFile: fileName,
|
|
39
|
+
...options
|
|
40
|
+
})]);
|
|
41
|
+
return (0, defu.default)(configs[0] ?? {}, configs[1] ?? {});
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Get the config file for the current Storm workspace
|
|
45
|
+
*
|
|
46
|
+
* @returns The config file for the current Storm workspace
|
|
47
|
+
*/
|
|
48
|
+
const getConfigFile = async (filePath, additionalFileNames = []) => {
|
|
49
|
+
const workspacePath = filePath ? filePath : require_utilities_find_workspace_root.findWorkspaceRoot(filePath);
|
|
50
|
+
const result = await getConfigFileByName("storm-workspace", workspacePath);
|
|
51
|
+
let config = result.config;
|
|
52
|
+
const configFile = result.configFile;
|
|
53
|
+
if (config && configFile && Object.keys(config).length > 0 && !config.skipConfigLogging) require_logger_console.writeTrace(`Found Storm configuration file "${configFile.includes(`${workspacePath}/`) ? configFile.replace(`${workspacePath}/`, "") : configFile}" at "${workspacePath}"`, { logLevel: "all" });
|
|
54
|
+
if (additionalFileNames && additionalFileNames.length > 0) {
|
|
55
|
+
const results = await Promise.all(additionalFileNames.map((fileName) => getConfigFileByName(fileName, workspacePath)));
|
|
56
|
+
for (const result of results) if (result?.config && result?.configFile && Object.keys(result.config).length > 0) {
|
|
57
|
+
if (!config.skipConfigLogging && !result.config.skipConfigLogging) require_logger_console.writeTrace(`Found alternative configuration file "${result.configFile.includes(`${workspacePath}/`) ? result.configFile.replace(`${workspacePath}/`, "") : result.configFile}" at "${workspacePath}"`, { logLevel: "all" });
|
|
58
|
+
config = (0, defu.default)(result.config ?? {}, config ?? {});
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
if (!config || Object.keys(config).length === 0) return;
|
|
62
|
+
config.configFile = configFile;
|
|
63
|
+
return config;
|
|
64
|
+
};
|
|
65
|
+
//#endregion
|
|
66
|
+
exports.getConfigFile = getConfigFile;
|
|
67
|
+
exports.getConfigFileByName = getConfigFileByName;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { StormWorkspaceConfigInput } from
|
|
2
|
-
import { LoadConfigOptions, ResolvedConfig } from
|
|
3
|
-
|
|
1
|
+
import { StormWorkspaceConfigInput } from "@storm-software/config";
|
|
2
|
+
import { LoadConfigOptions, ResolvedConfig } from "c12";
|
|
3
|
+
//#region src/config-file/get-config-file.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* Get the config file for the current Storm workspace
|
|
6
6
|
*
|
|
@@ -15,5 +15,5 @@ declare const getConfigFileByName: (fileName: string, filePath?: string, options
|
|
|
15
15
|
* @returns The config file for the current Storm workspace
|
|
16
16
|
*/
|
|
17
17
|
declare const getConfigFile: (filePath?: string, additionalFileNames?: string[]) => Promise<Partial<StormWorkspaceConfigInput> | undefined>;
|
|
18
|
-
|
|
19
|
-
export { getConfigFile, getConfigFileByName };
|
|
18
|
+
//#endregion
|
|
19
|
+
export { getConfigFile, getConfigFileByName };
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
1
|
+
import __tsdown_shims_path from 'node:path';
|
|
2
|
+
import __tsdown_shims_url from 'node:url';
|
|
3
|
+
import { LoadConfigOptions, ResolvedConfig } from "c12";
|
|
4
|
+
import { StormWorkspaceConfigInput } from "@storm-software/config";
|
|
5
|
+
//#region src/config-file/get-config-file.d.ts
|
|
4
6
|
/**
|
|
5
7
|
* Get the config file for the current Storm workspace
|
|
6
8
|
*
|
|
@@ -15,5 +17,5 @@ declare const getConfigFileByName: (fileName: string, filePath?: string, options
|
|
|
15
17
|
* @returns The config file for the current Storm workspace
|
|
16
18
|
*/
|
|
17
19
|
declare const getConfigFile: (filePath?: string, additionalFileNames?: string[]) => Promise<Partial<StormWorkspaceConfigInput> | undefined>;
|
|
18
|
-
|
|
19
|
-
export { getConfigFile, getConfigFileByName };
|
|
20
|
+
//#endregion
|
|
21
|
+
export { getConfigFile, getConfigFileByName };
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import "node:path";
|
|
2
|
+
import "node:url";
|
|
3
|
+
import.meta.url;
|
|
4
|
+
import { writeTrace } from "../logger/console.mjs";
|
|
5
|
+
import { joinPaths } from "../utilities/correct-paths.mjs";
|
|
6
|
+
import { findWorkspaceRoot } from "../utilities/find-workspace-root.mjs";
|
|
7
|
+
import defu from "defu";
|
|
8
|
+
import { loadConfig } from "c12";
|
|
9
|
+
//#region src/config-file/get-config-file.ts
|
|
10
|
+
/**
|
|
11
|
+
* Get the config file for the current Storm workspace
|
|
12
|
+
*
|
|
13
|
+
* @param fileName - The name of the config file to search for
|
|
14
|
+
* @param filePath - The path to search for the config file in
|
|
15
|
+
* @returns The config file for the current Storm workspace
|
|
16
|
+
*/
|
|
17
|
+
const getConfigFileByName = async (fileName, filePath, options = {}) => {
|
|
18
|
+
const workspacePath = filePath || findWorkspaceRoot(filePath);
|
|
19
|
+
const configs = await Promise.all([loadConfig({
|
|
20
|
+
cwd: workspacePath,
|
|
21
|
+
packageJson: true,
|
|
22
|
+
name: fileName,
|
|
23
|
+
envName: fileName?.toUpperCase(),
|
|
24
|
+
jitiOptions: {
|
|
25
|
+
debug: false,
|
|
26
|
+
fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : joinPaths(process.env.STORM_CACHE_DIR || "node_modules/.cache/storm", "jiti")
|
|
27
|
+
},
|
|
28
|
+
...options
|
|
29
|
+
}), loadConfig({
|
|
30
|
+
cwd: workspacePath,
|
|
31
|
+
packageJson: true,
|
|
32
|
+
name: fileName,
|
|
33
|
+
envName: fileName?.toUpperCase(),
|
|
34
|
+
jitiOptions: {
|
|
35
|
+
debug: false,
|
|
36
|
+
fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : joinPaths(process.env.STORM_CACHE_DIR || "node_modules/.cache/storm", "jiti")
|
|
37
|
+
},
|
|
38
|
+
configFile: fileName,
|
|
39
|
+
...options
|
|
40
|
+
})]);
|
|
41
|
+
return defu(configs[0] ?? {}, configs[1] ?? {});
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Get the config file for the current Storm workspace
|
|
45
|
+
*
|
|
46
|
+
* @returns The config file for the current Storm workspace
|
|
47
|
+
*/
|
|
48
|
+
const getConfigFile = async (filePath, additionalFileNames = []) => {
|
|
49
|
+
const workspacePath = filePath ? filePath : findWorkspaceRoot(filePath);
|
|
50
|
+
const result = await getConfigFileByName("storm-workspace", workspacePath);
|
|
51
|
+
let config = result.config;
|
|
52
|
+
const configFile = result.configFile;
|
|
53
|
+
if (config && configFile && Object.keys(config).length > 0 && !config.skipConfigLogging) writeTrace(`Found Storm configuration file "${configFile.includes(`${workspacePath}/`) ? configFile.replace(`${workspacePath}/`, "") : configFile}" at "${workspacePath}"`, { logLevel: "all" });
|
|
54
|
+
if (additionalFileNames && additionalFileNames.length > 0) {
|
|
55
|
+
const results = await Promise.all(additionalFileNames.map((fileName) => getConfigFileByName(fileName, workspacePath)));
|
|
56
|
+
for (const result of results) if (result?.config && result?.configFile && Object.keys(result.config).length > 0) {
|
|
57
|
+
if (!config.skipConfigLogging && !result.config.skipConfigLogging) writeTrace(`Found alternative configuration file "${result.configFile.includes(`${workspacePath}/`) ? result.configFile.replace(`${workspacePath}/`, "") : result.configFile}" at "${workspacePath}"`, { logLevel: "all" });
|
|
58
|
+
config = defu(result.config ?? {}, config ?? {});
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
if (!config || Object.keys(config).length === 0) return;
|
|
62
|
+
config.configFile = configFile;
|
|
63
|
+
return config;
|
|
64
|
+
};
|
|
65
|
+
//#endregion
|
|
66
|
+
export { getConfigFile, getConfigFileByName };
|
|
@@ -1,29 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var _chunkMSAQEGBKcjs = require('../chunk-MSAQEGBK.cjs');
|
|
6
|
-
require('../chunk-3COHMHPU.cjs');
|
|
7
|
-
require('../chunk-YBVOKYAM.cjs');
|
|
8
|
-
require('../chunk-6Y623TCS.cjs');
|
|
9
|
-
require('../chunk-MBG2FTBL.cjs');
|
|
10
|
-
require('../chunk-24B36RDB.cjs');
|
|
11
|
-
require('../chunk-2WBD2G3E.cjs');
|
|
12
|
-
require('../chunk-T7YISGRS.cjs');
|
|
13
|
-
require('../chunk-IWQRXQ4N.cjs');
|
|
14
|
-
require('../chunk-NJFLUTGH.cjs');
|
|
15
|
-
require('../chunk-7PV6L7I7.cjs');
|
|
16
|
-
require('../chunk-ENI4UUSK.cjs');
|
|
17
|
-
require('../chunk-TZZRLM5J.cjs');
|
|
18
|
-
require('../chunk-FMDVBSP6.cjs');
|
|
19
|
-
require('../chunk-LOY6ICHZ.cjs');
|
|
20
|
-
require('../chunk-EC2KPWRG.cjs');
|
|
21
|
-
require('../chunk-DTGT4OI3.cjs');
|
|
22
|
-
require('../chunk-WQJYIPSL.cjs');
|
|
23
|
-
require('../chunk-BDATZ3UB.cjs');
|
|
24
|
-
require('../chunk-JWLDCEBZ.cjs');
|
|
25
|
-
require('../chunk-7QBTVNMR.cjs');
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
exports.getConfigFile = _chunkMSAQEGBKcjs.getConfigFile; exports.getConfigFileByName = _chunkMSAQEGBKcjs.getConfigFileByName;
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_config_file_get_config_file = require("./get-config-file.cjs");
|
|
3
|
+
exports.getConfigFile = require_config_file_get_config_file.getConfigFile;
|
|
4
|
+
exports.getConfigFileByName = require_config_file_get_config_file.getConfigFileByName;
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import 'c12';
|
|
1
|
+
import { getConfigFile, getConfigFileByName } from "./get-config-file.cjs";
|
|
2
|
+
export { getConfigFile, getConfigFileByName };
|
|
@@ -1,35 +1,116 @@
|
|
|
1
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_runtime = require("./_virtual/_rolldown/runtime.cjs");
|
|
3
|
+
const require_logger_console = require("./logger/console.cjs");
|
|
4
|
+
const require_utilities_correct_paths = require("./utilities/correct-paths.cjs");
|
|
5
|
+
const require_utilities_find_workspace_root = require("./utilities/find-workspace-root.cjs");
|
|
6
|
+
const require_utilities_get_default_config = require("./utilities/get-default-config.cjs");
|
|
7
|
+
const require_config_file_get_config_file = require("./config-file/get-config-file.cjs");
|
|
8
|
+
const require_env_get_env = require("./env/get-env.cjs");
|
|
9
|
+
const require_env_set_env = require("./env/set-env.cjs");
|
|
10
|
+
let _storm_software_config_schema = require("@storm-software/config/schema");
|
|
11
|
+
let defu = require("defu");
|
|
12
|
+
defu = require_runtime.__toESM(defu, 1);
|
|
13
|
+
let node_fs = require("node:fs");
|
|
14
|
+
//#region src/create-storm-config.ts
|
|
15
|
+
const _extension_cache = /* @__PURE__ */ new WeakMap();
|
|
16
|
+
let _static_cache = void 0;
|
|
17
|
+
/**
|
|
18
|
+
* Get the config for the current Storm workspace
|
|
19
|
+
*
|
|
20
|
+
* @param extensionName - The name of the config extension
|
|
21
|
+
* @param schema - The schema for the config extension
|
|
22
|
+
* @param workspaceRoot - The root directory of the workspace
|
|
23
|
+
* @param skipLogs - Skip writing logs to the console
|
|
24
|
+
* @param useDefault - Whether to use the default config if no config file is found
|
|
25
|
+
* @returns The config for the current Storm workspace
|
|
26
|
+
*/
|
|
27
|
+
const createStormWorkspaceConfig = async (extensionName, schema, workspaceRoot, skipLogs = false, useDefault = true) => {
|
|
28
|
+
let result;
|
|
29
|
+
if (!_static_cache?.data || !_static_cache?.timestamp || _static_cache.timestamp < Date.now() - 8e3) {
|
|
30
|
+
let _workspaceRoot = workspaceRoot;
|
|
31
|
+
if (!_workspaceRoot) _workspaceRoot = require_utilities_find_workspace_root.findWorkspaceRoot();
|
|
32
|
+
const configEnv = require_env_get_env.getConfigEnv();
|
|
33
|
+
const configFile = await require_config_file_get_config_file.getConfigFile(_workspaceRoot);
|
|
34
|
+
if (!configFile) {
|
|
35
|
+
if (!skipLogs) require_logger_console.writeWarning("No Storm Workspace configuration file found in the current repository. Please ensure this is the expected behavior - you can add a `storm-workspace.json` file to the root of your workspace if it is not.\n", { logLevel: "all" });
|
|
36
|
+
if (useDefault === false) return;
|
|
37
|
+
}
|
|
38
|
+
const defaultConfig = await require_utilities_get_default_config.getPackageJsonConfig(_workspaceRoot);
|
|
39
|
+
const configInput = (0, defu.default)(configEnv, configFile, defaultConfig);
|
|
40
|
+
if (!configInput.variant) configInput.variant = (0, node_fs.existsSync)(require_utilities_correct_paths.joinPaths(_workspaceRoot, "nx.json")) || (0, node_fs.existsSync)(require_utilities_correct_paths.joinPaths(_workspaceRoot, ".nx")) || (0, node_fs.existsSync)(require_utilities_correct_paths.joinPaths(_workspaceRoot, "lerna.json")) || (0, node_fs.existsSync)(require_utilities_correct_paths.joinPaths(_workspaceRoot, "turbo.json")) ? "monorepo" : "minimal";
|
|
41
|
+
try {
|
|
42
|
+
const parseResult = await Promise.resolve(_storm_software_config_schema.workspaceConfigSchema._zod.parse({
|
|
43
|
+
value: configInput,
|
|
44
|
+
issues: []
|
|
45
|
+
}, { async: true }));
|
|
46
|
+
result = require_utilities_get_default_config.applyDefaultConfig(parseResult.value);
|
|
47
|
+
result.workspaceRoot ??= _workspaceRoot;
|
|
48
|
+
} catch (error) {
|
|
49
|
+
throw new Error(`Failed to parse Storm Workspace configuration${error?.message ? `: ${error.message}` : ""}
|
|
2
50
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
51
|
+
Please ensure your configuration file is valid JSON and matches the expected schema. The current workspace configuration input is: ${require_logger_console.formatLogMessage(configInput)}`, { cause: error });
|
|
52
|
+
}
|
|
53
|
+
} else result = _static_cache.data;
|
|
54
|
+
if (schema && extensionName) result.extensions = {
|
|
55
|
+
...result.extensions,
|
|
56
|
+
[extensionName]: createConfigExtension(extensionName, schema)
|
|
57
|
+
};
|
|
58
|
+
_static_cache = {
|
|
59
|
+
timestamp: Date.now(),
|
|
60
|
+
data: result
|
|
61
|
+
};
|
|
62
|
+
return result;
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* Get the config for a specific Storm config Extension
|
|
66
|
+
*
|
|
67
|
+
* @param extensionName - The name of the config extension
|
|
68
|
+
* @param options - The options for the config extension
|
|
69
|
+
* @returns The config for the specified Storm config extension. If the extension does not exist, `undefined` is returned.
|
|
70
|
+
*/
|
|
71
|
+
const createConfigExtension = (extensionName, schema) => {
|
|
72
|
+
const extension_cache_key = { extensionName };
|
|
73
|
+
if (_extension_cache.has(extension_cache_key)) return _extension_cache.get(extension_cache_key);
|
|
74
|
+
let extension = require_env_get_env.getExtensionEnv(extensionName);
|
|
75
|
+
if (schema) extension = schema.parse(extension);
|
|
76
|
+
_extension_cache.set(extension_cache_key, extension);
|
|
77
|
+
return extension;
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* Load the config file values for the current Storm workspace into environment variables
|
|
81
|
+
*
|
|
82
|
+
* @param workspaceRoot - The root directory of the workspace
|
|
83
|
+
* @param skipLogs - Skip writing logs to the console
|
|
84
|
+
* @returns The config for the current Storm workspace, throws an error if the config file could not be loaded
|
|
85
|
+
*/
|
|
86
|
+
const loadStormWorkspaceConfig = async (workspaceRoot, skipLogs = false) => {
|
|
87
|
+
const config = await createStormWorkspaceConfig(void 0, void 0, workspaceRoot, skipLogs, true);
|
|
88
|
+
require_env_set_env.setConfigEnv(config);
|
|
89
|
+
if (!skipLogs && !config.skipConfigLogging) require_logger_console.writeTrace(`⚙️ Using Storm Workspace configuration: \n${require_logger_console.formatLogMessage(config)}`, config);
|
|
90
|
+
return config;
|
|
91
|
+
};
|
|
92
|
+
/**
|
|
93
|
+
* Try to load the config file values for the current Storm workspace into environment variables
|
|
94
|
+
*
|
|
95
|
+
* @param workspaceRoot - The root directory of the workspace
|
|
96
|
+
* @param skipLogs - Skip writing logs to the console
|
|
97
|
+
* @param useDefault - Whether to use the default config if no config file is found
|
|
98
|
+
* @returns The config for the current Storm workspace, or undefined if the config file could not be loaded
|
|
99
|
+
*/
|
|
100
|
+
const tryLoadStormWorkspaceConfig = async (workspaceRoot, skipLogs = true, useDefault = false) => {
|
|
101
|
+
try {
|
|
102
|
+
const config = await createStormWorkspaceConfig(void 0, void 0, workspaceRoot, skipLogs, useDefault);
|
|
103
|
+
if (!config) return;
|
|
104
|
+
require_env_set_env.setConfigEnv(config);
|
|
105
|
+
if (!skipLogs && !config.skipConfigLogging) require_logger_console.writeTrace(`⚙️ Using Storm Workspace configuration: \n${require_logger_console.formatLogMessage(config)}`, config);
|
|
106
|
+
return config;
|
|
107
|
+
} catch (error) {
|
|
108
|
+
if (!skipLogs) require_logger_console.writeWarning(`⚠️ Failed to load Storm Workspace configuration: ${error}`, { logLevel: "all" });
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
//#endregion
|
|
113
|
+
exports.createConfigExtension = createConfigExtension;
|
|
114
|
+
exports.createStormWorkspaceConfig = createStormWorkspaceConfig;
|
|
115
|
+
exports.loadStormWorkspaceConfig = loadStormWorkspaceConfig;
|
|
116
|
+
exports.tryLoadStormWorkspaceConfig = tryLoadStormWorkspaceConfig;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { StormWorkspaceConfig } from
|
|
2
|
-
import * as z from
|
|
3
|
-
|
|
1
|
+
import { StormWorkspaceConfig } from "@storm-software/config";
|
|
2
|
+
import * as z from "zod";
|
|
3
|
+
//#region src/create-storm-config.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* Get the config for the current Storm workspace
|
|
6
6
|
*
|
|
@@ -37,5 +37,5 @@ declare const loadStormWorkspaceConfig: (workspaceRoot?: string, skipLogs?: bool
|
|
|
37
37
|
* @returns The config for the current Storm workspace, or undefined if the config file could not be loaded
|
|
38
38
|
*/
|
|
39
39
|
declare const tryLoadStormWorkspaceConfig: (workspaceRoot?: string, skipLogs?: boolean, useDefault?: boolean) => Promise<StormWorkspaceConfig | undefined>;
|
|
40
|
-
|
|
41
|
-
export { createConfigExtension, createStormWorkspaceConfig, loadStormWorkspaceConfig, tryLoadStormWorkspaceConfig };
|
|
40
|
+
//#endregion
|
|
41
|
+
export { createConfigExtension, createStormWorkspaceConfig, loadStormWorkspaceConfig, tryLoadStormWorkspaceConfig };
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
1
|
+
import __tsdown_shims_path from 'node:path';
|
|
2
|
+
import __tsdown_shims_url from 'node:url';
|
|
3
|
+
import { StormWorkspaceConfig } from "@storm-software/config";
|
|
4
|
+
import * as z from "zod";
|
|
5
|
+
//#region src/create-storm-config.d.ts
|
|
4
6
|
/**
|
|
5
7
|
* Get the config for the current Storm workspace
|
|
6
8
|
*
|
|
@@ -37,5 +39,5 @@ declare const loadStormWorkspaceConfig: (workspaceRoot?: string, skipLogs?: bool
|
|
|
37
39
|
* @returns The config for the current Storm workspace, or undefined if the config file could not be loaded
|
|
38
40
|
*/
|
|
39
41
|
declare const tryLoadStormWorkspaceConfig: (workspaceRoot?: string, skipLogs?: boolean, useDefault?: boolean) => Promise<StormWorkspaceConfig | undefined>;
|
|
40
|
-
|
|
41
|
-
export { createConfigExtension, createStormWorkspaceConfig, loadStormWorkspaceConfig, tryLoadStormWorkspaceConfig };
|
|
42
|
+
//#endregion
|
|
43
|
+
export { createConfigExtension, createStormWorkspaceConfig, loadStormWorkspaceConfig, tryLoadStormWorkspaceConfig };
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import "node:path";
|
|
2
|
+
import "node:url";
|
|
3
|
+
import.meta.url;
|
|
4
|
+
import { formatLogMessage, writeTrace, writeWarning } from "./logger/console.mjs";
|
|
5
|
+
import { joinPaths } from "./utilities/correct-paths.mjs";
|
|
6
|
+
import { findWorkspaceRoot } from "./utilities/find-workspace-root.mjs";
|
|
7
|
+
import { applyDefaultConfig, getPackageJsonConfig } from "./utilities/get-default-config.mjs";
|
|
8
|
+
import { getConfigFile } from "./config-file/get-config-file.mjs";
|
|
9
|
+
import { getConfigEnv, getExtensionEnv } from "./env/get-env.mjs";
|
|
10
|
+
import { setConfigEnv } from "./env/set-env.mjs";
|
|
11
|
+
import { workspaceConfigSchema } from "@storm-software/config/schema";
|
|
12
|
+
import defu from "defu";
|
|
13
|
+
import { existsSync } from "node:fs";
|
|
14
|
+
//#region src/create-storm-config.ts
|
|
15
|
+
const _extension_cache = /* @__PURE__ */ new WeakMap();
|
|
16
|
+
let _static_cache = void 0;
|
|
17
|
+
/**
|
|
18
|
+
* Get the config for the current Storm workspace
|
|
19
|
+
*
|
|
20
|
+
* @param extensionName - The name of the config extension
|
|
21
|
+
* @param schema - The schema for the config extension
|
|
22
|
+
* @param workspaceRoot - The root directory of the workspace
|
|
23
|
+
* @param skipLogs - Skip writing logs to the console
|
|
24
|
+
* @param useDefault - Whether to use the default config if no config file is found
|
|
25
|
+
* @returns The config for the current Storm workspace
|
|
26
|
+
*/
|
|
27
|
+
const createStormWorkspaceConfig = async (extensionName, schema, workspaceRoot, skipLogs = false, useDefault = true) => {
|
|
28
|
+
let result;
|
|
29
|
+
if (!_static_cache?.data || !_static_cache?.timestamp || _static_cache.timestamp < Date.now() - 8e3) {
|
|
30
|
+
let _workspaceRoot = workspaceRoot;
|
|
31
|
+
if (!_workspaceRoot) _workspaceRoot = findWorkspaceRoot();
|
|
32
|
+
const configEnv = getConfigEnv();
|
|
33
|
+
const configFile = await getConfigFile(_workspaceRoot);
|
|
34
|
+
if (!configFile) {
|
|
35
|
+
if (!skipLogs) writeWarning("No Storm Workspace configuration file found in the current repository. Please ensure this is the expected behavior - you can add a `storm-workspace.json` file to the root of your workspace if it is not.\n", { logLevel: "all" });
|
|
36
|
+
if (useDefault === false) return;
|
|
37
|
+
}
|
|
38
|
+
const defaultConfig = await getPackageJsonConfig(_workspaceRoot);
|
|
39
|
+
const configInput = defu(configEnv, configFile, defaultConfig);
|
|
40
|
+
if (!configInput.variant) configInput.variant = existsSync(joinPaths(_workspaceRoot, "nx.json")) || existsSync(joinPaths(_workspaceRoot, ".nx")) || existsSync(joinPaths(_workspaceRoot, "lerna.json")) || existsSync(joinPaths(_workspaceRoot, "turbo.json")) ? "monorepo" : "minimal";
|
|
41
|
+
try {
|
|
42
|
+
const parseResult = await Promise.resolve(workspaceConfigSchema._zod.parse({
|
|
43
|
+
value: configInput,
|
|
44
|
+
issues: []
|
|
45
|
+
}, { async: true }));
|
|
46
|
+
result = applyDefaultConfig(parseResult.value);
|
|
47
|
+
result.workspaceRoot ??= _workspaceRoot;
|
|
48
|
+
} catch (error) {
|
|
49
|
+
throw new Error(`Failed to parse Storm Workspace configuration${error?.message ? `: ${error.message}` : ""}
|
|
50
|
+
|
|
51
|
+
Please ensure your configuration file is valid JSON and matches the expected schema. The current workspace configuration input is: ${formatLogMessage(configInput)}`, { cause: error });
|
|
52
|
+
}
|
|
53
|
+
} else result = _static_cache.data;
|
|
54
|
+
if (schema && extensionName) result.extensions = {
|
|
55
|
+
...result.extensions,
|
|
56
|
+
[extensionName]: createConfigExtension(extensionName, schema)
|
|
57
|
+
};
|
|
58
|
+
_static_cache = {
|
|
59
|
+
timestamp: Date.now(),
|
|
60
|
+
data: result
|
|
61
|
+
};
|
|
62
|
+
return result;
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* Get the config for a specific Storm config Extension
|
|
66
|
+
*
|
|
67
|
+
* @param extensionName - The name of the config extension
|
|
68
|
+
* @param options - The options for the config extension
|
|
69
|
+
* @returns The config for the specified Storm config extension. If the extension does not exist, `undefined` is returned.
|
|
70
|
+
*/
|
|
71
|
+
const createConfigExtension = (extensionName, schema) => {
|
|
72
|
+
const extension_cache_key = { extensionName };
|
|
73
|
+
if (_extension_cache.has(extension_cache_key)) return _extension_cache.get(extension_cache_key);
|
|
74
|
+
let extension = getExtensionEnv(extensionName);
|
|
75
|
+
if (schema) extension = schema.parse(extension);
|
|
76
|
+
_extension_cache.set(extension_cache_key, extension);
|
|
77
|
+
return extension;
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* Load the config file values for the current Storm workspace into environment variables
|
|
81
|
+
*
|
|
82
|
+
* @param workspaceRoot - The root directory of the workspace
|
|
83
|
+
* @param skipLogs - Skip writing logs to the console
|
|
84
|
+
* @returns The config for the current Storm workspace, throws an error if the config file could not be loaded
|
|
85
|
+
*/
|
|
86
|
+
const loadStormWorkspaceConfig = async (workspaceRoot, skipLogs = false) => {
|
|
87
|
+
const config = await createStormWorkspaceConfig(void 0, void 0, workspaceRoot, skipLogs, true);
|
|
88
|
+
setConfigEnv(config);
|
|
89
|
+
if (!skipLogs && !config.skipConfigLogging) writeTrace(`⚙️ Using Storm Workspace configuration: \n${formatLogMessage(config)}`, config);
|
|
90
|
+
return config;
|
|
91
|
+
};
|
|
92
|
+
/**
|
|
93
|
+
* Try to load the config file values for the current Storm workspace into environment variables
|
|
94
|
+
*
|
|
95
|
+
* @param workspaceRoot - The root directory of the workspace
|
|
96
|
+
* @param skipLogs - Skip writing logs to the console
|
|
97
|
+
* @param useDefault - Whether to use the default config if no config file is found
|
|
98
|
+
* @returns The config for the current Storm workspace, or undefined if the config file could not be loaded
|
|
99
|
+
*/
|
|
100
|
+
const tryLoadStormWorkspaceConfig = async (workspaceRoot, skipLogs = true, useDefault = false) => {
|
|
101
|
+
try {
|
|
102
|
+
const config = await createStormWorkspaceConfig(void 0, void 0, workspaceRoot, skipLogs, useDefault);
|
|
103
|
+
if (!config) return;
|
|
104
|
+
setConfigEnv(config);
|
|
105
|
+
if (!skipLogs && !config.skipConfigLogging) writeTrace(`⚙️ Using Storm Workspace configuration: \n${formatLogMessage(config)}`, config);
|
|
106
|
+
return config;
|
|
107
|
+
} catch (error) {
|
|
108
|
+
if (!skipLogs) writeWarning(`⚠️ Failed to load Storm Workspace configuration: ${error}`, { logLevel: "all" });
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
//#endregion
|
|
113
|
+
export { createConfigExtension, createStormWorkspaceConfig, loadStormWorkspaceConfig, tryLoadStormWorkspaceConfig };
|