@storm-software/config-tools 1.190.120 → 1.190.122

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.
Files changed (157) hide show
  1. package/README.md +1 -1
  2. package/bin/config.cjs +1272 -105
  3. package/bin/config.mjs +1271 -0
  4. package/dist/_virtual/_rolldown/runtime.cjs +23 -0
  5. package/dist/config-file/get-config-file.cjs +63 -79
  6. package/dist/config-file/get-config-file.d.cts +5 -5
  7. package/dist/config-file/{get-config-file.d.ts → get-config-file.d.mts} +7 -5
  8. package/dist/config-file/get-config-file.mjs +66 -0
  9. package/dist/config-file/index.cjs +4 -1
  10. package/dist/config-file/index.d.cts +2 -3
  11. package/dist/config-file/index.d.mts +4 -0
  12. package/dist/config-file/index.mjs +5 -0
  13. package/dist/create-storm-config.cjs +105 -136
  14. package/dist/create-storm-config.d.cts +5 -5
  15. package/dist/{create-storm-config.d.ts → create-storm-config.d.mts} +7 -5
  16. package/dist/create-storm-config.mjs +113 -0
  17. package/dist/env/get-env.cjs +190 -214
  18. package/dist/env/get-env.d.cts +5 -5
  19. package/dist/env/{get-env.d.ts → get-env.d.mts} +7 -5
  20. package/dist/env/get-env.mjs +203 -0
  21. package/dist/env/index.cjs +7 -2
  22. package/dist/env/index.d.cts +3 -4
  23. package/dist/env/index.d.mts +5 -0
  24. package/dist/env/index.mjs +6 -0
  25. package/dist/env/set-env.cjs +218 -374
  26. package/dist/env/set-env.d.cts +8 -8
  27. package/dist/env/{set-env.d.ts → set-env.d.mts} +10 -8
  28. package/dist/env/set-env.mjs +231 -0
  29. package/dist/get-config.cjs +40 -29
  30. package/dist/get-config.d.cts +18 -18
  31. package/dist/{get-config.d.ts → get-config.d.mts} +20 -18
  32. package/dist/get-config.mjs +46 -0
  33. package/dist/index.cjs +98 -7
  34. package/dist/index.d.cts +27 -28
  35. package/dist/index.d.mts +29 -0
  36. package/dist/index.mjs +26 -0
  37. package/dist/logger/chalk.cjs +38 -29
  38. package/dist/logger/chalk.d.cts +18 -17
  39. package/dist/logger/chalk.d.mts +37 -0
  40. package/dist/logger/chalk.mjs +43 -0
  41. package/dist/logger/console-icons.cjs +15 -14
  42. package/dist/logger/console-icons.d.cts +5 -8
  43. package/dist/logger/console-icons.d.mts +7 -0
  44. package/dist/logger/console-icons.mjs +20 -0
  45. package/dist/logger/console.cjs +187 -183
  46. package/dist/logger/console.d.cts +25 -25
  47. package/dist/logger/{console.d.ts → console.d.mts} +27 -25
  48. package/dist/logger/console.mjs +185 -0
  49. package/dist/logger/create-logger.cjs +31 -24
  50. package/dist/logger/create-logger.d.cts +5 -6
  51. package/dist/logger/{create-logger.d.ts → create-logger.d.mts} +7 -6
  52. package/dist/logger/create-logger.mjs +34 -0
  53. package/dist/logger/format-timestamp.cjs +12 -4
  54. package/dist/logger/format-timestamp.d.cts +3 -2
  55. package/dist/logger/{format-timestamp.d.ts → format-timestamp.d.mts} +5 -2
  56. package/dist/logger/format-timestamp.mjs +16 -0
  57. package/dist/logger/get-log-level.cjs +50 -60
  58. package/dist/logger/get-log-level.d.cts +4 -5
  59. package/dist/logger/{get-log-level.d.ts → get-log-level.d.mts} +6 -5
  60. package/dist/logger/get-log-level.mjs +54 -0
  61. package/dist/logger/index.cjs +29 -7
  62. package/dist/logger/index.d.cts +8 -10
  63. package/dist/logger/index.d.mts +10 -0
  64. package/dist/logger/index.mjs +11 -0
  65. package/dist/logger/is-unicode-supported.cjs +6 -10
  66. package/dist/logger/is-unicode-supported.d.cts +3 -2
  67. package/dist/logger/is-unicode-supported.d.mts +6 -0
  68. package/dist/logger/is-unicode-supported.mjs +10 -0
  69. package/dist/types.cjs +26 -25
  70. package/dist/types.d.cts +39 -41
  71. package/dist/types.d.mts +53 -0
  72. package/dist/types.mjs +30 -0
  73. package/dist/utilities/apply-workspace-tokens.cjs +31 -70
  74. package/dist/utilities/apply-workspace-tokens.d.cts +4 -5
  75. package/dist/utilities/{apply-workspace-tokens.d.ts → apply-workspace-tokens.d.mts} +6 -5
  76. package/dist/utilities/apply-workspace-tokens.mjs +37 -0
  77. package/dist/utilities/colors.cjs +91 -74
  78. package/dist/utilities/colors.d.cts +4 -4
  79. package/dist/utilities/{colors.d.ts → colors.d.mts} +6 -4
  80. package/dist/utilities/colors.mjs +97 -0
  81. package/dist/utilities/correct-paths.cjs +166 -196
  82. package/dist/utilities/correct-paths.d.cts +4 -4
  83. package/dist/utilities/{correct-paths.d.ts → correct-paths.d.mts} +6 -4
  84. package/dist/utilities/correct-paths.mjs +190 -0
  85. package/dist/utilities/file-path-utils.cjs +42 -27
  86. package/dist/utilities/file-path-utils.d.cts +15 -14
  87. package/dist/utilities/{file-path-utils.d.ts → file-path-utils.d.mts} +17 -14
  88. package/dist/utilities/file-path-utils.mjs +48 -0
  89. package/dist/utilities/find-up.cjs +12 -18
  90. package/dist/utilities/find-up.d.cts +3 -2
  91. package/dist/utilities/{find-up.d.ts → find-up.d.mts} +5 -2
  92. package/dist/utilities/find-up.mjs +19 -0
  93. package/dist/utilities/find-workspace-root.cjs +64 -69
  94. package/dist/utilities/find-workspace-root.d.cts +3 -2
  95. package/dist/utilities/{find-workspace-root.d.ts → find-workspace-root.d.mts} +5 -2
  96. package/dist/utilities/find-workspace-root.mjs +73 -0
  97. package/dist/utilities/get-default-config.cjs +69 -91
  98. package/dist/utilities/get-default-config.d.cts +4 -4
  99. package/dist/utilities/{get-default-config.d.ts → get-default-config.d.mts} +6 -4
  100. package/dist/utilities/get-default-config.mjs +74 -0
  101. package/dist/utilities/index.cjs +49 -9
  102. package/dist/utilities/index.d.cts +10 -14
  103. package/dist/utilities/index.d.mts +12 -0
  104. package/dist/utilities/index.mjs +13 -0
  105. package/dist/utilities/process-handler.cjs +32 -47
  106. package/dist/utilities/process-handler.d.cts +4 -4
  107. package/dist/utilities/process-handler.d.mts +9 -0
  108. package/dist/utilities/process-handler.mjs +38 -0
  109. package/dist/utilities/run.cjs +62 -36
  110. package/dist/utilities/run.d.cts +5 -6
  111. package/dist/utilities/{run.d.ts → run.d.mts} +7 -6
  112. package/dist/utilities/run.mjs +64 -0
  113. package/dist/utilities/toml.cjs +27 -32
  114. package/dist/utilities/toml.d.cts +148 -147
  115. package/dist/utilities/toml.d.mts +192 -0
  116. package/dist/utilities/toml.mjs +33 -0
  117. package/package.json +105 -157
  118. package/bin/config.js +0 -108
  119. package/dist/config-file/get-config-file.js +0 -83
  120. package/dist/config-file/index.d.ts +0 -3
  121. package/dist/config-file/index.js +0 -1
  122. package/dist/create-storm-config.js +0 -147
  123. package/dist/env/get-env.js +0 -226
  124. package/dist/env/index.d.ts +0 -4
  125. package/dist/env/index.js +0 -2
  126. package/dist/env/set-env.js +0 -386
  127. package/dist/get-config.js +0 -35
  128. package/dist/index.d.ts +0 -28
  129. package/dist/index.js +0 -7
  130. package/dist/logger/chalk.d.ts +0 -34
  131. package/dist/logger/chalk.js +0 -34
  132. package/dist/logger/console-icons.d.ts +0 -8
  133. package/dist/logger/console-icons.js +0 -17
  134. package/dist/logger/console.js +0 -191
  135. package/dist/logger/create-logger.js +0 -27
  136. package/dist/logger/format-timestamp.js +0 -6
  137. package/dist/logger/get-log-level.js +0 -64
  138. package/dist/logger/index.d.ts +0 -10
  139. package/dist/logger/index.js +0 -7
  140. package/dist/logger/is-unicode-supported.d.ts +0 -3
  141. package/dist/logger/is-unicode-supported.js +0 -12
  142. package/dist/types.d.ts +0 -53
  143. package/dist/types.js +0 -28
  144. package/dist/utilities/apply-workspace-tokens.js +0 -76
  145. package/dist/utilities/colors.js +0 -81
  146. package/dist/utilities/correct-paths.js +0 -231
  147. package/dist/utilities/file-path-utils.js +0 -33
  148. package/dist/utilities/find-up.js +0 -23
  149. package/dist/utilities/find-workspace-root.js +0 -77
  150. package/dist/utilities/get-default-config.js +0 -95
  151. package/dist/utilities/index.d.ts +0 -14
  152. package/dist/utilities/index.js +0 -9
  153. package/dist/utilities/process-handler.d.ts +0 -7
  154. package/dist/utilities/process-handler.js +0 -53
  155. package/dist/utilities/run.js +0 -38
  156. package/dist/utilities/toml.d.ts +0 -189
  157. package/dist/utilities/toml.js +0 -42
