@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.
Files changed (211) hide show
  1. package/README.md +1 -1
  2. package/bin/config.cjs +1213 -1558
  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 +67 -28
  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 -29
  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 +115 -34
  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 +202 -11
  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 -18
  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 +230 -11
  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 +46 -34
  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 -201
  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 +43 -6
  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 +18 -8
  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 +195 -37
  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 +34 -14
  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 +14 -6
  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 +54 -11
  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 -61
  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 +8 -6
  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 +29 -8
  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 +37 -13
  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 +98 -12
  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 +201 -32
  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 +48 -11
  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 +17 -6
  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 +72 -10
  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 +73 -11
  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 -109
  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 +38 -18
  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 +64 -10
  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 +37 -24
  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 +106 -158
  118. package/bin/config.js +0 -1616
  119. package/dist/chunk-24B36RDB.cjs +0 -81
  120. package/dist/chunk-27N3QEX5.js +0 -40
  121. package/dist/chunk-2AVLCXLT.js +0 -0
  122. package/dist/chunk-2RLMTBVZ.js +0 -233
  123. package/dist/chunk-2WBD2G3E.cjs +0 -38
  124. package/dist/chunk-3COHMHPU.cjs +0 -1
  125. package/dist/chunk-4Q45WJYQ.js +0 -165
  126. package/dist/chunk-5C7PIENF.js +0 -92
  127. package/dist/chunk-5J2SS4QU.js +0 -83
  128. package/dist/chunk-65SWKEHV.cjs +0 -1
  129. package/dist/chunk-6Y623TCS.cjs +0 -40
  130. package/dist/chunk-7PV6L7I7.cjs +0 -1
  131. package/dist/chunk-7QBTVNMR.cjs +0 -30
  132. package/dist/chunk-BDATZ3UB.cjs +0 -233
  133. package/dist/chunk-BZRTSWH4.cjs +0 -395
  134. package/dist/chunk-D3FRXXDE.js +0 -947
  135. package/dist/chunk-DTGT4OI3.cjs +0 -14
  136. package/dist/chunk-EC2KPWRG.cjs +0 -24
  137. package/dist/chunk-EENQN6N2.js +0 -40
  138. package/dist/chunk-ENI4UUSK.cjs +0 -35
  139. package/dist/chunk-FJNXECWU.js +0 -395
  140. package/dist/chunk-FMDVBSP6.cjs +0 -83
  141. package/dist/chunk-G2MK47WL.js +0 -14
  142. package/dist/chunk-HFS7WJVW.js +0 -81
  143. package/dist/chunk-HVVJHTFS.js +0 -36
  144. package/dist/chunk-IWD6YQKX.cjs +0 -1
  145. package/dist/chunk-IWQRXQ4N.cjs +0 -84
  146. package/dist/chunk-JK4TT5IV.js +0 -35
  147. package/dist/chunk-JWLDCEBZ.cjs +0 -70
  148. package/dist/chunk-JZAYHDV3.js +0 -8
  149. package/dist/chunk-KSMN3HSC.js +0 -38
  150. package/dist/chunk-L6UNTUC4.js +0 -0
  151. package/dist/chunk-LOY6ICHZ.cjs +0 -36
  152. package/dist/chunk-MBG2FTBL.cjs +0 -47
  153. package/dist/chunk-MQG74XF7.js +0 -102
  154. package/dist/chunk-MSAQEGBK.cjs +0 -92
  155. package/dist/chunk-NJFLUTGH.cjs +0 -25
  156. package/dist/chunk-PCYB64MB.cjs +0 -40
  157. package/dist/chunk-RALMUN5C.js +0 -30
  158. package/dist/chunk-RRKB32OH.js +0 -0
  159. package/dist/chunk-RUKM6FCF.js +0 -25
  160. package/dist/chunk-SIW7AXUG.js +0 -56
  161. package/dist/chunk-SLICWTO2.cjs +0 -165
  162. package/dist/chunk-SO3FWVXC.js +0 -84
  163. package/dist/chunk-SXPH7ILL.js +0 -70
  164. package/dist/chunk-T7YISGRS.cjs +0 -102
  165. package/dist/chunk-TZZRLM5J.cjs +0 -947
  166. package/dist/chunk-UJ77IBHD.cjs +0 -233
  167. package/dist/chunk-UKGRDKIH.js +0 -0
  168. package/dist/chunk-V3GMJ4TX.js +0 -233
  169. package/dist/chunk-WQJYIPSL.cjs +0 -8
  170. package/dist/chunk-YBVOKYAM.cjs +0 -56
  171. package/dist/chunk-YX4736HU.js +0 -47
  172. package/dist/chunk-ZFNAUMQS.js +0 -24
  173. package/dist/config-file/get-config-file.js +0 -28
  174. package/dist/config-file/index.d.ts +0 -3
  175. package/dist/config-file/index.js +0 -29
  176. package/dist/create-storm-config.js +0 -35
  177. package/dist/env/get-env.js +0 -11
  178. package/dist/env/index.d.ts +0 -4
  179. package/dist/env/index.js +0 -18
  180. package/dist/env/set-env.js +0 -11
  181. package/dist/get-config.js +0 -34
  182. package/dist/index.d.ts +0 -28
  183. package/dist/index.js +0 -201
  184. package/dist/logger/chalk.d.ts +0 -34
  185. package/dist/logger/chalk.js +0 -6
  186. package/dist/logger/console-icons.d.ts +0 -8
  187. package/dist/logger/console-icons.js +0 -8
  188. package/dist/logger/console.js +0 -37
  189. package/dist/logger/create-logger.js +0 -14
  190. package/dist/logger/format-timestamp.js +0 -6
  191. package/dist/logger/get-log-level.js +0 -11
  192. package/dist/logger/index.d.ts +0 -10
  193. package/dist/logger/index.js +0 -61
  194. package/dist/logger/is-unicode-supported.d.ts +0 -3
  195. package/dist/logger/is-unicode-supported.js +0 -6
  196. package/dist/types.d.ts +0 -53
  197. package/dist/types.js +0 -8
  198. package/dist/utilities/apply-workspace-tokens.js +0 -13
  199. package/dist/utilities/colors.js +0 -12
  200. package/dist/utilities/correct-paths.js +0 -32
  201. package/dist/utilities/file-path-utils.js +0 -11
  202. package/dist/utilities/find-up.js +0 -6
  203. package/dist/utilities/find-workspace-root.js +0 -10
  204. package/dist/utilities/get-default-config.js +0 -11
  205. package/dist/utilities/index.d.ts +0 -14
  206. package/dist/utilities/index.js +0 -109
  207. package/dist/utilities/process-handler.d.ts +0 -7
  208. package/dist/utilities/process-handler.js +0 -18
  209. package/dist/utilities/run.js +0 -10
  210. package/dist/utilities/toml.d.ts +0 -189
  211. package/dist/utilities/toml.js +0 -24
