@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,25 +0,0 @@
1
- // src/utilities/find-up.ts
2
- import { existsSync } from "node:fs";
3
- import { join } from "node:path";
4
- var MAX_PATH_SEARCH_DEPTH = 30;
5
- var depth = 0;
6
- function findFolderUp(startPath, endFileNames = [], endDirectoryNames = []) {
7
- const _startPath = startPath ?? process.cwd();
8
- if (endDirectoryNames.some(
9
- (endDirName) => existsSync(join(_startPath, endDirName))
10
- )) {
11
- return _startPath;
12
- }
13
- if (endFileNames.some((endFileName) => existsSync(join(_startPath, endFileName)))) {
14
- return _startPath;
15
- }
16
- if (_startPath !== "/" && depth++ < MAX_PATH_SEARCH_DEPTH) {
17
- const parent = join(_startPath, "..");
18
- return findFolderUp(parent, endFileNames, endDirectoryNames);
19
- }
20
- return void 0;
21
- }
22
-
23
- export {
24
- findFolderUp
25
- };
@@ -1,56 +0,0 @@
1
- import {
2
- writeError,
3
- writeFatal,
4
- writeSuccess,
5
- writeTrace
6
- } from "./chunk-D3FRXXDE.js";
7
-
8
- // src/utilities/process-handler.ts
9
- var exitWithError = (config) => {
10
- writeFatal("Exiting script with an error status...", config);
11
- process.exit(1);
12
- };
13
- var exitWithSuccess = (config) => {
14
- writeSuccess("Script completed successfully. Exiting...", config);
15
- process.exit(0);
16
- };
17
- var handleProcess = (config) => {
18
- writeTrace(
19
- `Using the following arguments to process the script: ${process.argv.join(", ")}`,
20
- config
21
- );
22
- process.on("unhandledRejection", (error) => {
23
- writeError(
24
- `An Unhandled Rejection occurred while running the program: ${error && typeof error === "object" && "message" in error && error?.message ? error.message : typeof error === "string" ? error : "Unknown error"}
25
- Stacktrace: ${error && typeof error === "object" && "stack" in error && error?.stack ? error.stack : ""}`,
26
- config
27
- );
28
- exitWithError(config);
29
- });
30
- process.on("uncaughtException", (error) => {
31
- writeError(
32
- `An Uncaught Exception occurred while running the program: ${error && typeof error === "object" && "message" in error && error?.message ? error.message : typeof error === "string" ? error : "Unknown error"}
33
- Stacktrace: ${error && typeof error === "object" && "stack" in error && error?.stack ? error.stack : ""}`,
34
- config
35
- );
36
- exitWithError(config);
37
- });
38
- process.on("SIGTERM", (signal) => {
39
- writeError(`The program terminated with signal code: ${signal}`, config);
40
- exitWithError(config);
41
- });
42
- process.on("SIGINT", (signal) => {
43
- writeError(`The program terminated with signal code: ${signal}`, config);
44
- exitWithError(config);
45
- });
46
- process.on("SIGHUP", (signal) => {
47
- writeError(`The program terminated with signal code: ${signal}`, config);
48
- exitWithError(config);
49
- });
50
- };
51
-
52
- export {
53
- exitWithError,
54
- exitWithSuccess,
55
- handleProcess
56
- };
@@ -1,165 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 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 _chunkMSAQEGBKcjs = require('./chunk-MSAQEGBK.cjs');
4
-
5
-
6
-
7
- var _chunkT7YISGRScjs = require('./chunk-T7YISGRS.cjs');
8
-
9
-
10
- var _chunkIWQRXQ4Ncjs = require('./chunk-IWQRXQ4N.cjs');
11
-
12
-
13
-
14
-
15
- var _chunkTZZRLM5Jcjs = require('./chunk-TZZRLM5J.cjs');
16
-
17
-
18
- var _chunkBZRTSWH4cjs = require('./chunk-BZRTSWH4.cjs');
19
-
20
-
21
-
22
- var _chunkUJ77IBHDcjs = require('./chunk-UJ77IBHD.cjs');
23
-
24
-
25
- var _chunkBDATZ3UBcjs = require('./chunk-BDATZ3UB.cjs');
26
-
27
- // src/create-storm-config.ts
28
- var _schema = require('@storm-software/config/schema');
29
- var _defu = require('defu'); var _defu2 = _interopRequireDefault(_defu);
30
- var _fs = require('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 (!_optionalChain([_static_cache, 'optionalAccess', _ => _.data]) || !_optionalChain([_static_cache, 'optionalAccess', _2 => _2.timestamp]) || _static_cache.timestamp < Date.now() - 8e3) {
36
- let _workspaceRoot = workspaceRoot;
37
- if (!_workspaceRoot) {
38
- _workspaceRoot = _chunkIWQRXQ4Ncjs.findWorkspaceRoot.call(void 0, );
39
- }
40
- const configEnv = _chunkUJ77IBHDcjs.getConfigEnv.call(void 0, );
41
- const configFile = await _chunkMSAQEGBKcjs.getConfigFile.call(void 0, _workspaceRoot);
42
- if (!configFile) {
43
- if (!skipLogs) {
44
- _chunkTZZRLM5Jcjs.writeWarning.call(void 0,
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 _chunkT7YISGRScjs.getPackageJsonConfig.call(void 0, _workspaceRoot);
54
- const configInput = _defu2.default.call(void 0,
55
- configEnv,
56
- configFile,
57
- defaultConfig
58
- );
59
- if (!configInput.variant) {
60
- configInput.variant = _fs.existsSync.call(void 0, _chunkBDATZ3UBcjs.joinPaths.call(void 0, _workspaceRoot, "nx.json")) || _fs.existsSync.call(void 0, _chunkBDATZ3UBcjs.joinPaths.call(void 0, _workspaceRoot, ".nx")) || _fs.existsSync.call(void 0, _chunkBDATZ3UBcjs.joinPaths.call(void 0, _workspaceRoot, "lerna.json")) || _fs.existsSync.call(void 0, _chunkBDATZ3UBcjs.joinPaths.call(void 0, _workspaceRoot, "turbo.json")) ? "monorepo" : "minimal";
61
- }
62
- try {
63
- const parseResult = await Promise.resolve(
64
- _schema.workspaceConfigSchema._zod.parse(
65
- { value: configInput, issues: [] },
66
- { async: true }
67
- )
68
- );
69
- result = _chunkT7YISGRScjs.applyDefaultConfig.call(void 0, parseResult.value);
70
- result.workspaceRoot ??= _workspaceRoot;
71
- } catch (error) {
72
- throw new Error(
73
- `Failed to parse Storm Workspace configuration${_optionalChain([error, 'optionalAccess', _3 => _3.message]) ? `: ${error.message}` : ""}
74
-
75
- Please ensure your configuration file is valid JSON and matches the expected schema. The current workspace configuration input is: ${_chunkTZZRLM5Jcjs.formatLogMessage.call(void 0,
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 = _chunkUJ77IBHDcjs.getExtensionEnv.call(void 0, 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
- _chunkBZRTSWH4cjs.setConfigEnv.call(void 0, config);
119
- if (!skipLogs && !config.skipConfigLogging) {
120
- _chunkTZZRLM5Jcjs.writeTrace.call(void 0,
121
- `\u2699\uFE0F Using Storm Workspace configuration:
122
- ${_chunkTZZRLM5Jcjs.formatLogMessage.call(void 0, 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
- _chunkBZRTSWH4cjs.setConfigEnv.call(void 0, config);
141
- if (!skipLogs && !config.skipConfigLogging) {
142
- _chunkTZZRLM5Jcjs.writeTrace.call(void 0,
143
- `\u2699\uFE0F Using Storm Workspace configuration:
144
- ${_chunkTZZRLM5Jcjs.formatLogMessage.call(void 0, config)}`,
145
- config
146
- );
147
- }
148
- return config;
149
- } catch (error) {
150
- if (!skipLogs) {
151
- _chunkTZZRLM5Jcjs.writeWarning.call(void 0,
152
- `\u26A0\uFE0F Failed to load Storm Workspace configuration: ${error}`,
153
- { logLevel: "all" }
154
- );
155
- }
156
- return void 0;
157
- }
158
- };
159
-
160
-
161
-
162
-
163
-
164
-
165
- exports.createStormWorkspaceConfig = createStormWorkspaceConfig; exports.createConfigExtension = createConfigExtension; exports.loadStormWorkspaceConfig = loadStormWorkspaceConfig; exports.tryLoadStormWorkspaceConfig = tryLoadStormWorkspaceConfig;
@@ -1,84 +0,0 @@
1
- import {
2
- findFolderUp
3
- } from "./chunk-RUKM6FCF.js";
4
- import {
5
- correctPaths
6
- } from "./chunk-V3GMJ4TX.js";
7
-
8
- // src/utilities/find-workspace-root.ts
9
- var rootFiles = [
10
- "storm-workspace.json",
11
- "storm-workspace.yaml",
12
- "storm-workspace.yml",
13
- "storm-workspace.js",
14
- "storm-workspace.ts",
15
- ".storm-workspace.json",
16
- ".storm-workspace.yaml",
17
- ".storm-workspace.yml",
18
- ".storm-workspace.js",
19
- ".storm-workspace.ts",
20
- "lerna.json",
21
- "nx.json",
22
- "turbo.json",
23
- "npm-workspace.json",
24
- "yarn-workspace.json",
25
- "pnpm-workspace.json",
26
- "npm-workspace.yaml",
27
- "yarn-workspace.yaml",
28
- "pnpm-workspace.yaml",
29
- "npm-workspace.yml",
30
- "yarn-workspace.yml",
31
- "pnpm-workspace.yml",
32
- "npm-lock.json",
33
- "yarn-lock.json",
34
- "pnpm-lock.json",
35
- "npm-lock.yaml",
36
- "yarn-lock.yaml",
37
- "pnpm-lock.yaml",
38
- "npm-lock.yml",
39
- "yarn-lock.yml",
40
- "pnpm-lock.yml",
41
- "bun.lockb",
42
- "bun.lock",
43
- "bunfig.toml"
44
- ];
45
- var rootDirectories = [
46
- ".storm-workspace",
47
- ".nx",
48
- ".git",
49
- ".github",
50
- ".vscode",
51
- ".verdaccio"
52
- ];
53
- function findWorkspaceRootSafe(pathInsideMonorepo) {
54
- if (process.env.STORM_WORKSPACE_ROOT || process.env.NX_WORKSPACE_ROOT_PATH) {
55
- return correctPaths(
56
- process.env.STORM_WORKSPACE_ROOT ?? process.env.NX_WORKSPACE_ROOT_PATH
57
- );
58
- }
59
- return correctPaths(
60
- findFolderUp(
61
- pathInsideMonorepo ?? process.cwd(),
62
- rootFiles,
63
- rootDirectories
64
- )
65
- );
66
- }
67
- function findWorkspaceRoot(pathInsideMonorepo) {
68
- const result = findWorkspaceRootSafe(pathInsideMonorepo);
69
- if (!result) {
70
- throw new Error(
71
- `Cannot find workspace root upwards from known path. Files search list includes:
72
- ${rootFiles.join(
73
- "\n"
74
- )}
75
- Path: ${pathInsideMonorepo ? pathInsideMonorepo : process.cwd()}`
76
- );
77
- }
78
- return result;
79
- }
80
-
81
- export {
82
- findWorkspaceRootSafe,
83
- findWorkspaceRoot
84
- };
@@ -1,70 +0,0 @@
1
- import {
2
- LogLevel,
3
- LogLevelLabel
4
- } from "./chunk-RALMUN5C.js";
5
-
6
- // src/logger/get-log-level.ts
7
- var getLogLevel = (label) => {
8
- switch (label) {
9
- case "all":
10
- return LogLevel.ALL;
11
- case "trace":
12
- return LogLevel.TRACE;
13
- case "debug":
14
- return LogLevel.DEBUG;
15
- case "performance":
16
- return LogLevel.PERFORMANCE;
17
- case "info":
18
- return LogLevel.INFO;
19
- case "warn":
20
- return LogLevel.WARN;
21
- case "error":
22
- return LogLevel.ERROR;
23
- case "fatal":
24
- return LogLevel.FATAL;
25
- case "silent":
26
- return LogLevel.SILENT;
27
- default:
28
- return LogLevel.INFO;
29
- }
30
- };
31
- var getLogLevelLabel = (logLevel = LogLevel.INFO) => {
32
- if (logLevel >= LogLevel.ALL) {
33
- return LogLevelLabel.ALL;
34
- }
35
- if (logLevel >= LogLevel.TRACE) {
36
- return LogLevelLabel.TRACE;
37
- }
38
- if (logLevel >= LogLevel.DEBUG) {
39
- return LogLevelLabel.DEBUG;
40
- }
41
- if (logLevel >= LogLevel.PERFORMANCE) {
42
- return LogLevelLabel.PERFORMANCE;
43
- }
44
- if (logLevel >= LogLevel.INFO) {
45
- return LogLevelLabel.INFO;
46
- }
47
- if (logLevel >= LogLevel.WARN) {
48
- return LogLevelLabel.WARN;
49
- }
50
- if (logLevel >= LogLevel.ERROR) {
51
- return LogLevelLabel.ERROR;
52
- }
53
- if (logLevel >= LogLevel.FATAL) {
54
- return LogLevelLabel.FATAL;
55
- }
56
- if (logLevel <= LogLevel.SILENT) {
57
- return LogLevelLabel.SILENT;
58
- }
59
- return LogLevelLabel.INFO;
60
- };
61
- var isVerbose = (label = LogLevelLabel.SILENT) => {
62
- const logLevel = typeof label === "string" ? getLogLevel(label) : label;
63
- return logLevel >= LogLevel.DEBUG;
64
- };
65
-
66
- export {
67
- getLogLevel,
68
- getLogLevelLabel,
69
- isVerbose
70
- };
@@ -1,102 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); 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
-
6
- var _chunkBDATZ3UBcjs = require('./chunk-BDATZ3UB.cjs');
7
-
8
- // src/utilities/get-default-config.ts
9
-
10
-
11
-
12
- var _config = require('@storm-software/config');
13
- var _fs = require('fs');
14
- var _promises = require('fs/promises');
15
- var _path = require('path');
16
- async function getPackageJsonConfig(root) {
17
- let license = _config.STORM_DEFAULT_LICENSE;
18
- let homepage = void 0;
19
- let support = void 0;
20
- let name = void 0;
21
- let namespace = void 0;
22
- let repository = void 0;
23
- const workspaceRoot = _chunkIWQRXQ4Ncjs.findWorkspaceRoot.call(void 0, root);
24
- if (_fs.existsSync.call(void 0, _path.join.call(void 0, workspaceRoot, "package.json"))) {
25
- const file = await _promises.readFile.call(void 0,
26
- _chunkBDATZ3UBcjs.joinPaths.call(void 0, workspaceRoot, "package.json"),
27
- "utf8"
28
- );
29
- if (file) {
30
- const packageJson = JSON.parse(file);
31
- if (packageJson.name) {
32
- name = packageJson.name;
33
- }
34
- if (packageJson.namespace) {
35
- namespace = packageJson.namespace;
36
- }
37
- if (packageJson.repository) {
38
- if (typeof packageJson.repository === "string") {
39
- repository = packageJson.repository;
40
- } else if (packageJson.repository.url) {
41
- repository = packageJson.repository.url;
42
- }
43
- }
44
- if (packageJson.license) {
45
- license = packageJson.license;
46
- }
47
- if (packageJson.homepage) {
48
- homepage = packageJson.homepage;
49
- }
50
- if (packageJson.bugs) {
51
- if (typeof packageJson.bugs === "string") {
52
- support = packageJson.bugs;
53
- } else if (packageJson.bugs.url) {
54
- support = packageJson.bugs.url;
55
- }
56
- }
57
- }
58
- }
59
- return {
60
- workspaceRoot,
61
- name,
62
- namespace,
63
- repository,
64
- license,
65
- homepage,
66
- support
67
- };
68
- }
69
- function applyDefaultConfig(config) {
70
- if (!config.support && config.contact) {
71
- config.support = config.contact;
72
- }
73
- if (!config.contact && config.support) {
74
- config.contact = config.support;
75
- }
76
- if (config.homepage) {
77
- if (!config.docs) {
78
- config.docs = `${config.homepage}/docs`;
79
- }
80
- if (!config.license) {
81
- config.license = `${config.homepage}/license`;
82
- }
83
- if (!config.support) {
84
- config.support = `${config.homepage}/support`;
85
- }
86
- if (!config.contact) {
87
- config.contact = `${config.homepage}/contact`;
88
- }
89
- if (!_optionalChain([config, 'access', _ => _.error, 'optionalAccess', _2 => _2.codesFile]) || !_optionalChain([config, 'optionalAccess', _3 => _3.error, 'optionalAccess', _4 => _4.url])) {
90
- config.error ??= { codesFile: _config.STORM_DEFAULT_ERROR_CODES_FILE };
91
- if (config.homepage) {
92
- config.error.url ??= `${config.homepage}/errors`;
93
- }
94
- }
95
- }
96
- return config;
97
- }
98
-
99
-
100
-
101
-
102
- exports.getPackageJsonConfig = getPackageJsonConfig; exports.applyDefaultConfig = applyDefaultConfig;