@@ -1,11 +1,13 @@
1
- import { StormWorkspaceConfig } from '@storm-software/config';
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
- namespace NodeJS {
5
- interface ProcessEnv {
6
- [key: string]: string | undefined;
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 };
@@ -1,35 +1,46 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
-
3
-
4
- var _createstormconfig = require('./create-storm-config');
5
- var _findworkspaceroot = require('./utilities/find-workspace-root');
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
+ */
6
12
  function getConfig(workspaceRoot, skipLogs = false) {
7
- return _createstormconfig.loadStormWorkspaceConfig.call(void 0, workspaceRoot, skipLogs);
13
+ return require_create_storm_config.loadStormWorkspaceConfig(workspaceRoot, skipLogs);
8
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
+ */
9
22
  function getWorkspaceConfig(skipLogs = true, options = {}) {
10
- let workspaceRoot = options.workspaceRoot;
11
- if (!workspaceRoot) {
12
- workspaceRoot = _findworkspaceroot.findWorkspaceRoot.call(void 0, options.cwd);
13
- }
14
- return getConfig(workspaceRoot, skipLogs);
23
+ let workspaceRoot = options.workspaceRoot;
24
+ if (!workspaceRoot) workspaceRoot = require_utilities_find_workspace_root.findWorkspaceRoot(options.cwd);
25
+ return getConfig(workspaceRoot, skipLogs);
15
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
+ */
16
34
  async function tryGetWorkspaceConfig(skipLogs = true, options = {}) {
17
- try {
18
- let workspaceRoot = options.workspaceRoot;
19
- if (!workspaceRoot) {
20
- workspaceRoot = _findworkspaceroot.findWorkspaceRoot.call(void 0, options.cwd);
21
- }
22
- return _createstormconfig.tryLoadStormWorkspaceConfig.call(void 0,
23
- workspaceRoot,
24
- skipLogs,
25
- options.useDefault
26
- );
27
- } catch (e) {
28
- return void 0;
29
- }
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
+ }
30
42
  }
31
-
32
-
33
-
34
-
35
- exports.getConfig = getConfig; exports.getWorkspaceConfig = getWorkspaceConfig; exports.tryGetWorkspaceConfig = tryGetWorkspaceConfig;
43
+ //#endregion
44
+ exports.getConfig = getConfig;
45
+ exports.getWorkspaceConfig = getWorkspaceConfig;
46
+ exports.tryGetWorkspaceConfig = tryGetWorkspaceConfig;
@@ -1,5 +1,5 @@
1
- import { StormWorkspaceConfig } from '@storm-software/config/types';
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
- * 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;
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 { type GetWorkspaceConfigOptions, getConfig, getWorkspaceConfig, tryGetWorkspaceConfig };
43
+ //#endregion
44
+ export { GetWorkspaceConfigOptions, getConfig, getWorkspaceConfig, tryGetWorkspaceConfig };
@@ -1,5 +1,7 @@
1
- import { StormWorkspaceConfig } from '@storm-software/config/types';
2
-
1
+ import __tsdown_shims_path from 'node:path';
2
+ import __tsdown_shims_url from 'node:url';
3
+ import { StormWorkspaceConfig } from "@storm-software/config/types";
4
+ //#region src/get-config.d.ts
3
5
  /**
4
6
  * Get the config for the current Storm workspace
5
7
  *
@@ -9,20 +11,20 @@ import { StormWorkspaceConfig } from '@storm-software/config/types';
9
11
  */
10
12
  declare function getConfig(workspaceRoot?: string, skipLogs?: boolean): Promise<StormWorkspaceConfig>;
11
13
  type GetWorkspaceConfigOptions = {
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;
14
+ /**
15
+ * The root directory of the workspace
16
+ */
17
+ workspaceRoot?: string;
18
+ /**
19
+ * A directory inside the monorepo to start searching from
20
+ */
21
+ cwd?: string;
22
+ /**
23
+ * Use the default config if no config file is found
24
+ *
25
+ * @defaultValue true
26
+ */
27
+ useDefault?: boolean;
26
28
  };
27
29
  /**
28
30
  * Get the config for the current Storm workspace
@@ -40,5 +42,5 @@ declare function getWorkspaceConfig(skipLogs?: boolean, options?: GetWorkspaceCo
40
42
  * @returns The config for the current Storm workspace, or undefined if the config file could not be loaded
41
43
  */
42
44
  declare function tryGetWorkspaceConfig(skipLogs?: boolean, options?: GetWorkspaceConfigOptions): Promise<StormWorkspaceConfig | undefined>;
43
-
44
- export { type GetWorkspaceConfigOptions, getConfig, getWorkspaceConfig, tryGetWorkspaceConfig };
45
+ //#endregion
46
+ export { GetWorkspaceConfigOptions, getConfig, getWorkspaceConfig, tryGetWorkspaceConfig };
@@ -0,0 +1,46 @@
1
+ import "node:path";
2
+ import "node:url";
3
+ import.meta.url;
4
+ import { findWorkspaceRoot } from "./utilities/find-workspace-root.mjs";
5
+ import { loadStormWorkspaceConfig, tryLoadStormWorkspaceConfig } from "./create-storm-config.mjs";
6
+ //#region src/get-config.ts
7
+ /**
8
+ * Get the config for the current Storm workspace
9
+ *
10
+ * @param workspaceRoot - The root directory of the workspace
11
+ * @param skipLogs - Skip writing logs to the console
12
+ * @returns The config for the current Storm workspace
13
+ */
14
+ function getConfig(workspaceRoot, skipLogs = false) {
15
+ return loadStormWorkspaceConfig(workspaceRoot, skipLogs);
16
+ }
17
+ /**
18
+ * Get the config for the current Storm workspace
19
+ *
20
+ * @param skipLogs - Skip writing logs to the console
21
+ * @param options - Options for getting the workspace config
22
+ * @returns The config for the current Storm workspace, or throws an error if the config file could not be loaded
23
+ */
24
+ function getWorkspaceConfig(skipLogs = true, options = {}) {
25
+ let workspaceRoot = options.workspaceRoot;
26
+ if (!workspaceRoot) workspaceRoot = findWorkspaceRoot(options.cwd);
27
+ return getConfig(workspaceRoot, skipLogs);
28
+ }
29
+ /**
30
+ * Try to get the config for the current Storm workspace
31
+ *
32
+ * @param skipLogs - Skip writing logs to the console
33
+ * @param options - Options for getting the workspace config
34
+ * @returns The config for the current Storm workspace, or undefined if the config file could not be loaded
35
+ */
36
+ async function tryGetWorkspaceConfig(skipLogs = true, options = {}) {
37
+ try {
38
+ let workspaceRoot = options.workspaceRoot;
39
+ if (!workspaceRoot) workspaceRoot = findWorkspaceRoot(options.cwd);
40
+ return tryLoadStormWorkspaceConfig(workspaceRoot, skipLogs, options.useDefault);
41
+ } catch {
42
+ return;
43
+ }
44
+ }
45
+ //#endregion
46
+ export { getConfig, getWorkspaceConfig, tryGetWorkspaceConfig };
package/dist/index.cjs CHANGED
@@ -1,7 +1,98 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _createStarExport(obj) { Object.keys(obj) .filter((key) => key !== "default" && key !== "__esModule") .forEach((key) => { if (exports.hasOwnProperty(key)) { return; } Object.defineProperty(exports, key, {enumerable: true, configurable: true, get: () => obj[key]}); }); }var _configfile = require('./config-file'); _createStarExport(_configfile);
2
- var _createstormconfig = require('./create-storm-config'); _createStarExport(_createstormconfig);
3
- var _env = require('./env'); _createStarExport(_env);
4
- var _getconfig = require('./get-config'); _createStarExport(_getconfig);
5
- var _logger = require('./logger'); _createStarExport(_logger);
6
- var _types = require('./types'); _createStarExport(_types);
7
- var _utilities = require('./utilities'); _createStarExport(_utilities);
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_types = require("./types.cjs");
3
+ const require_utilities_colors = require("./utilities/colors.cjs");
4
+ const require_logger_chalk = require("./logger/chalk.cjs");
5
+ const require_logger_is_unicode_supported = require("./logger/is-unicode-supported.cjs");
6
+ const require_logger_console_icons = require("./logger/console-icons.cjs");
7
+ const require_logger_format_timestamp = require("./logger/format-timestamp.cjs");
8
+ const require_logger_get_log_level = require("./logger/get-log-level.cjs");
9
+ const require_logger_console = require("./logger/console.cjs");
10
+ const require_utilities_correct_paths = require("./utilities/correct-paths.cjs");
11
+ const require_utilities_find_workspace_root = require("./utilities/find-workspace-root.cjs");
12
+ const require_utilities_apply_workspace_tokens = require("./utilities/apply-workspace-tokens.cjs");
13
+ const require_utilities_file_path_utils = require("./utilities/file-path-utils.cjs");
14
+ const require_utilities_get_default_config = require("./utilities/get-default-config.cjs");
15
+ const require_utilities_process_handler = require("./utilities/process-handler.cjs");
16
+ const require_utilities_run = require("./utilities/run.cjs");
17
+ const require_logger_create_logger = require("./logger/create-logger.cjs");
18
+ const require_utilities_toml = require("./utilities/toml.cjs");
19
+ const require_config_file_get_config_file = require("./config-file/get-config-file.cjs");
20
+ const require_env_get_env = require("./env/get-env.cjs");
21
+ const require_env_set_env = require("./env/set-env.cjs");
22
+ const require_create_storm_config = require("./create-storm-config.cjs");
23
+ const require_get_config = require("./get-config.cjs");
24
+ exports.CONSOLE_ICONS = require_logger_console_icons.CONSOLE_ICONS;
25
+ exports.DEFAULT_COLOR_CONFIG = require_utilities_colors.DEFAULT_COLOR_CONFIG;
26
+ exports.LARGE_BUFFER = require_utilities_run.LARGE_BUFFER;
27
+ exports.LogLevel = require_types.LogLevel;
28
+ exports.LogLevelLabel = require_types.LogLevelLabel;
29
+ exports.applyDefaultConfig = require_utilities_get_default_config.applyDefaultConfig;
30
+ exports.applyWorkspaceBaseTokens = require_utilities_apply_workspace_tokens.applyWorkspaceBaseTokens;
31
+ exports.applyWorkspaceProjectTokens = require_utilities_apply_workspace_tokens.applyWorkspaceProjectTokens;
32
+ exports.applyWorkspaceTokens = require_utilities_apply_workspace_tokens.applyWorkspaceTokens;
33
+ exports.basename = require_utilities_correct_paths.basename;
34
+ exports.brandIcon = require_logger_console.brandIcon;
35
+ exports.correctPaths = require_utilities_correct_paths.correctPaths;
36
+ exports.createConfigExtension = require_create_storm_config.createConfigExtension;
37
+ exports.createLogger = require_logger_create_logger.createLogger;
38
+ exports.createStormWorkspaceConfig = require_create_storm_config.createStormWorkspaceConfig;
39
+ exports.dirname = require_utilities_correct_paths.dirname;
40
+ exports.exitWithError = require_utilities_process_handler.exitWithError;
41
+ exports.exitWithSuccess = require_utilities_process_handler.exitWithSuccess;
42
+ exports.extname = require_utilities_correct_paths.extname;
43
+ exports.findFileName = require_utilities_file_path_utils.findFileName;
44
+ exports.findFilePath = require_utilities_file_path_utils.findFilePath;
45
+ exports.findWorkspaceRoot = require_utilities_find_workspace_root.findWorkspaceRoot;
46
+ exports.findWorkspaceRootSafe = require_utilities_find_workspace_root.findWorkspaceRootSafe;
47
+ exports.format = require_utilities_correct_paths.format;
48
+ exports.formatLogMessage = require_logger_console.formatLogMessage;
49
+ exports.formatTimestamp = require_logger_format_timestamp.formatTimestamp;
50
+ exports.getChalk = require_logger_chalk.getChalk;
51
+ exports.getColor = require_utilities_colors.getColor;
52
+ exports.getColors = require_utilities_colors.getColors;
53
+ exports.getConfig = require_get_config.getConfig;
54
+ exports.getConfigEnv = require_env_get_env.getConfigEnv;
55
+ exports.getConfigFile = require_config_file_get_config_file.getConfigFile;
56
+ exports.getConfigFileByName = require_config_file_get_config_file.getConfigFileByName;
57
+ exports.getExtensionEnv = require_env_get_env.getExtensionEnv;
58
+ exports.getGradient = require_utilities_colors.getGradient;
59
+ exports.getLogFn = require_logger_console.getLogFn;
60
+ exports.getLogLevel = require_logger_get_log_level.getLogLevel;
61
+ exports.getLogLevelLabel = require_logger_get_log_level.getLogLevelLabel;
62
+ exports.getPackageJsonConfig = require_utilities_get_default_config.getPackageJsonConfig;
63
+ exports.getStopwatch = require_logger_console.getStopwatch;
64
+ exports.getWorkspaceConfig = require_get_config.getWorkspaceConfig;
65
+ exports.handleProcess = require_utilities_process_handler.handleProcess;
66
+ exports.isAbsolute = require_utilities_correct_paths.isAbsolute;
67
+ exports.isUnicodeSupported = require_logger_is_unicode_supported.isUnicodeSupported;
68
+ exports.isVerbose = require_logger_get_log_level.isVerbose;
69
+ exports.joinPaths = require_utilities_correct_paths.joinPaths;
70
+ exports.loadStormWorkspaceConfig = require_create_storm_config.loadStormWorkspaceConfig;
71
+ exports.modifyCargoNestedTable = require_utilities_toml.modifyCargoNestedTable;
72
+ exports.modifyCargoTable = require_utilities_toml.modifyCargoTable;
73
+ exports.normalizeString = require_utilities_correct_paths.normalizeString;
74
+ exports.normalizeWindowsPath = require_utilities_correct_paths.normalizeWindowsPath;
75
+ exports.parse = require_utilities_correct_paths.parse;
76
+ exports.parseCargoToml = require_utilities_toml.parseCargoToml;
77
+ exports.parseCargoTomlWithTree = require_utilities_toml.parseCargoTomlWithTree;
78
+ exports.relative = require_utilities_correct_paths.relative;
79
+ exports.removeExtension = require_utilities_file_path_utils.removeExtension;
80
+ exports.resolve = require_utilities_correct_paths.resolve;
81
+ exports.run = require_utilities_run.run;
82
+ exports.runAsync = require_utilities_run.runAsync;
83
+ exports.sep = require_utilities_correct_paths.sep;
84
+ exports.setConfigEnv = require_env_set_env.setConfigEnv;
85
+ exports.setExtensionEnv = require_env_set_env.setExtensionEnv;
86
+ exports.stringifyCargoToml = require_utilities_toml.stringifyCargoToml;
87
+ exports.toNamespacedPath = require_utilities_correct_paths.toNamespacedPath;
88
+ exports.tryGetWorkspaceConfig = require_get_config.tryGetWorkspaceConfig;
89
+ exports.tryLoadStormWorkspaceConfig = require_create_storm_config.tryLoadStormWorkspaceConfig;
90
+ exports.writeDebug = require_logger_console.writeDebug;
91
+ exports.writeError = require_logger_console.writeError;
92
+ exports.writeFatal = require_logger_console.writeFatal;
93
+ exports.writeInfo = require_logger_console.writeInfo;
94
+ exports.writePerformance = require_logger_console.writePerformance;
95
+ exports.writeSuccess = require_logger_console.writeSuccess;
96
+ exports.writeSystem = require_logger_console.writeSystem;
97
+ exports.writeTrace = require_logger_console.writeTrace;
98
+ exports.writeWarning = require_logger_console.writeWarning;