@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
package/dist/env/set-env.cjs
CHANGED
|
@@ -1,11 +1,230 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_types = require("../types.cjs");
|
|
3
|
+
const require_logger_get_log_level = require("../logger/get-log-level.cjs");
|
|
4
|
+
const require_utilities_correct_paths = require("../utilities/correct-paths.cjs");
|
|
5
|
+
//#region src/env/set-env.ts
|
|
6
|
+
/**
|
|
7
|
+
* Get the config for an extension module of Storm workspace from environment variables
|
|
8
|
+
*
|
|
9
|
+
* @param extensionName - The name of the extension module
|
|
10
|
+
* @returns The config for the specified Storm extension module. If the module does not exist, `undefined` is returned.
|
|
11
|
+
*/
|
|
12
|
+
const setExtensionEnv = (extensionName, extension) => {
|
|
13
|
+
for (const key of Object.keys(extension ?? {})) if (extension[key]) {
|
|
14
|
+
const result = key?.replace(/([A-Z])+/g, (input) => input ? input[0]?.toUpperCase() + input.slice(1) : "").split(/(?=[A-Z])|[.\-\s_]/).map((x) => x.toLowerCase()) ?? [];
|
|
15
|
+
let extensionKey;
|
|
16
|
+
if (result.length === 0) return;
|
|
17
|
+
if (result.length === 1) extensionKey = result[0]?.toUpperCase() ?? "";
|
|
18
|
+
else extensionKey = result.reduce((ret, part) => {
|
|
19
|
+
return `${ret}_${part.toLowerCase()}`;
|
|
20
|
+
});
|
|
21
|
+
process.env[`STORM_EXTENSION_${extensionName.toUpperCase()}_${extensionKey.toUpperCase()}`] = extension[key];
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Get the config for the current Storm workspace
|
|
26
|
+
*
|
|
27
|
+
* @returns The config for the current Storm workspace from environment variables
|
|
28
|
+
*/
|
|
29
|
+
const setConfigEnv = (config) => {
|
|
30
|
+
const prefix = "STORM_";
|
|
31
|
+
if (config.extends) process.env[`${prefix}EXTENDS`] = Array.isArray(config.extends) ? JSON.stringify(config.extends) : config.extends;
|
|
32
|
+
if (config.name) process.env[`${prefix}NAME`] = config.name;
|
|
33
|
+
if (config.variant) process.env[`${prefix}VARIANT`] = config.variant;
|
|
34
|
+
if (config.namespace) process.env[`${prefix}NAMESPACE`] = config.namespace;
|
|
35
|
+
if (config.owner) process.env[`${prefix}OWNER`] = config.owner;
|
|
36
|
+
if (config.bot) {
|
|
37
|
+
process.env[`${prefix}BOT_NAME`] = config.bot.name;
|
|
38
|
+
process.env[`${prefix}BOT_EMAIL`] = config.bot.email;
|
|
39
|
+
}
|
|
40
|
+
if (config.error) {
|
|
41
|
+
process.env[`${prefix}ERROR_CODES_FILE`] = config.error.codesFile;
|
|
42
|
+
process.env[`${prefix}ERROR_URL`] = config.error.url;
|
|
43
|
+
}
|
|
44
|
+
if (config.release) {
|
|
45
|
+
if (config.release.banner) {
|
|
46
|
+
if (typeof config.release.banner === "string") {
|
|
47
|
+
process.env[`${prefix}RELEASE_BANNER`] = config.release.banner;
|
|
48
|
+
process.env[`${prefix}RELEASE_BANNER_URL`] = config.release.banner;
|
|
49
|
+
} else {
|
|
50
|
+
process.env[`${prefix}RELEASE_BANNER`] = config.release.banner.url;
|
|
51
|
+
process.env[`${prefix}RELEASE_BANNER_URL`] = config.release.banner.url;
|
|
52
|
+
process.env[`${prefix}RELEASE_BANNER_ALT`] = config.release.banner.alt;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
process.env[`${prefix}RELEASE_HEADER`] = config.release.header;
|
|
56
|
+
process.env[`${prefix}RELEASE_FOOTER`] = config.release.footer;
|
|
57
|
+
}
|
|
58
|
+
if (config.socials) {
|
|
59
|
+
if (config.socials.twitter) process.env[`${prefix}SOCIAL_TWITTER`] = config.socials.twitter;
|
|
60
|
+
if (config.socials.discord) process.env[`${prefix}SOCIAL_DISCORD`] = config.socials.discord;
|
|
61
|
+
if (config.socials.telegram) process.env[`${prefix}SOCIAL_TELEGRAM`] = config.socials.telegram;
|
|
62
|
+
if (config.socials.slack) process.env[`${prefix}SOCIAL_SLACK`] = config.socials.slack;
|
|
63
|
+
if (config.socials.medium) process.env[`${prefix}SOCIAL_MEDIUM`] = config.socials.medium;
|
|
64
|
+
if (config.socials.github) process.env[`${prefix}SOCIAL_GITHUB`] = config.socials.github;
|
|
65
|
+
}
|
|
66
|
+
if (config.organization) {
|
|
67
|
+
if (typeof config.organization === "string") {
|
|
68
|
+
process.env[`${prefix}ORG`] = config.organization;
|
|
69
|
+
process.env[`${prefix}ORG_NAME`] = config.organization;
|
|
70
|
+
process.env[`${prefix}ORGANIZATION`] = config.organization;
|
|
71
|
+
process.env[`${prefix}ORGANIZATION_NAME`] = config.organization;
|
|
72
|
+
} else {
|
|
73
|
+
process.env[`${prefix}ORG`] = config.organization.name;
|
|
74
|
+
process.env[`${prefix}ORG_NAME`] = config.organization.name;
|
|
75
|
+
process.env[`${prefix}ORGANIZATION`] = config.organization.name;
|
|
76
|
+
process.env[`${prefix}ORGANIZATION_NAME`] = config.organization.name;
|
|
77
|
+
if (config.organization.url) {
|
|
78
|
+
process.env[`${prefix}ORG_URL`] = config.organization.url;
|
|
79
|
+
process.env[`${prefix}ORGANIZATION_URL`] = config.organization.url;
|
|
80
|
+
}
|
|
81
|
+
if (config.organization.description) {
|
|
82
|
+
process.env[`${prefix}ORG_DESCRIPTION`] = config.organization.description;
|
|
83
|
+
process.env[`${prefix}ORGANIZATION_DESCRIPTION`] = config.organization.description;
|
|
84
|
+
}
|
|
85
|
+
if (config.organization.logo) {
|
|
86
|
+
process.env[`${prefix}ORG_LOGO`] = config.organization.logo;
|
|
87
|
+
process.env[`${prefix}ORGANIZATION_LOGO`] = config.organization.logo;
|
|
88
|
+
}
|
|
89
|
+
if (config.organization.icon) {
|
|
90
|
+
process.env[`${prefix}ORG_ICON`] = config.organization.icon;
|
|
91
|
+
process.env[`${prefix}ORGANIZATION_ICON`] = config.organization.icon;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
if (config.packageManager) process.env[`${prefix}PACKAGE_MANAGER`] = config.packageManager;
|
|
96
|
+
if (config.license) process.env[`${prefix}LICENSE`] = config.license;
|
|
97
|
+
if (config.homepage) process.env[`${prefix}HOMEPAGE`] = config.homepage;
|
|
98
|
+
if (config.docs) process.env[`${prefix}DOCS`] = config.docs;
|
|
99
|
+
if (config.portal) process.env[`${prefix}PORTAL`] = config.portal;
|
|
100
|
+
if (config.licensing) process.env[`${prefix}LICENSING`] = config.licensing;
|
|
101
|
+
if (config.contact) process.env[`${prefix}CONTACT`] = config.contact;
|
|
102
|
+
if (config.support) process.env[`${prefix}SUPPORT`] = config.support;
|
|
103
|
+
if (config.timezone) {
|
|
104
|
+
process.env[`${prefix}TIMEZONE`] = config.timezone;
|
|
105
|
+
process.env.TZ = config.timezone;
|
|
106
|
+
process.env.DEFAULT_TIMEZONE = config.timezone;
|
|
107
|
+
process.env.TIMEZONE = config.timezone;
|
|
108
|
+
}
|
|
109
|
+
if (config.locale) {
|
|
110
|
+
process.env[`${prefix}LOCALE`] = config.locale;
|
|
111
|
+
process.env.DEFAULT_LOCALE = config.locale;
|
|
112
|
+
process.env.LOCALE = config.locale;
|
|
113
|
+
process.env.LANG = config.locale ? `${config.locale.replaceAll("-", "_")}.UTF-8` : "en_US.UTF-8";
|
|
114
|
+
}
|
|
115
|
+
if (config.configFile) process.env[`${prefix}WORKSPACE_CONFIG_FILE`] = require_utilities_correct_paths.correctPaths(config.configFile);
|
|
116
|
+
if (config.workspaceRoot) {
|
|
117
|
+
process.env[`${prefix}WORKSPACE_ROOT`] = require_utilities_correct_paths.correctPaths(config.workspaceRoot);
|
|
118
|
+
process.env.NX_WORKSPACE_ROOT = require_utilities_correct_paths.correctPaths(config.workspaceRoot);
|
|
119
|
+
process.env.NX_WORKSPACE_ROOT_PATH = require_utilities_correct_paths.correctPaths(config.workspaceRoot);
|
|
120
|
+
}
|
|
121
|
+
if (config.directories) {
|
|
122
|
+
if (!config.skipCache && config.directories.cache) {
|
|
123
|
+
process.env[`${prefix}CACHE_DIR`] = require_utilities_correct_paths.correctPaths(config.directories.cache);
|
|
124
|
+
process.env[`${prefix}CACHE_DIRECTORY`] = process.env[`${prefix}CACHE_DIR`];
|
|
125
|
+
}
|
|
126
|
+
if (config.directories.data) {
|
|
127
|
+
process.env[`${prefix}DATA_DIR`] = require_utilities_correct_paths.correctPaths(config.directories.data);
|
|
128
|
+
process.env[`${prefix}DATA_DIRECTORY`] = process.env[`${prefix}DATA_DIR`];
|
|
129
|
+
}
|
|
130
|
+
if (config.directories.config) {
|
|
131
|
+
process.env[`${prefix}CONFIG_DIR`] = require_utilities_correct_paths.correctPaths(config.directories.config);
|
|
132
|
+
process.env[`${prefix}CONFIG_DIRECTORY`] = process.env[`${prefix}CONFIG_DIR`];
|
|
133
|
+
}
|
|
134
|
+
if (config.directories.temp) {
|
|
135
|
+
process.env[`${prefix}TEMP_DIR`] = require_utilities_correct_paths.correctPaths(config.directories.temp);
|
|
136
|
+
process.env[`${prefix}TEMP_DIRECTORY`] = process.env[`${prefix}TEMP_DIR`];
|
|
137
|
+
}
|
|
138
|
+
if (config.directories.log) {
|
|
139
|
+
process.env[`${prefix}LOG_DIR`] = require_utilities_correct_paths.correctPaths(config.directories.log);
|
|
140
|
+
process.env[`${prefix}LOG_DIRECTORY`] = process.env[`${prefix}LOG_DIR`];
|
|
141
|
+
}
|
|
142
|
+
if (config.directories.build) {
|
|
143
|
+
process.env[`${prefix}BUILD_DIR`] = require_utilities_correct_paths.correctPaths(config.directories.build);
|
|
144
|
+
process.env[`${prefix}BUILD_DIRECTORY`] = process.env[`${prefix}BUILD_DIR`];
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
if (config.skipCache !== void 0) {
|
|
148
|
+
process.env[`${prefix}SKIP_CACHE`] = String(config.skipCache);
|
|
149
|
+
if (config.skipCache) {
|
|
150
|
+
process.env.NX_SKIP_NX_CACHE ??= String(config.skipCache);
|
|
151
|
+
process.env.NX_CACHE_PROJECT_GRAPH ??= String(config.skipCache);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
if (config.mode) {
|
|
155
|
+
process.env[`${prefix}MODE`] = config.mode;
|
|
156
|
+
process.env.NODE_ENV = config.mode;
|
|
157
|
+
process.env.ENVIRONMENT = config.mode;
|
|
158
|
+
}
|
|
159
|
+
if (config.colors?.base?.light || config.colors?.base?.dark) for (const key of Object.keys(config.colors)) setThemeColorsEnv(`${prefix}COLOR_${key}_`, config.colors[key]);
|
|
160
|
+
else setThemeColorsEnv(`${prefix}COLOR_`, config.colors);
|
|
161
|
+
if (config.repository) process.env[`${prefix}REPOSITORY`] = config.repository;
|
|
162
|
+
if (config.branch) process.env[`${prefix}BRANCH`] = config.branch;
|
|
163
|
+
if (config.preid) process.env[`${prefix}PRE_ID`] = String(config.preid);
|
|
164
|
+
if (config.registry) {
|
|
165
|
+
if (config.registry.github) process.env[`${prefix}REGISTRY_GITHUB`] = String(config.registry.github);
|
|
166
|
+
if (config.registry.npm) process.env[`${prefix}REGISTRY_NPM`] = String(config.registry.npm);
|
|
167
|
+
if (config.registry.cargo) process.env[`${prefix}REGISTRY_CARGO`] = String(config.registry.cargo);
|
|
168
|
+
if (config.registry.cyclone) process.env[`${prefix}REGISTRY_CYCLONE`] = String(config.registry.cyclone);
|
|
169
|
+
if (config.registry.container) process.env[`${prefix}REGISTRY_CONTAINER`] = String(config.registry.container);
|
|
170
|
+
}
|
|
171
|
+
if (config.logLevel) {
|
|
172
|
+
process.env[`${prefix}LOG_LEVEL`] = String(config.logLevel);
|
|
173
|
+
process.env.LOG_LEVEL = String(config.logLevel);
|
|
174
|
+
process.env.NX_VERBOSE_LOGGING = String(require_logger_get_log_level.getLogLevel(config.logLevel) >= require_types.LogLevel.DEBUG ? true : false);
|
|
175
|
+
process.env.RUST_BACKTRACE = require_logger_get_log_level.getLogLevel(config.logLevel) >= require_types.LogLevel.DEBUG ? "full" : "none";
|
|
176
|
+
}
|
|
177
|
+
if (config.skipConfigLogging !== void 0) process.env[`${prefix}SKIP_CONFIG_LOGGING`] = String(config.skipConfigLogging);
|
|
178
|
+
process.env[`${prefix}WORKSPACE_CONFIG`] = JSON.stringify(config);
|
|
179
|
+
for (const key of Object.keys(config.extensions ?? {})) if (config.extensions[key] && Object.keys(config.extensions[key])) setExtensionEnv(key, config.extensions[key]);
|
|
180
|
+
};
|
|
181
|
+
const setThemeColorsEnv = (prefix, config) => {
|
|
182
|
+
return config?.light?.brand || config?.dark?.brand ? setMultiThemeColorsEnv(prefix, config) : setSingleThemeColorsEnv(prefix, config);
|
|
183
|
+
};
|
|
184
|
+
const setSingleThemeColorsEnv = (prefix, config) => {
|
|
185
|
+
if (config.dark) process.env[`${prefix}DARK`] = config.dark;
|
|
186
|
+
if (config.light) process.env[`${prefix}LIGHT`] = config.light;
|
|
187
|
+
if (config.brand) process.env[`${prefix}BRAND`] = config.brand;
|
|
188
|
+
if (config.alternate) process.env[`${prefix}ALTERNATE`] = config.alternate;
|
|
189
|
+
if (config.accent) process.env[`${prefix}ACCENT`] = config.accent;
|
|
190
|
+
if (config.link) process.env[`${prefix}LINK`] = config.link;
|
|
191
|
+
if (config.discovery) process.env[`${prefix}DISCOVERY`] = config.discovery;
|
|
192
|
+
if (config.success) process.env[`${prefix}SUCCESS`] = config.success;
|
|
193
|
+
if (config.info) process.env[`${prefix}INFO`] = config.info;
|
|
194
|
+
if (config.debug) process.env[`${prefix}DEBUG`] = config.debug;
|
|
195
|
+
if (config.warning) process.env[`${prefix}WARNING`] = config.warning;
|
|
196
|
+
if (config.danger) process.env[`${prefix}DANGER`] = config.danger;
|
|
197
|
+
if (config.fatal) process.env[`${prefix}FATAL`] = config.fatal;
|
|
198
|
+
if (config.performance) process.env[`${prefix}PERFORMANCE`] = config.performance;
|
|
199
|
+
if (config.positive) process.env[`${prefix}POSITIVE`] = config.positive;
|
|
200
|
+
if (config.negative) process.env[`${prefix}NEGATIVE`] = config.negative;
|
|
201
|
+
if (config.gradient) for (let i = 0; i < config.gradient.length; i++) process.env[`${prefix}GRADIENT_${i}`] = config.gradient[i];
|
|
202
|
+
};
|
|
203
|
+
const setMultiThemeColorsEnv = (prefix, config) => {
|
|
204
|
+
return {
|
|
205
|
+
light: setBaseThemeColorsEnv(`${prefix}LIGHT_`, config.light),
|
|
206
|
+
dark: setBaseThemeColorsEnv(`${prefix}DARK_`, config.dark)
|
|
207
|
+
};
|
|
208
|
+
};
|
|
209
|
+
const setBaseThemeColorsEnv = (prefix, config) => {
|
|
210
|
+
if (config.foreground) process.env[`${prefix}FOREGROUND`] = config.foreground;
|
|
211
|
+
if (config.background) process.env[`${prefix}BACKGROUND`] = config.background;
|
|
212
|
+
if (config.brand) process.env[`${prefix}BRAND`] = config.brand;
|
|
213
|
+
if (config.alternate) process.env[`${prefix}ALTERNATE`] = config.alternate;
|
|
214
|
+
if (config.accent) process.env[`${prefix}ACCENT`] = config.accent;
|
|
215
|
+
if (config.link) process.env[`${prefix}LINK`] = config.link;
|
|
216
|
+
if (config.discovery) process.env[`${prefix}DISCOVERY`] = config.discovery;
|
|
217
|
+
if (config.success) process.env[`${prefix}SUCCESS`] = config.success;
|
|
218
|
+
if (config.info) process.env[`${prefix}INFO`] = config.info;
|
|
219
|
+
if (config.debug) process.env[`${prefix}DEBUG`] = config.debug;
|
|
220
|
+
if (config.warning) process.env[`${prefix}WARNING`] = config.warning;
|
|
221
|
+
if (config.danger) process.env[`${prefix}DANGER`] = config.danger;
|
|
222
|
+
if (config.fatal) process.env[`${prefix}FATAL`] = config.fatal;
|
|
223
|
+
if (config.performance) process.env[`${prefix}PERFORMANCE`] = config.performance;
|
|
224
|
+
if (config.positive) process.env[`${prefix}POSITIVE`] = config.positive;
|
|
225
|
+
if (config.negative) process.env[`${prefix}NEGATIVE`] = config.negative;
|
|
226
|
+
if (config.gradient) for (let i = 0; i < config.gradient.length; i++) process.env[`${prefix}GRADIENT_${i}`] = config.gradient[i];
|
|
227
|
+
};
|
|
228
|
+
//#endregion
|
|
229
|
+
exports.setConfigEnv = setConfigEnv;
|
|
230
|
+
exports.setExtensionEnv = setExtensionEnv;
|
package/dist/env/set-env.d.cts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { StormWorkspaceConfig } from
|
|
2
|
-
|
|
1
|
+
import { StormWorkspaceConfig } from "@storm-software/config";
|
|
2
|
+
//#region src/env/set-env.d.ts
|
|
3
3
|
declare global {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
4
|
+
namespace NodeJS {
|
|
5
|
+
interface ProcessEnv {
|
|
6
|
+
[key: string]: string | undefined;
|
|
8
7
|
}
|
|
8
|
+
}
|
|
9
9
|
}
|
|
10
10
|
/**
|
|
11
11
|
* Get the config for an extension module of Storm workspace from environment variables
|
|
@@ -20,5 +20,5 @@ declare const setExtensionEnv: <TConfig extends Record<string, any> = Record<str
|
|
|
20
20
|
* @returns The config for the current Storm workspace from environment variables
|
|
21
21
|
*/
|
|
22
22
|
declare const setConfigEnv: (config: StormWorkspaceConfig) => void;
|
|
23
|
-
|
|
24
|
-
export { setConfigEnv, setExtensionEnv };
|
|
23
|
+
//#endregion
|
|
24
|
+
export { setConfigEnv, setExtensionEnv };
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import __tsdown_shims_path from 'node:path';
|
|
2
|
+
import __tsdown_shims_url from 'node:url';
|
|
3
|
+
import { StormWorkspaceConfig } from "@storm-software/config";
|
|
4
|
+
//#region src/env/set-env.d.ts
|
|
3
5
|
declare global {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
6
|
+
namespace NodeJS {
|
|
7
|
+
interface ProcessEnv {
|
|
8
|
+
[key: string]: string | undefined;
|
|
8
9
|
}
|
|
10
|
+
}
|
|
9
11
|
}
|
|
10
12
|
/**
|
|
11
13
|
* Get the config for an extension module of Storm workspace from environment variables
|
|
@@ -20,5 +22,5 @@ declare const setExtensionEnv: <TConfig extends Record<string, any> = Record<str
|
|
|
20
22
|
* @returns The config for the current Storm workspace from environment variables
|
|
21
23
|
*/
|
|
22
24
|
declare const setConfigEnv: (config: StormWorkspaceConfig) => void;
|
|
23
|
-
|
|
24
|
-
export { setConfigEnv, setExtensionEnv };
|
|
25
|
+
//#endregion
|
|
26
|
+
export { setConfigEnv, setExtensionEnv };
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
import "node:path";
|
|
2
|
+
import "node:url";
|
|
3
|
+
import.meta.url;
|
|
4
|
+
import { LogLevel } from "../types.mjs";
|
|
5
|
+
import { getLogLevel } from "../logger/get-log-level.mjs";
|
|
6
|
+
import { correctPaths } from "../utilities/correct-paths.mjs";
|
|
7
|
+
//#region src/env/set-env.ts
|
|
8
|
+
/**
|
|
9
|
+
* Get the config for an extension module of Storm workspace from environment variables
|
|
10
|
+
*
|
|
11
|
+
* @param extensionName - The name of the extension module
|
|
12
|
+
* @returns The config for the specified Storm extension module. If the module does not exist, `undefined` is returned.
|
|
13
|
+
*/
|
|
14
|
+
const setExtensionEnv = (extensionName, extension) => {
|
|
15
|
+
for (const key of Object.keys(extension ?? {})) if (extension[key]) {
|
|
16
|
+
const result = key?.replace(/([A-Z])+/g, (input) => input ? input[0]?.toUpperCase() + input.slice(1) : "").split(/(?=[A-Z])|[.\-\s_]/).map((x) => x.toLowerCase()) ?? [];
|
|
17
|
+
let extensionKey;
|
|
18
|
+
if (result.length === 0) return;
|
|
19
|
+
if (result.length === 1) extensionKey = result[0]?.toUpperCase() ?? "";
|
|
20
|
+
else extensionKey = result.reduce((ret, part) => {
|
|
21
|
+
return `${ret}_${part.toLowerCase()}`;
|
|
22
|
+
});
|
|
23
|
+
process.env[`STORM_EXTENSION_${extensionName.toUpperCase()}_${extensionKey.toUpperCase()}`] = extension[key];
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Get the config for the current Storm workspace
|
|
28
|
+
*
|
|
29
|
+
* @returns The config for the current Storm workspace from environment variables
|
|
30
|
+
*/
|
|
31
|
+
const setConfigEnv = (config) => {
|
|
32
|
+
const prefix = "STORM_";
|
|
33
|
+
if (config.extends) process.env[`${prefix}EXTENDS`] = Array.isArray(config.extends) ? JSON.stringify(config.extends) : config.extends;
|
|
34
|
+
if (config.name) process.env[`${prefix}NAME`] = config.name;
|
|
35
|
+
if (config.variant) process.env[`${prefix}VARIANT`] = config.variant;
|
|
36
|
+
if (config.namespace) process.env[`${prefix}NAMESPACE`] = config.namespace;
|
|
37
|
+
if (config.owner) process.env[`${prefix}OWNER`] = config.owner;
|
|
38
|
+
if (config.bot) {
|
|
39
|
+
process.env[`${prefix}BOT_NAME`] = config.bot.name;
|
|
40
|
+
process.env[`${prefix}BOT_EMAIL`] = config.bot.email;
|
|
41
|
+
}
|
|
42
|
+
if (config.error) {
|
|
43
|
+
process.env[`${prefix}ERROR_CODES_FILE`] = config.error.codesFile;
|
|
44
|
+
process.env[`${prefix}ERROR_URL`] = config.error.url;
|
|
45
|
+
}
|
|
46
|
+
if (config.release) {
|
|
47
|
+
if (config.release.banner) {
|
|
48
|
+
if (typeof config.release.banner === "string") {
|
|
49
|
+
process.env[`${prefix}RELEASE_BANNER`] = config.release.banner;
|
|
50
|
+
process.env[`${prefix}RELEASE_BANNER_URL`] = config.release.banner;
|
|
51
|
+
} else {
|
|
52
|
+
process.env[`${prefix}RELEASE_BANNER`] = config.release.banner.url;
|
|
53
|
+
process.env[`${prefix}RELEASE_BANNER_URL`] = config.release.banner.url;
|
|
54
|
+
process.env[`${prefix}RELEASE_BANNER_ALT`] = config.release.banner.alt;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
process.env[`${prefix}RELEASE_HEADER`] = config.release.header;
|
|
58
|
+
process.env[`${prefix}RELEASE_FOOTER`] = config.release.footer;
|
|
59
|
+
}
|
|
60
|
+
if (config.socials) {
|
|
61
|
+
if (config.socials.twitter) process.env[`${prefix}SOCIAL_TWITTER`] = config.socials.twitter;
|
|
62
|
+
if (config.socials.discord) process.env[`${prefix}SOCIAL_DISCORD`] = config.socials.discord;
|
|
63
|
+
if (config.socials.telegram) process.env[`${prefix}SOCIAL_TELEGRAM`] = config.socials.telegram;
|
|
64
|
+
if (config.socials.slack) process.env[`${prefix}SOCIAL_SLACK`] = config.socials.slack;
|
|
65
|
+
if (config.socials.medium) process.env[`${prefix}SOCIAL_MEDIUM`] = config.socials.medium;
|
|
66
|
+
if (config.socials.github) process.env[`${prefix}SOCIAL_GITHUB`] = config.socials.github;
|
|
67
|
+
}
|
|
68
|
+
if (config.organization) {
|
|
69
|
+
if (typeof config.organization === "string") {
|
|
70
|
+
process.env[`${prefix}ORG`] = config.organization;
|
|
71
|
+
process.env[`${prefix}ORG_NAME`] = config.organization;
|
|
72
|
+
process.env[`${prefix}ORGANIZATION`] = config.organization;
|
|
73
|
+
process.env[`${prefix}ORGANIZATION_NAME`] = config.organization;
|
|
74
|
+
} else {
|
|
75
|
+
process.env[`${prefix}ORG`] = config.organization.name;
|
|
76
|
+
process.env[`${prefix}ORG_NAME`] = config.organization.name;
|
|
77
|
+
process.env[`${prefix}ORGANIZATION`] = config.organization.name;
|
|
78
|
+
process.env[`${prefix}ORGANIZATION_NAME`] = config.organization.name;
|
|
79
|
+
if (config.organization.url) {
|
|
80
|
+
process.env[`${prefix}ORG_URL`] = config.organization.url;
|
|
81
|
+
process.env[`${prefix}ORGANIZATION_URL`] = config.organization.url;
|
|
82
|
+
}
|
|
83
|
+
if (config.organization.description) {
|
|
84
|
+
process.env[`${prefix}ORG_DESCRIPTION`] = config.organization.description;
|
|
85
|
+
process.env[`${prefix}ORGANIZATION_DESCRIPTION`] = config.organization.description;
|
|
86
|
+
}
|
|
87
|
+
if (config.organization.logo) {
|
|
88
|
+
process.env[`${prefix}ORG_LOGO`] = config.organization.logo;
|
|
89
|
+
process.env[`${prefix}ORGANIZATION_LOGO`] = config.organization.logo;
|
|
90
|
+
}
|
|
91
|
+
if (config.organization.icon) {
|
|
92
|
+
process.env[`${prefix}ORG_ICON`] = config.organization.icon;
|
|
93
|
+
process.env[`${prefix}ORGANIZATION_ICON`] = config.organization.icon;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
if (config.packageManager) process.env[`${prefix}PACKAGE_MANAGER`] = config.packageManager;
|
|
98
|
+
if (config.license) process.env[`${prefix}LICENSE`] = config.license;
|
|
99
|
+
if (config.homepage) process.env[`${prefix}HOMEPAGE`] = config.homepage;
|
|
100
|
+
if (config.docs) process.env[`${prefix}DOCS`] = config.docs;
|
|
101
|
+
if (config.portal) process.env[`${prefix}PORTAL`] = config.portal;
|
|
102
|
+
if (config.licensing) process.env[`${prefix}LICENSING`] = config.licensing;
|
|
103
|
+
if (config.contact) process.env[`${prefix}CONTACT`] = config.contact;
|
|
104
|
+
if (config.support) process.env[`${prefix}SUPPORT`] = config.support;
|
|
105
|
+
if (config.timezone) {
|
|
106
|
+
process.env[`${prefix}TIMEZONE`] = config.timezone;
|
|
107
|
+
process.env.TZ = config.timezone;
|
|
108
|
+
process.env.DEFAULT_TIMEZONE = config.timezone;
|
|
109
|
+
process.env.TIMEZONE = config.timezone;
|
|
110
|
+
}
|
|
111
|
+
if (config.locale) {
|
|
112
|
+
process.env[`${prefix}LOCALE`] = config.locale;
|
|
113
|
+
process.env.DEFAULT_LOCALE = config.locale;
|
|
114
|
+
process.env.LOCALE = config.locale;
|
|
115
|
+
process.env.LANG = config.locale ? `${config.locale.replaceAll("-", "_")}.UTF-8` : "en_US.UTF-8";
|
|
116
|
+
}
|
|
117
|
+
if (config.configFile) process.env[`${prefix}WORKSPACE_CONFIG_FILE`] = correctPaths(config.configFile);
|
|
118
|
+
if (config.workspaceRoot) {
|
|
119
|
+
process.env[`${prefix}WORKSPACE_ROOT`] = correctPaths(config.workspaceRoot);
|
|
120
|
+
process.env.NX_WORKSPACE_ROOT = correctPaths(config.workspaceRoot);
|
|
121
|
+
process.env.NX_WORKSPACE_ROOT_PATH = correctPaths(config.workspaceRoot);
|
|
122
|
+
}
|
|
123
|
+
if (config.directories) {
|
|
124
|
+
if (!config.skipCache && config.directories.cache) {
|
|
125
|
+
process.env[`${prefix}CACHE_DIR`] = correctPaths(config.directories.cache);
|
|
126
|
+
process.env[`${prefix}CACHE_DIRECTORY`] = process.env[`${prefix}CACHE_DIR`];
|
|
127
|
+
}
|
|
128
|
+
if (config.directories.data) {
|
|
129
|
+
process.env[`${prefix}DATA_DIR`] = correctPaths(config.directories.data);
|
|
130
|
+
process.env[`${prefix}DATA_DIRECTORY`] = process.env[`${prefix}DATA_DIR`];
|
|
131
|
+
}
|
|
132
|
+
if (config.directories.config) {
|
|
133
|
+
process.env[`${prefix}CONFIG_DIR`] = correctPaths(config.directories.config);
|
|
134
|
+
process.env[`${prefix}CONFIG_DIRECTORY`] = process.env[`${prefix}CONFIG_DIR`];
|
|
135
|
+
}
|
|
136
|
+
if (config.directories.temp) {
|
|
137
|
+
process.env[`${prefix}TEMP_DIR`] = correctPaths(config.directories.temp);
|
|
138
|
+
process.env[`${prefix}TEMP_DIRECTORY`] = process.env[`${prefix}TEMP_DIR`];
|
|
139
|
+
}
|
|
140
|
+
if (config.directories.log) {
|
|
141
|
+
process.env[`${prefix}LOG_DIR`] = correctPaths(config.directories.log);
|
|
142
|
+
process.env[`${prefix}LOG_DIRECTORY`] = process.env[`${prefix}LOG_DIR`];
|
|
143
|
+
}
|
|
144
|
+
if (config.directories.build) {
|
|
145
|
+
process.env[`${prefix}BUILD_DIR`] = correctPaths(config.directories.build);
|
|
146
|
+
process.env[`${prefix}BUILD_DIRECTORY`] = process.env[`${prefix}BUILD_DIR`];
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
if (config.skipCache !== void 0) {
|
|
150
|
+
process.env[`${prefix}SKIP_CACHE`] = String(config.skipCache);
|
|
151
|
+
if (config.skipCache) {
|
|
152
|
+
process.env.NX_SKIP_NX_CACHE ??= String(config.skipCache);
|
|
153
|
+
process.env.NX_CACHE_PROJECT_GRAPH ??= String(config.skipCache);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
if (config.mode) {
|
|
157
|
+
process.env[`${prefix}MODE`] = config.mode;
|
|
158
|
+
process.env.NODE_ENV = config.mode;
|
|
159
|
+
process.env.ENVIRONMENT = config.mode;
|
|
160
|
+
}
|
|
161
|
+
if (config.colors?.base?.light || config.colors?.base?.dark) for (const key of Object.keys(config.colors)) setThemeColorsEnv(`${prefix}COLOR_${key}_`, config.colors[key]);
|
|
162
|
+
else setThemeColorsEnv(`${prefix}COLOR_`, config.colors);
|
|
163
|
+
if (config.repository) process.env[`${prefix}REPOSITORY`] = config.repository;
|
|
164
|
+
if (config.branch) process.env[`${prefix}BRANCH`] = config.branch;
|
|
165
|
+
if (config.preid) process.env[`${prefix}PRE_ID`] = String(config.preid);
|
|
166
|
+
if (config.registry) {
|
|
167
|
+
if (config.registry.github) process.env[`${prefix}REGISTRY_GITHUB`] = String(config.registry.github);
|
|
168
|
+
if (config.registry.npm) process.env[`${prefix}REGISTRY_NPM`] = String(config.registry.npm);
|
|
169
|
+
if (config.registry.cargo) process.env[`${prefix}REGISTRY_CARGO`] = String(config.registry.cargo);
|
|
170
|
+
if (config.registry.cyclone) process.env[`${prefix}REGISTRY_CYCLONE`] = String(config.registry.cyclone);
|
|
171
|
+
if (config.registry.container) process.env[`${prefix}REGISTRY_CONTAINER`] = String(config.registry.container);
|
|
172
|
+
}
|
|
173
|
+
if (config.logLevel) {
|
|
174
|
+
process.env[`${prefix}LOG_LEVEL`] = String(config.logLevel);
|
|
175
|
+
process.env.LOG_LEVEL = String(config.logLevel);
|
|
176
|
+
process.env.NX_VERBOSE_LOGGING = String(getLogLevel(config.logLevel) >= LogLevel.DEBUG ? true : false);
|
|
177
|
+
process.env.RUST_BACKTRACE = getLogLevel(config.logLevel) >= LogLevel.DEBUG ? "full" : "none";
|
|
178
|
+
}
|
|
179
|
+
if (config.skipConfigLogging !== void 0) process.env[`${prefix}SKIP_CONFIG_LOGGING`] = String(config.skipConfigLogging);
|
|
180
|
+
process.env[`${prefix}WORKSPACE_CONFIG`] = JSON.stringify(config);
|
|
181
|
+
for (const key of Object.keys(config.extensions ?? {})) if (config.extensions[key] && Object.keys(config.extensions[key])) setExtensionEnv(key, config.extensions[key]);
|
|
182
|
+
};
|
|
183
|
+
const setThemeColorsEnv = (prefix, config) => {
|
|
184
|
+
return config?.light?.brand || config?.dark?.brand ? setMultiThemeColorsEnv(prefix, config) : setSingleThemeColorsEnv(prefix, config);
|
|
185
|
+
};
|
|
186
|
+
const setSingleThemeColorsEnv = (prefix, config) => {
|
|
187
|
+
if (config.dark) process.env[`${prefix}DARK`] = config.dark;
|
|
188
|
+
if (config.light) process.env[`${prefix}LIGHT`] = config.light;
|
|
189
|
+
if (config.brand) process.env[`${prefix}BRAND`] = config.brand;
|
|
190
|
+
if (config.alternate) process.env[`${prefix}ALTERNATE`] = config.alternate;
|
|
191
|
+
if (config.accent) process.env[`${prefix}ACCENT`] = config.accent;
|
|
192
|
+
if (config.link) process.env[`${prefix}LINK`] = config.link;
|
|
193
|
+
if (config.discovery) process.env[`${prefix}DISCOVERY`] = config.discovery;
|
|
194
|
+
if (config.success) process.env[`${prefix}SUCCESS`] = config.success;
|
|
195
|
+
if (config.info) process.env[`${prefix}INFO`] = config.info;
|
|
196
|
+
if (config.debug) process.env[`${prefix}DEBUG`] = config.debug;
|
|
197
|
+
if (config.warning) process.env[`${prefix}WARNING`] = config.warning;
|
|
198
|
+
if (config.danger) process.env[`${prefix}DANGER`] = config.danger;
|
|
199
|
+
if (config.fatal) process.env[`${prefix}FATAL`] = config.fatal;
|
|
200
|
+
if (config.performance) process.env[`${prefix}PERFORMANCE`] = config.performance;
|
|
201
|
+
if (config.positive) process.env[`${prefix}POSITIVE`] = config.positive;
|
|
202
|
+
if (config.negative) process.env[`${prefix}NEGATIVE`] = config.negative;
|
|
203
|
+
if (config.gradient) for (let i = 0; i < config.gradient.length; i++) process.env[`${prefix}GRADIENT_${i}`] = config.gradient[i];
|
|
204
|
+
};
|
|
205
|
+
const setMultiThemeColorsEnv = (prefix, config) => {
|
|
206
|
+
return {
|
|
207
|
+
light: setBaseThemeColorsEnv(`${prefix}LIGHT_`, config.light),
|
|
208
|
+
dark: setBaseThemeColorsEnv(`${prefix}DARK_`, config.dark)
|
|
209
|
+
};
|
|
210
|
+
};
|
|
211
|
+
const setBaseThemeColorsEnv = (prefix, config) => {
|
|
212
|
+
if (config.foreground) process.env[`${prefix}FOREGROUND`] = config.foreground;
|
|
213
|
+
if (config.background) process.env[`${prefix}BACKGROUND`] = config.background;
|
|
214
|
+
if (config.brand) process.env[`${prefix}BRAND`] = config.brand;
|
|
215
|
+
if (config.alternate) process.env[`${prefix}ALTERNATE`] = config.alternate;
|
|
216
|
+
if (config.accent) process.env[`${prefix}ACCENT`] = config.accent;
|
|
217
|
+
if (config.link) process.env[`${prefix}LINK`] = config.link;
|
|
218
|
+
if (config.discovery) process.env[`${prefix}DISCOVERY`] = config.discovery;
|
|
219
|
+
if (config.success) process.env[`${prefix}SUCCESS`] = config.success;
|
|
220
|
+
if (config.info) process.env[`${prefix}INFO`] = config.info;
|
|
221
|
+
if (config.debug) process.env[`${prefix}DEBUG`] = config.debug;
|
|
222
|
+
if (config.warning) process.env[`${prefix}WARNING`] = config.warning;
|
|
223
|
+
if (config.danger) process.env[`${prefix}DANGER`] = config.danger;
|
|
224
|
+
if (config.fatal) process.env[`${prefix}FATAL`] = config.fatal;
|
|
225
|
+
if (config.performance) process.env[`${prefix}PERFORMANCE`] = config.performance;
|
|
226
|
+
if (config.positive) process.env[`${prefix}POSITIVE`] = config.positive;
|
|
227
|
+
if (config.negative) process.env[`${prefix}NEGATIVE`] = config.negative;
|
|
228
|
+
if (config.gradient) for (let i = 0; i < config.gradient.length; i++) process.env[`${prefix}GRADIENT_${i}`] = config.gradient[i];
|
|
229
|
+
};
|
|
230
|
+
//#endregion
|
|
231
|
+
export { setConfigEnv, setExtensionEnv };
|
package/dist/get-config.cjs
CHANGED
|
@@ -1,34 +1,46 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_utilities_find_workspace_root = require("./utilities/find-workspace-root.cjs");
|
|
3
|
+
const require_create_storm_config = require("./create-storm-config.cjs");
|
|
4
|
+
//#region src/get-config.ts
|
|
5
|
+
/**
|
|
6
|
+
* Get the config for the current Storm workspace
|
|
7
|
+
*
|
|
8
|
+
* @param workspaceRoot - The root directory of the workspace
|
|
9
|
+
* @param skipLogs - Skip writing logs to the console
|
|
10
|
+
* @returns The config for the current Storm workspace
|
|
11
|
+
*/
|
|
12
|
+
function getConfig(workspaceRoot, skipLogs = false) {
|
|
13
|
+
return require_create_storm_config.loadStormWorkspaceConfig(workspaceRoot, skipLogs);
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Get the config for the current Storm workspace
|
|
17
|
+
*
|
|
18
|
+
* @param skipLogs - Skip writing logs to the console
|
|
19
|
+
* @param options - Options for getting the workspace config
|
|
20
|
+
* @returns The config for the current Storm workspace, or throws an error if the config file could not be loaded
|
|
21
|
+
*/
|
|
22
|
+
function getWorkspaceConfig(skipLogs = true, options = {}) {
|
|
23
|
+
let workspaceRoot = options.workspaceRoot;
|
|
24
|
+
if (!workspaceRoot) workspaceRoot = require_utilities_find_workspace_root.findWorkspaceRoot(options.cwd);
|
|
25
|
+
return getConfig(workspaceRoot, skipLogs);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Try to get the config for the current Storm workspace
|
|
29
|
+
*
|
|
30
|
+
* @param skipLogs - Skip writing logs to the console
|
|
31
|
+
* @param options - Options for getting the workspace config
|
|
32
|
+
* @returns The config for the current Storm workspace, or undefined if the config file could not be loaded
|
|
33
|
+
*/
|
|
34
|
+
async function tryGetWorkspaceConfig(skipLogs = true, options = {}) {
|
|
35
|
+
try {
|
|
36
|
+
let workspaceRoot = options.workspaceRoot;
|
|
37
|
+
if (!workspaceRoot) workspaceRoot = require_utilities_find_workspace_root.findWorkspaceRoot(options.cwd);
|
|
38
|
+
return require_create_storm_config.tryLoadStormWorkspaceConfig(workspaceRoot, skipLogs, options.useDefault);
|
|
39
|
+
} catch {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
//#endregion
|
|
44
|
+
exports.getConfig = getConfig;
|
|
45
|
+
exports.getWorkspaceConfig = getWorkspaceConfig;
|
|
46
|
+
exports.tryGetWorkspaceConfig = tryGetWorkspaceConfig;
|
package/dist/get-config.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { StormWorkspaceConfig } from
|
|
2
|
-
|
|
1
|
+
import { StormWorkspaceConfig } from "@storm-software/config/types";
|
|
2
|
+
//#region src/get-config.d.ts
|
|
3
3
|
/**
|
|
4
4
|
* Get the config for the current Storm workspace
|
|
5
5
|
*
|
|
@@ -9,20 +9,20 @@ import { StormWorkspaceConfig } from '@storm-software/config/types';
|
|
|
9
9
|
*/
|
|
10
10
|
declare function getConfig(workspaceRoot?: string, skipLogs?: boolean): Promise<StormWorkspaceConfig>;
|
|
11
11
|
type GetWorkspaceConfigOptions = {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
12
|
+
/**
|
|
13
|
+
* The root directory of the workspace
|
|
14
|
+
*/
|
|
15
|
+
workspaceRoot?: string;
|
|
16
|
+
/**
|
|
17
|
+
* A directory inside the monorepo to start searching from
|
|
18
|
+
*/
|
|
19
|
+
cwd?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Use the default config if no config file is found
|
|
22
|
+
*
|
|
23
|
+
* @defaultValue true
|
|
24
|
+
*/
|
|
25
|
+
useDefault?: boolean;
|
|
26
26
|
};
|
|
27
27
|
/**
|
|
28
28
|
* Get the config for the current Storm workspace
|
|
@@ -40,5 +40,5 @@ declare function getWorkspaceConfig(skipLogs?: boolean, options?: GetWorkspaceCo
|
|
|
40
40
|
* @returns The config for the current Storm workspace, or undefined if the config file could not be loaded
|
|
41
41
|
*/
|
|
42
42
|
declare function tryGetWorkspaceConfig(skipLogs?: boolean, options?: GetWorkspaceConfigOptions): Promise<StormWorkspaceConfig | undefined>;
|
|
43
|
-
|
|
44
|
-
export {
|
|
43
|
+
//#endregion
|
|
44
|
+
export { GetWorkspaceConfigOptions, getConfig, getWorkspaceConfig, tryGetWorkspaceConfig };
|