@@ -1,81 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
-
3
- var _chunkIWQRXQ4Ncjs = require('./chunk-IWQRXQ4N.cjs');
4
-
5
- // src/utilities/apply-workspace-tokens.ts
6
- var applyWorkspaceBaseTokens = async (option, tokenParams) => {
7
- let result = option;
8
- if (!result) {
9
- return result;
10
- }
11
- if (tokenParams) {
12
- const optionKeys = Object.keys(tokenParams);
13
- if (optionKeys.some((optionKey) => result.includes(`{${optionKey}}`))) {
14
- for (const optionKey of optionKeys) {
15
- if (result.includes(`{${optionKey}}`)) {
16
- result = result.replaceAll(
17
- `{${optionKey}}`,
18
- _optionalChain([tokenParams, 'optionalAccess', _ => _[optionKey]]) || ""
19
- );
20
- }
21
- }
22
- }
23
- }
24
- if (tokenParams.config) {
25
- const configKeys = Object.keys(tokenParams.config);
26
- if (configKeys.some((configKey) => result.includes(`{${configKey}}`))) {
27
- for (const configKey of configKeys) {
28
- if (result.includes(`{${configKey}}`)) {
29
- result = result.replaceAll(
30
- `{${configKey}}`,
31
- tokenParams.config[configKey] || ""
32
- );
33
- }
34
- }
35
- }
36
- }
37
- if (result.includes("{workspaceRoot}")) {
38
- result = result.replaceAll(
39
- "{workspaceRoot}",
40
- _nullishCoalesce(_nullishCoalesce(tokenParams.workspaceRoot, () => ( _optionalChain([tokenParams, 'access', _2 => _2.config, 'optionalAccess', _3 => _3.workspaceRoot]))), () => ( _chunkIWQRXQ4Ncjs.findWorkspaceRoot.call(void 0, )))
41
- );
42
- }
43
- return result;
44
- };
45
- var applyWorkspaceProjectTokens = (option, tokenParams) => {
46
- return applyWorkspaceBaseTokens(option, tokenParams);
47
- };
48
- var applyWorkspaceTokens = async (options, tokenParams, tokenizerFn) => {
49
- if (!options) {
50
- return {};
51
- }
52
- const result = {};
53
- for (const option of Object.keys(options)) {
54
- if (typeof options[option] === "string") {
55
- result[option] = await Promise.resolve(
56
- tokenizerFn(options[option], tokenParams)
57
- );
58
- } else if (Array.isArray(options[option])) {
59
- result[option] = await Promise.all(
60
- options[option].map(
61
- async (item) => typeof item === "string" ? await Promise.resolve(tokenizerFn(item, tokenParams)) : item
62
- )
63
- );
64
- } else if (typeof options[option] === "object") {
65
- result[option] = await applyWorkspaceTokens(
66
- options[option],
67
- tokenParams,
68
- tokenizerFn
69
- );
70
- } else {
71
- result[option] = options[option];
72
- }
73
- }
74
- return result;
75
- };
76
-
77
-
78
-
79
-
80
-
81
- exports.applyWorkspaceBaseTokens = applyWorkspaceBaseTokens; exports.applyWorkspaceProjectTokens = applyWorkspaceProjectTokens; exports.applyWorkspaceTokens = applyWorkspaceTokens;
@@ -1,40 +0,0 @@
1
- import {
2
- loadStormWorkspaceConfig,
3
- tryLoadStormWorkspaceConfig
4
- } from "./chunk-4Q45WJYQ.js";
5
- import {
6
- findWorkspaceRoot
7
- } from "./chunk-SO3FWVXC.js";
8
-
9
- // src/get-config.ts
10
- function getConfig(workspaceRoot, skipLogs = false) {
11
- return loadStormWorkspaceConfig(workspaceRoot, skipLogs);
12
- }
13
- function getWorkspaceConfig(skipLogs = true, options = {}) {
14
- let workspaceRoot = options.workspaceRoot;
15
- if (!workspaceRoot) {
16
- workspaceRoot = findWorkspaceRoot(options.cwd);
17
- }
18
- return getConfig(workspaceRoot, skipLogs);
19
- }
20
- async function tryGetWorkspaceConfig(skipLogs = true, options = {}) {
21
- try {
22
- let workspaceRoot = options.workspaceRoot;
23
- if (!workspaceRoot) {
24
- workspaceRoot = findWorkspaceRoot(options.cwd);
25
- }
26
- return tryLoadStormWorkspaceConfig(
27
- workspaceRoot,
28
- skipLogs,
29
- options.useDefault
30
- );
31
- } catch {
32
- return void 0;
33
- }
34
- }
35
-
36
- export {
37
- getConfig,
38
- getWorkspaceConfig,
39
- tryGetWorkspaceConfig
40
- };
File without changes
@@ -1,233 +0,0 @@
1
- import {
2
- correctPaths
3
- } from "./chunk-V3GMJ4TX.js";
4
- import {
5
- getLogLevelLabel
6
- } from "./chunk-SXPH7ILL.js";
7
-
8
- // src/env/get-env.ts
9
- import {
10
- COLOR_KEYS,
11
- STORM_DEFAULT_DOCS,
12
- STORM_DEFAULT_HOMEPAGE,
13
- STORM_DEFAULT_LICENSING
14
- } from "@storm-software/config";
15
- var getExtensionEnv = (extensionName) => {
16
- const prefix = `STORM_EXTENSION_${extensionName.toUpperCase()}_`;
17
- return Object.keys(process.env).filter((key) => key.startsWith(prefix)).reduce((ret, key) => {
18
- const name = key.replace(prefix, "").split("_").map(
19
- (i) => i.length > 0 ? i.trim().charAt(0).toUpperCase() + i.trim().slice(1) : ""
20
- ).join("");
21
- if (name) {
22
- ret[name] = process.env[key];
23
- }
24
- return ret;
25
- }, {});
26
- };
27
- var getConfigEnv = () => {
28
- const prefix = "STORM_";
29
- let config = {
30
- extends: process.env[`${prefix}EXTENDS`] || void 0,
31
- name: process.env[`${prefix}NAME`] || void 0,
32
- variant: process.env[`${prefix}VARIANT`] || void 0,
33
- namespace: process.env[`${prefix}NAMESPACE`] || void 0,
34
- owner: process.env[`${prefix}OWNER`] || void 0,
35
- bot: {
36
- name: process.env[`${prefix}BOT_NAME`] || void 0,
37
- email: process.env[`${prefix}BOT_EMAIL`] || void 0
38
- },
39
- release: {
40
- banner: {
41
- url: process.env[`${prefix}RELEASE_BANNER_URL`] || void 0,
42
- alt: process.env[`${prefix}RELEASE_BANNER_ALT`] || void 0
43
- },
44
- header: process.env[`${prefix}RELEASE_HEADER`] || void 0,
45
- footer: process.env[`${prefix}RELEASE_FOOTER`] || void 0
46
- },
47
- error: {
48
- codesFile: process.env[`${prefix}ERROR_CODES_FILE`] || void 0,
49
- url: process.env[`${prefix}ERROR_URL`] || void 0
50
- },
51
- socials: {
52
- twitter: process.env[`${prefix}SOCIAL_TWITTER`] || void 0,
53
- discord: process.env[`${prefix}SOCIAL_DISCORD`] || void 0,
54
- telegram: process.env[`${prefix}SOCIAL_TELEGRAM`] || void 0,
55
- slack: process.env[`${prefix}SOCIAL_SLACK`] || void 0,
56
- medium: process.env[`${prefix}SOCIAL_MEDIUM`] || void 0,
57
- github: process.env[`${prefix}SOCIAL_GITHUB`] || void 0
58
- },
59
- organization: process.env[`${prefix}ORG`] || process.env[`${prefix}ORGANIZATION`] || process.env[`${prefix}ORG_NAME`] || process.env[`${prefix}ORGANIZATION_NAME`] ? process.env[`${prefix}ORG_DESCRIPTION`] || process.env[`${prefix}ORGANIZATION_DESCRIPTION`] || process.env[`${prefix}ORG_URL`] || process.env[`${prefix}ORGANIZATION_URL`] || process.env[`${prefix}ORG_LOGO`] || process.env[`${prefix}ORGANIZATION_LOGO`] ? {
60
- name: process.env[`${prefix}ORG`] || process.env[`${prefix}ORGANIZATION`] || process.env[`${prefix}ORG_NAME`] || process.env[`${prefix}ORGANIZATION_NAME`],
61
- description: process.env[`${prefix}ORG_DESCRIPTION`] || process.env[`${prefix}ORGANIZATION_DESCRIPTION`] || void 0,
62
- url: process.env[`${prefix}ORG_URL`] || process.env[`${prefix}ORGANIZATION_URL`] || void 0,
63
- logo: process.env[`${prefix}ORG_LOGO`] || process.env[`${prefix}ORGANIZATION_LOGO`] || void 0,
64
- icon: process.env[`${prefix}ORG_ICON`] || process.env[`${prefix}ORGANIZATION_ICON`] || void 0
65
- } : process.env[`${prefix}ORG`] || process.env[`${prefix}ORGANIZATION`] || process.env[`${prefix}ORG_NAME`] || process.env[`${prefix}ORGANIZATION_NAME`] : void 0,
66
- packageManager: process.env[`${prefix}PACKAGE_MANAGER`] || void 0,
67
- license: process.env[`${prefix}LICENSE`] || void 0,
68
- homepage: process.env[`${prefix}HOMEPAGE`] || void 0,
69
- docs: process.env[`${prefix}DOCS`] || void 0,
70
- portal: process.env[`${prefix}PORTAL`] || void 0,
71
- licensing: process.env[`${prefix}LICENSING`] || void 0,
72
- contact: process.env[`${prefix}CONTACT`] || void 0,
73
- support: process.env[`${prefix}SUPPORT`] || void 0,
74
- timezone: process.env[`${prefix}TIMEZONE`] || process.env.TZ || void 0,
75
- locale: process.env[`${prefix}LOCALE`] || process.env.LOCALE || void 0,
76
- configFile: process.env[`${prefix}WORKSPACE_CONFIG_FILE`] ? correctPaths(process.env[`${prefix}WORKSPACE_CONFIG_FILE`]) : void 0,
77
- workspaceRoot: process.env[`${prefix}WORKSPACE_ROOT`] ? correctPaths(process.env[`${prefix}WORKSPACE_ROOT`]) : void 0,
78
- directories: {
79
- cache: process.env[`${prefix}CACHE_DIR`] ? correctPaths(process.env[`${prefix}CACHE_DIR`]) : process.env[`${prefix}CACHE_DIRECTORY`] ? correctPaths(process.env[`${prefix}CACHE_DIRECTORY`]) : void 0,
80
- data: process.env[`${prefix}DATA_DIR`] ? correctPaths(process.env[`${prefix}DATA_DIR`]) : process.env[`${prefix}DATA_DIRECTORY`] ? correctPaths(process.env[`${prefix}DATA_DIRECTORY`]) : void 0,
81
- config: process.env[`${prefix}CONFIG_DIR`] ? correctPaths(process.env[`${prefix}CONFIG_DIR`]) : process.env[`${prefix}CONFIG_DIRECTORY`] ? correctPaths(process.env[`${prefix}CONFIG_DIRECTORY`]) : void 0,
82
- temp: process.env[`${prefix}TEMP_DIR`] ? correctPaths(process.env[`${prefix}TEMP_DIR`]) : process.env[`${prefix}TEMP_DIRECTORY`] ? correctPaths(process.env[`${prefix}TEMP_DIRECTORY`]) : void 0,
83
- log: process.env[`${prefix}LOG_DIR`] ? correctPaths(process.env[`${prefix}LOG_DIR`]) : process.env[`${prefix}LOG_DIRECTORY`] ? correctPaths(process.env[`${prefix}LOG_DIRECTORY`]) : void 0,
84
- build: process.env[`${prefix}BUILD_DIR`] ? correctPaths(process.env[`${prefix}BUILD_DIR`]) : process.env[`${prefix}BUILD_DIRECTORY`] ? correctPaths(process.env[`${prefix}BUILD_DIRECTORY`]) : void 0
85
- },
86
- skipCache: process.env[`${prefix}SKIP_CACHE`] !== void 0 ? Boolean(process.env[`${prefix}SKIP_CACHE`]) : void 0,
87
- mode: (process.env[`${prefix}MODE`] ?? process.env.NODE_ENV ?? process.env.ENVIRONMENT) || void 0,
88
- // ci:
89
- // process.env[`${prefix}CI`] !== undefined
90
- // ? Boolean(
91
- // process.env[`${prefix}CI`] ??
92
- // process.env.CI ??
93
- // process.env.CONTINUOUS_INTEGRATION
94
- // )
95
- // : undefined,
96
- repository: process.env[`${prefix}REPOSITORY`] || void 0,
97
- branch: process.env[`${prefix}BRANCH`] || void 0,
98
- preid: process.env[`${prefix}PRE_ID`] || void 0,
99
- registry: {
100
- github: process.env[`${prefix}REGISTRY_GITHUB`] || void 0,
101
- npm: process.env[`${prefix}REGISTRY_NPM`] || void 0,
102
- cargo: process.env[`${prefix}REGISTRY_CARGO`] || void 0,
103
- cyclone: process.env[`${prefix}REGISTRY_CYCLONE`] || void 0,
104
- container: process.env[`${prefix}REGISTRY_CONTAINER`] || void 0
105
- },
106
- logLevel: process.env[`${prefix}LOG_LEVEL`] !== null && process.env[`${prefix}LOG_LEVEL`] !== void 0 ? process.env[`${prefix}LOG_LEVEL`] && Number.isSafeInteger(
107
- Number.parseInt(process.env[`${prefix}LOG_LEVEL`])
108
- ) ? getLogLevelLabel(
109
- Number.parseInt(process.env[`${prefix}LOG_LEVEL`])
110
- ) : process.env[`${prefix}LOG_LEVEL`] : void 0,
111
- skipConfigLogging: process.env[`${prefix}SKIP_CONFIG_LOGGING`] !== void 0 ? Boolean(process.env[`${prefix}SKIP_CONFIG_LOGGING`]) : void 0
112
- };
113
- const themeNames = Object.keys(process.env).filter(
114
- (envKey) => envKey.startsWith(`${prefix}COLOR_`) && COLOR_KEYS.every(
115
- (colorKey) => !envKey.startsWith(`${prefix}COLOR_LIGHT_${colorKey}`) && !envKey.startsWith(`${prefix}COLOR_DARK_${colorKey}`)
116
- )
117
- );
118
- config.colors = themeNames.length > 0 ? themeNames.reduce(
119
- (ret, themeName) => {
120
- ret[themeName] = getThemeColorsEnv(prefix, themeName);
121
- return ret;
122
- },
123
- {}
124
- ) : getThemeColorsEnv(prefix);
125
- if (config.docs === STORM_DEFAULT_DOCS) {
126
- if (config.homepage === STORM_DEFAULT_HOMEPAGE) {
127
- config.docs = `${STORM_DEFAULT_HOMEPAGE}/projects/${config.name}/docs`;
128
- } else {
129
- config.docs = `${config.homepage}/docs`;
130
- }
131
- }
132
- if (config.licensing === STORM_DEFAULT_LICENSING) {
133
- if (config.homepage === STORM_DEFAULT_HOMEPAGE) {
134
- config.licensing = `${STORM_DEFAULT_HOMEPAGE}/projects/${config.name}/licensing`;
135
- } else {
136
- config.licensing = `${config.homepage}/docs`;
137
- }
138
- }
139
- const serializedConfig = process.env[`${prefix}WORKSPACE_CONFIG`];
140
- if (serializedConfig) {
141
- const parsed = JSON.parse(serializedConfig);
142
- config = {
143
- ...config,
144
- ...parsed,
145
- colors: { ...config.colors, ...parsed.colors },
146
- extensions: { ...config.extensions, ...parsed.extensions }
147
- };
148
- }
149
- return config;
150
- };
151
- var getThemeColorsEnv = (prefix, theme) => {
152
- const themeName = `COLOR_${theme && theme !== "base" ? `${theme}_` : ""}`.toUpperCase();
153
- return process.env[`${prefix}${themeName}LIGHT_BRAND`] || process.env[`${prefix}${themeName}DARK_BRAND`] ? getMultiThemeColorsEnv(prefix + themeName) : getSingleThemeColorsEnv(prefix + themeName);
154
- };
155
- var getSingleThemeColorsEnv = (prefix) => {
156
- const gradient = [];
157
- if (process.env[`${prefix}GRADIENT_START`] && process.env[`${prefix}GRADIENT_END`]) {
158
- gradient.push(
159
- process.env[`${prefix}GRADIENT_START`],
160
- process.env[`${prefix}GRADIENT_END`]
161
- );
162
- } else if (process.env[`${prefix}GRADIENT_0`] || process.env[`${prefix}GRADIENT_1`]) {
163
- let index = process.env[`${prefix}GRADIENT_0`] ? 0 : 1;
164
- while (process.env[`${prefix}GRADIENT_${index}`]) {
165
- gradient.push(process.env[`${prefix}GRADIENT_${index}`]);
166
- index++;
167
- }
168
- }
169
- return {
170
- dark: process.env[`${prefix}DARK`],
171
- light: process.env[`${prefix}LIGHT`],
172
- brand: process.env[`${prefix}BRAND`],
173
- alternate: process.env[`${prefix}ALTERNATE`],
174
- accent: process.env[`${prefix}ACCENT`],
175
- link: process.env[`${prefix}LINK`],
176
- discovery: process.env[`${prefix}DISCOVERY`],
177
- success: process.env[`${prefix}SUCCESS`],
178
- info: process.env[`${prefix}INFO`],
179
- debug: process.env[`${prefix}DEBUG`],
180
- warning: process.env[`${prefix}WARNING`],
181
- danger: process.env[`${prefix}DANGER`],
182
- fatal: process.env[`${prefix}FATAL`],
183
- performance: process.env[`${prefix}PERFORMANCE`],
184
- positive: process.env[`${prefix}POSITIVE`],
185
- negative: process.env[`${prefix}NEGATIVE`],
186
- gradient
187
- };
188
- };
189
- var getMultiThemeColorsEnv = (prefix) => {
190
- return {
191
- light: getBaseThemeColorsEnv(`${prefix}_LIGHT_`),
192
- dark: getBaseThemeColorsEnv(`${prefix}_DARK_`)
193
- };
194
- };
195
- var getBaseThemeColorsEnv = (prefix) => {
196
- const gradient = [];
197
- if (process.env[`${prefix}GRADIENT_START`] && process.env[`${prefix}GRADIENT_END`]) {
198
- gradient.push(
199
- process.env[`${prefix}GRADIENT_START`],
200
- process.env[`${prefix}GRADIENT_END`]
201
- );
202
- } else if (process.env[`${prefix}GRADIENT_0`] || process.env[`${prefix}GRADIENT_1`]) {
203
- let index = process.env[`${prefix}GRADIENT_0`] ? 0 : 1;
204
- while (process.env[`${prefix}GRADIENT_${index}`]) {
205
- gradient.push(process.env[`${prefix}GRADIENT_${index}`]);
206
- index++;
207
- }
208
- }
209
- return {
210
- foreground: process.env[`${prefix}FOREGROUND`],
211
- background: process.env[`${prefix}BACKGROUND`],
212
- brand: process.env[`${prefix}BRAND`],
213
- alternate: process.env[`${prefix}ALTERNATE`],
214
- accent: process.env[`${prefix}ACCENT`],
215
- link: process.env[`${prefix}LINK`],
216
- discovery: process.env[`${prefix}DISCOVERY`],
217
- success: process.env[`${prefix}SUCCESS`],
218
- info: process.env[`${prefix}INFO`],
219
- debug: process.env[`${prefix}DEBUG`],
220
- warning: process.env[`${prefix}WARNING`],
221
- danger: process.env[`${prefix}DANGER`],
222
- fatal: process.env[`${prefix}FATAL`],
223
- performance: process.env[`${prefix}PERFORMANCE`],
224
- positive: process.env[`${prefix}POSITIVE`],
225
- negative: process.env[`${prefix}NEGATIVE`],
226
- gradient
227
- };
228
- };
229
-
230
- export {
231
- getExtensionEnv,
232
- getConfigEnv
233
- };
@@ -1,38 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
-
3
- var _chunkBDATZ3UBcjs = require('./chunk-BDATZ3UB.cjs');
4
-
5
- // src/utilities/file-path-utils.ts
6
- var removeExtension = (filePath) => {
7
- const result = !filePath || (_optionalChain([filePath, 'optionalAccess', _ => _.match, 'call', _2 => _2(/./g)]) || []).length <= 1 ? "." : filePath.lastIndexOf(".") ? filePath.substring(0, filePath.lastIndexOf(".")) : filePath;
8
- if (result.startsWith("./")) {
9
- return result.substring(2);
10
- }
11
- if (result.startsWith(".") || result.startsWith("/")) {
12
- return result.substring(1);
13
- }
14
- return result;
15
- };
16
- function findFileName(filePath, { requireExtension, withExtension } = {}) {
17
- const result = _nullishCoalesce(_optionalChain([_chunkBDATZ3UBcjs.normalizeWindowsPath.call(void 0, filePath), 'optionalAccess', _3 => _3.split, 'call', _4 => _4(_optionalChain([filePath, 'optionalAccess', _5 => _5.includes, 'call', _6 => _6("\\")]) ? "\\" : "/"), 'optionalAccess', _7 => _7.pop, 'call', _8 => _8()]), () => ( ""));
18
- if (requireExtension === true && !result.includes(".")) {
19
- return "";
20
- }
21
- if (withExtension === false && result.includes(".")) {
22
- return result.split(".").slice(-1).join(".") || "";
23
- }
24
- return result;
25
- }
26
- function findFilePath(filePath) {
27
- const normalizedPath = _chunkBDATZ3UBcjs.normalizeWindowsPath.call(void 0, filePath);
28
- return normalizedPath.replace(
29
- findFileName(normalizedPath, { requireExtension: true }),
30
- ""
31
- );
32
- }
33
-
34
-
35
-
36
-
37
-
38
- exports.removeExtension = removeExtension; exports.findFileName = findFileName; exports.findFilePath = findFilePath;
@@ -1 +0,0 @@
1
- "use strict";
@@ -1,165 +0,0 @@
1
- import {
2
- getConfigFile
3
- } from "./chunk-5C7PIENF.js";
4
- import {
5
- applyDefaultConfig,
6
- getPackageJsonConfig
7
- } from "./chunk-MQG74XF7.js";
8
- import {
9
- findWorkspaceRoot
10
- } from "./chunk-SO3FWVXC.js";
11
- import {
12
- formatLogMessage,
13
- writeTrace,
14
- writeWarning
15
- } from "./chunk-D3FRXXDE.js";
16
- import {
17
- setConfigEnv
18
- } from "./chunk-FJNXECWU.js";
19
- import {
20
- getConfigEnv,
21
- getExtensionEnv
22
- } from "./chunk-2RLMTBVZ.js";
23
- import {
24
- joinPaths
25
- } from "./chunk-V3GMJ4TX.js";
26
-
27
- // src/create-storm-config.ts
28
- import { workspaceConfigSchema } from "@storm-software/config/schema";
29
- import defu from "defu";
30
- import { existsSync } from "node:fs";
31
- var _extension_cache = /* @__PURE__ */ new WeakMap();
32
- var _static_cache = void 0;
33
- var createStormWorkspaceConfig = async (extensionName, schema, workspaceRoot, skipLogs = false, useDefault = true) => {
34
- let result;
35
- if (!_static_cache?.data || !_static_cache?.timestamp || _static_cache.timestamp < Date.now() - 8e3) {
36
- let _workspaceRoot = workspaceRoot;
37
- if (!_workspaceRoot) {
38
- _workspaceRoot = findWorkspaceRoot();
39
- }
40
- const configEnv = getConfigEnv();
41
- const configFile = await getConfigFile(_workspaceRoot);
42
- if (!configFile) {
43
- if (!skipLogs) {
44
- writeWarning(
45
- "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",
46
- { logLevel: "all" }
47
- );
48
- }
49
- if (useDefault === false) {
50
- return void 0;
51
- }
52
- }
53
- const defaultConfig = await getPackageJsonConfig(_workspaceRoot);
54
- const configInput = defu(
55
- configEnv,
56
- configFile,
57
- defaultConfig
58
- );
59
- if (!configInput.variant) {
60
- configInput.variant = existsSync(joinPaths(_workspaceRoot, "nx.json")) || existsSync(joinPaths(_workspaceRoot, ".nx")) || existsSync(joinPaths(_workspaceRoot, "lerna.json")) || existsSync(joinPaths(_workspaceRoot, "turbo.json")) ? "monorepo" : "minimal";
61
- }
62
- try {
63
- const parseResult = await Promise.resolve(
64
- workspaceConfigSchema._zod.parse(
65
- { value: configInput, issues: [] },
66
- { async: true }
67
- )
68
- );
69
- result = applyDefaultConfig(parseResult.value);
70
- result.workspaceRoot ??= _workspaceRoot;
71
- } catch (error) {
72
- throw new Error(
73
- `Failed to parse Storm Workspace configuration${error?.message ? `: ${error.message}` : ""}
74
-
75
- Please ensure your configuration file is valid JSON and matches the expected schema. The current workspace configuration input is: ${formatLogMessage(
76
- configInput
77
- )}`,
78
- {
79
- cause: error
80
- }
81
- );
82
- }
83
- } else {
84
- result = _static_cache.data;
85
- }
86
- if (schema && extensionName) {
87
- result.extensions = {
88
- ...result.extensions,
89
- [extensionName]: createConfigExtension(extensionName, schema)
90
- };
91
- }
92
- _static_cache = {
93
- timestamp: Date.now(),
94
- data: result
95
- };
96
- return result;
97
- };
98
- var createConfigExtension = (extensionName, schema) => {
99
- const extension_cache_key = { extensionName };
100
- if (_extension_cache.has(extension_cache_key)) {
101
- return _extension_cache.get(extension_cache_key);
102
- }
103
- let extension = getExtensionEnv(extensionName);
104
- if (schema) {
105
- extension = schema.parse(extension);
106
- }
107
- _extension_cache.set(extension_cache_key, extension);
108
- return extension;
109
- };
110
- var loadStormWorkspaceConfig = async (workspaceRoot, skipLogs = false) => {
111
- const config = await createStormWorkspaceConfig(
112
- void 0,
113
- void 0,
114
- workspaceRoot,
115
- skipLogs,
116
- true
117
- );
118
- setConfigEnv(config);
119
- if (!skipLogs && !config.skipConfigLogging) {
120
- writeTrace(
121
- `\u2699\uFE0F Using Storm Workspace configuration:
122
- ${formatLogMessage(config)}`,
123
- config
124
- );
125
- }
126
- return config;
127
- };
128
- var tryLoadStormWorkspaceConfig = async (workspaceRoot, skipLogs = true, useDefault = false) => {
129
- try {
130
- const config = await createStormWorkspaceConfig(
131
- void 0,
132
- void 0,
133
- workspaceRoot,
134
- skipLogs,
135
- useDefault
136
- );
137
- if (!config) {
138
- return void 0;
139
- }
140
- setConfigEnv(config);
141
- if (!skipLogs && !config.skipConfigLogging) {
142
- writeTrace(
143
- `\u2699\uFE0F Using Storm Workspace configuration:
144
- ${formatLogMessage(config)}`,
145
- config
146
- );
147
- }
148
- return config;
149
- } catch (error) {
150
- if (!skipLogs) {
151
- writeWarning(
152
- `\u26A0\uFE0F Failed to load Storm Workspace configuration: ${error}`,
153
- { logLevel: "all" }
154
- );
155
- }
156
- return void 0;
157
- }
158
- };
159
-
160
- export {
161
- createStormWorkspaceConfig,
162
- createConfigExtension,
163
- loadStormWorkspaceConfig,
164
- tryLoadStormWorkspaceConfig
165
- };
@@ -1,92 +0,0 @@
1
- import {
2
- findWorkspaceRoot
3
- } from "./chunk-SO3FWVXC.js";
4
- import {
5
- writeTrace
6
- } from "./chunk-D3FRXXDE.js";
7
- import {
8
- joinPaths
9
- } from "./chunk-V3GMJ4TX.js";
10
-
11
- // src/config-file/get-config-file.ts
12
- import { loadConfig } from "c12";
13
- import defu from "defu";
14
- var getConfigFileByName = async (fileName, filePath, options = {}) => {
15
- const workspacePath = filePath || findWorkspaceRoot(filePath);
16
- const configs = await Promise.all([
17
- loadConfig({
18
- cwd: workspacePath,
19
- packageJson: true,
20
- name: fileName,
21
- envName: fileName?.toUpperCase(),
22
- jitiOptions: {
23
- debug: false,
24
- fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : joinPaths(
25
- process.env.STORM_CACHE_DIR || "node_modules/.cache/storm",
26
- "jiti"
27
- )
28
- },
29
- ...options
30
- }),
31
- loadConfig({
32
- cwd: workspacePath,
33
- packageJson: true,
34
- name: fileName,
35
- envName: fileName?.toUpperCase(),
36
- jitiOptions: {
37
- debug: false,
38
- fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : joinPaths(
39
- process.env.STORM_CACHE_DIR || "node_modules/.cache/storm",
40
- "jiti"
41
- )
42
- },
43
- configFile: fileName,
44
- ...options
45
- })
46
- ]);
47
- return defu(configs[0] ?? {}, configs[1] ?? {});
48
- };
49
- var getConfigFile = async (filePath, additionalFileNames = []) => {
50
- const workspacePath = filePath ? filePath : findWorkspaceRoot(filePath);
51
- const result = await getConfigFileByName("storm-workspace", workspacePath);
52
- let config = result.config;
53
- const configFile = result.configFile;
54
- if (config && configFile && Object.keys(config).length > 0 && !config.skipConfigLogging) {
55
- writeTrace(
56
- `Found Storm configuration file "${configFile.includes(`${workspacePath}/`) ? configFile.replace(`${workspacePath}/`, "") : configFile}" at "${workspacePath}"`,
57
- {
58
- logLevel: "all"
59
- }
60
- );
61
- }
62
- if (additionalFileNames && additionalFileNames.length > 0) {
63
- const results = await Promise.all(
64
- additionalFileNames.map(
65
- (fileName) => getConfigFileByName(fileName, workspacePath)
66
- )
67
- );
68
- for (const result2 of results) {
69
- if (result2?.config && result2?.configFile && Object.keys(result2.config).length > 0) {
70
- if (!config.skipConfigLogging && !result2.config.skipConfigLogging) {
71
- writeTrace(
72
- `Found alternative configuration file "${result2.configFile.includes(`${workspacePath}/`) ? result2.configFile.replace(`${workspacePath}/`, "") : result2.configFile}" at "${workspacePath}"`,
73
- {
74
- logLevel: "all"
75
- }
76
- );
77
- }
78
- config = defu(result2.config ?? {}, config ?? {});
79
- }
80
- }
81
- }
82
- if (!config || Object.keys(config).length === 0) {
83
- return void 0;
84
- }
85
- config.configFile = configFile;
86
- return config;
87
- };
88
-
89
- export {
90
- getConfigFileByName,
91
- getConfigFile
92
- };