@storm-software/config-tools 1.173.0 → 1.173.2

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 (127) hide show
  1. package/README.md +4 -2
  2. package/bin/config.cjs +4 -2
  3. package/bin/config.js +4 -2
  4. package/dist/{chunk-TGDG6POD.cjs → chunk-3FETUQ3K.cjs} +2 -2
  5. package/dist/{chunk-ROLVAV5Z.cjs → chunk-3SACUIVX.cjs} +8 -8
  6. package/dist/{chunk-BMDGKEGP.cjs → chunk-4G5FBDI6.cjs} +9 -9
  7. package/dist/chunk-4PX5UVAN.cjs +65 -0
  8. package/dist/{chunk-62YJAX4N.js → chunk-6ZPXQNSV.js} +6 -6
  9. package/dist/{chunk-XT2XO7TR.js → chunk-73L7WNYI.js} +3 -3
  10. package/dist/{chunk-DX767CQS.cjs → chunk-7STXZ7BN.cjs} +33 -33
  11. package/dist/{chunk-YTUBIKWS.js → chunk-AFZV7JXZ.js} +4 -4
  12. package/dist/{chunk-JRKB77S5.js → chunk-AUCRLLQF.js} +1 -1
  13. package/dist/{chunk-7BVMJTE2.cjs → chunk-BKUK5DV7.cjs} +9 -9
  14. package/dist/{chunk-WT2BVWII.js → chunk-BTRJGTBW.js} +3 -3
  15. package/dist/chunk-BZLWPMXE.js +40 -0
  16. package/dist/chunk-CMR737AZ.js +138 -0
  17. package/dist/chunk-CQBV3A23.cjs +55 -0
  18. package/dist/chunk-CS5NQ3OG.cjs +40 -0
  19. package/dist/{chunk-U74E4EM6.js → chunk-DBAAIFJN.js} +1 -1
  20. package/dist/{chunk-FO5MOLUY.cjs → chunk-FTTZBFXG.cjs} +20 -20
  21. package/dist/chunk-HDYKVRNJ.js +40 -0
  22. package/dist/{chunk-IETV2DPL.js → chunk-HYJVQZYZ.js} +1 -1
  23. package/dist/{chunk-XPPM3PBH.js → chunk-JB3OUBHN.js} +3 -3
  24. package/dist/{chunk-OUYYXBZX.js → chunk-JCPJSRHW.js} +10 -10
  25. package/dist/chunk-JLIGJTMV.js +55 -0
  26. package/dist/{chunk-T4ZMKMEG.cjs → chunk-JMI7BRL7.cjs} +3 -3
  27. package/dist/{chunk-4XRV4CVP.js → chunk-K4CDYUQR.js} +1 -1
  28. package/dist/chunk-KEVN7E43.cjs +138 -0
  29. package/dist/{chunk-4PAEA5KV.cjs → chunk-KH5SONKW.cjs} +4 -4
  30. package/dist/{chunk-CPWR3CZZ.cjs → chunk-KYNO2VMS.cjs} +15 -15
  31. package/dist/{chunk-OJP4XIBV.js → chunk-LM2UMGYA.js} +2 -2
  32. package/dist/chunk-N5TOHWQY.cjs +92 -0
  33. package/dist/chunk-P7SO3C2J.js +92 -0
  34. package/dist/{chunk-VLWSWYG7.js → chunk-PTHGOJU6.js} +2 -2
  35. package/dist/{chunk-AQ2NOVJF.cjs → chunk-QLJYCKMD.cjs} +2 -2
  36. package/dist/{chunk-AH2DDCPN.cjs → chunk-S2BDGENQ.cjs} +11 -11
  37. package/dist/{chunk-XHJCRUWP.js → chunk-SBTNBIMS.js} +2 -2
  38. package/dist/{chunk-4KZ3BMNG.js → chunk-SHD7ZUSQ.js} +2 -2
  39. package/dist/chunk-SMVSQFZ3.js +158 -0
  40. package/dist/chunk-SQTATREP.js +47 -0
  41. package/dist/chunk-TTH3ECOM.cjs +40 -0
  42. package/dist/{chunk-AEZINHEA.cjs → chunk-U436743U.cjs} +5 -5
  43. package/dist/chunk-UBEBZYFH.cjs +40 -0
  44. package/dist/chunk-VAPTNFV3.cjs +47 -0
  45. package/dist/chunk-WBQ4VS7E.cjs +23 -0
  46. package/dist/{chunk-42TCRG4H.js → chunk-WYQYWPLE.js} +1 -1
  47. package/dist/chunk-XPQXNNGZ.cjs +158 -0
  48. package/dist/config-file/get-config-file.cjs +21 -21
  49. package/dist/config-file/get-config-file.js +20 -20
  50. package/dist/config-file/index.cjs +22 -22
  51. package/dist/config-file/index.js +21 -21
  52. package/dist/create-storm-config.cjs +29 -29
  53. package/dist/create-storm-config.js +23 -23
  54. package/dist/env/get-env.cjs +5 -5
  55. package/dist/env/get-env.js +4 -4
  56. package/dist/env/index.cjs +7 -7
  57. package/dist/env/index.js +6 -6
  58. package/dist/env/set-env.cjs +5 -5
  59. package/dist/env/set-env.js +4 -4
  60. package/dist/get-config.cjs +25 -25
  61. package/dist/get-config.js +24 -24
  62. package/dist/index.cjs +27 -27
  63. package/dist/index.js +26 -26
  64. package/dist/logger/chalk.cjs +2 -2
  65. package/dist/logger/chalk.js +1 -1
  66. package/dist/logger/console-icons.cjs +4 -4
  67. package/dist/logger/console-icons.js +3 -3
  68. package/dist/logger/console.cjs +12 -12
  69. package/dist/logger/console.js +11 -11
  70. package/dist/logger/create-logger.cjs +13 -13
  71. package/dist/logger/create-logger.js +12 -12
  72. package/dist/logger/format-timestamp.cjs +2 -2
  73. package/dist/logger/format-timestamp.js +1 -1
  74. package/dist/logger/get-log-level.cjs +3 -3
  75. package/dist/logger/get-log-level.js +2 -2
  76. package/dist/logger/index.cjs +14 -14
  77. package/dist/logger/index.js +13 -13
  78. package/dist/logger/is-unicode-supported.cjs +2 -2
  79. package/dist/logger/is-unicode-supported.js +1 -1
  80. package/dist/types.cjs +2 -2
  81. package/dist/types.js +1 -1
  82. package/dist/utilities/apply-workspace-tokens.cjs +5 -5
  83. package/dist/utilities/apply-workspace-tokens.js +4 -4
  84. package/dist/utilities/correct-paths.cjs +2 -2
  85. package/dist/utilities/correct-paths.js +1 -1
  86. package/dist/utilities/file-path-utils.cjs +3 -3
  87. package/dist/utilities/file-path-utils.js +2 -2
  88. package/dist/utilities/find-up.cjs +2 -2
  89. package/dist/utilities/find-up.js +1 -1
  90. package/dist/utilities/find-workspace-root.cjs +4 -4
  91. package/dist/utilities/find-workspace-root.js +3 -3
  92. package/dist/utilities/get-default-config.cjs +5 -5
  93. package/dist/utilities/get-default-config.js +4 -4
  94. package/dist/utilities/index.cjs +20 -20
  95. package/dist/utilities/index.js +19 -19
  96. package/dist/utilities/process-handler.cjs +13 -13
  97. package/dist/utilities/process-handler.js +12 -12
  98. package/dist/utilities/run.cjs +2 -2
  99. package/dist/utilities/run.js +1 -1
  100. package/dist/utilities/toml.cjs +15 -15
  101. package/dist/utilities/toml.js +14 -14
  102. package/package.json +5 -13
  103. package/dist/chunk-26LV7S6Z.cjs +0 -40
  104. package/dist/chunk-7BZWQZUV.cjs +0 -65
  105. package/dist/chunk-PSHJQ2NP.cjs +0 -23
  106. /package/dist/{chunk-3EVEDCXL.js → chunk-2AVLCXLT.js} +0 -0
  107. /package/dist/{chunk-6D6DEG6Z.cjs → chunk-65SWKEHV.cjs} +0 -0
  108. /package/dist/{chunk-RWBPUJIZ.js → chunk-6JBGUE4A.js} +0 -0
  109. /package/dist/{chunk-64DXC5WM.js → chunk-6RVIJKY3.js} +0 -0
  110. /package/dist/{chunk-FRR2ZRWD.js → chunk-7IMLZPZF.js} +0 -0
  111. /package/dist/{chunk-6DTRKFZD.cjs → chunk-7PV6L7I7.cjs} +0 -0
  112. /package/dist/{chunk-QNDF3RQL.cjs → chunk-BN6MEGGY.cjs} +0 -0
  113. /package/dist/{chunk-NS5PJ2RM.cjs → chunk-CTYIEJ7C.cjs} +0 -0
  114. /package/dist/{chunk-XEZGYUS2.js → chunk-CZ4IE2QN.js} +0 -0
  115. /package/dist/{chunk-ZGLOKOL3.cjs → chunk-DQT6QJRQ.cjs} +0 -0
  116. /package/dist/{chunk-PLLCZVZO.cjs → chunk-DTGT4OI3.cjs} +0 -0
  117. /package/dist/{chunk-R6A4VPC4.js → chunk-G2MK47WL.js} +0 -0
  118. /package/dist/{chunk-C5OTFOQB.cjs → chunk-IRCFHYKZ.cjs} +0 -0
  119. /package/dist/{chunk-E4R6RI5D.cjs → chunk-IWD6YQKX.cjs} +0 -0
  120. /package/dist/{chunk-GSK6EGCB.js → chunk-L6UNTUC4.js} +0 -0
  121. /package/dist/{chunk-4JREL2GQ.cjs → chunk-M3REM2FU.cjs} +0 -0
  122. /package/dist/{chunk-RKGXITNB.cjs → chunk-N3UX6L7X.cjs} +0 -0
  123. /package/dist/{chunk-KT6HSF26.cjs → chunk-NAT5PWY2.cjs} +0 -0
  124. /package/dist/{chunk-T3MUE32G.js → chunk-P2KJ6EZO.js} +0 -0
  125. /package/dist/{chunk-3QAWRU2B.js → chunk-POXTJ6GF.js} +0 -0
  126. /package/dist/{chunk-SABD7NYM.js → chunk-RRKB32OH.js} +0 -0
  127. /package/dist/{chunk-XIA6NF6N.js → chunk-WWUHEYYM.js} +0 -0
@@ -0,0 +1,138 @@
1
+ import {
2
+ setConfigEnv
3
+ } from "./chunk-JB3OUBHN.js";
4
+ import {
5
+ getConfigEnv,
6
+ getExtensionEnv
7
+ } from "./chunk-SBTNBIMS.js";
8
+ import {
9
+ getConfigFile
10
+ } from "./chunk-P7SO3C2J.js";
11
+ import {
12
+ formatLogMessage,
13
+ writeTrace,
14
+ writeWarning
15
+ } from "./chunk-JCPJSRHW.js";
16
+ import {
17
+ applyDefaultConfig,
18
+ getPackageJsonConfig
19
+ } from "./chunk-SHD7ZUSQ.js";
20
+ import {
21
+ findWorkspaceRoot
22
+ } from "./chunk-PTHGOJU6.js";
23
+
24
+ // src/create-storm-config.ts
25
+ import { stormWorkspaceConfigSchema } from "@storm-software/config/schema";
26
+ import defu from "defu";
27
+ var _extension_cache = /* @__PURE__ */ new WeakMap();
28
+ var _static_cache = void 0;
29
+ var createStormWorkspaceConfig = async (extensionName, schema, workspaceRoot, skipLogs = false, useDefault = true) => {
30
+ let result;
31
+ if (!_static_cache?.data || !_static_cache?.timestamp || _static_cache.timestamp < Date.now() - 8e3) {
32
+ let _workspaceRoot = workspaceRoot;
33
+ if (!_workspaceRoot) {
34
+ _workspaceRoot = findWorkspaceRoot();
35
+ }
36
+ const configEnv = getConfigEnv();
37
+ const configFile = await getConfigFile(_workspaceRoot);
38
+ if (!configFile) {
39
+ if (!skipLogs) {
40
+ writeWarning(
41
+ "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",
42
+ { logLevel: "all" }
43
+ );
44
+ }
45
+ if (useDefault === false) {
46
+ return void 0;
47
+ }
48
+ }
49
+ const defaultConfig = await getPackageJsonConfig(_workspaceRoot);
50
+ result = applyDefaultConfig(
51
+ await stormWorkspaceConfigSchema.parseAsync(
52
+ defu(configEnv, configFile, defaultConfig)
53
+ )
54
+ );
55
+ result.workspaceRoot ??= _workspaceRoot;
56
+ } else {
57
+ result = _static_cache.data;
58
+ }
59
+ if (schema && extensionName) {
60
+ result.extensions = {
61
+ ...result.extensions,
62
+ [extensionName]: createConfigExtension(extensionName, schema)
63
+ };
64
+ }
65
+ _static_cache = {
66
+ timestamp: Date.now(),
67
+ data: result
68
+ };
69
+ return result;
70
+ };
71
+ var createConfigExtension = (extensionName, schema) => {
72
+ const extension_cache_key = { extensionName };
73
+ if (_extension_cache.has(extension_cache_key)) {
74
+ return _extension_cache.get(extension_cache_key);
75
+ }
76
+ let extension = getExtensionEnv(extensionName);
77
+ if (schema) {
78
+ extension = schema.parse(extension);
79
+ }
80
+ _extension_cache.set(extension_cache_key, extension);
81
+ return extension;
82
+ };
83
+ var loadStormWorkspaceConfig = async (workspaceRoot, skipLogs = false) => {
84
+ const config = await createStormWorkspaceConfig(
85
+ void 0,
86
+ void 0,
87
+ workspaceRoot,
88
+ skipLogs,
89
+ true
90
+ );
91
+ setConfigEnv(config);
92
+ if (!skipLogs && !config.skipConfigLogging) {
93
+ writeTrace(
94
+ `\u2699\uFE0F Using Storm Workspace configuration:
95
+ ${formatLogMessage(config)}`,
96
+ config
97
+ );
98
+ }
99
+ return config;
100
+ };
101
+ var tryLoadStormWorkspaceConfig = async (workspaceRoot, skipLogs = true, useDefault = false) => {
102
+ try {
103
+ const config = await createStormWorkspaceConfig(
104
+ void 0,
105
+ void 0,
106
+ workspaceRoot,
107
+ skipLogs,
108
+ useDefault
109
+ );
110
+ if (!config) {
111
+ return void 0;
112
+ }
113
+ setConfigEnv(config);
114
+ if (!skipLogs && !config.skipConfigLogging) {
115
+ writeTrace(
116
+ `\u2699\uFE0F Using Storm Workspace configuration:
117
+ ${formatLogMessage(config)}`,
118
+ config
119
+ );
120
+ }
121
+ return config;
122
+ } catch (error) {
123
+ if (!skipLogs) {
124
+ writeWarning(
125
+ `\u26A0\uFE0F Failed to load Storm Workspace configuration: ${error}`,
126
+ { logLevel: "all" }
127
+ );
128
+ }
129
+ return void 0;
130
+ }
131
+ };
132
+
133
+ export {
134
+ createStormWorkspaceConfig,
135
+ createConfigExtension,
136
+ loadStormWorkspaceConfig,
137
+ tryLoadStormWorkspaceConfig
138
+ };
@@ -0,0 +1,55 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+
4
+
5
+
6
+ var _chunk7STXZ7BNcjs = require('./chunk-7STXZ7BN.cjs');
7
+
8
+ // src/utilities/process-handler.ts
9
+ var exitWithError = (config) => {
10
+ _chunk7STXZ7BNcjs.writeFatal.call(void 0, "Exiting script with an error status...", config);
11
+ process.exit(1);
12
+ };
13
+ var exitWithSuccess = (config) => {
14
+ _chunk7STXZ7BNcjs.writeSuccess.call(void 0, "Script completed successfully. Exiting...", config);
15
+ process.exit(0);
16
+ };
17
+ var handleProcess = (config) => {
18
+ _chunk7STXZ7BNcjs.writeTrace.call(void 0,
19
+ `Using the following arguments to process the script: ${process.argv.join(", ")}`,
20
+ config
21
+ );
22
+ process.on("unhandledRejection", (error) => {
23
+ _chunk7STXZ7BNcjs.writeError.call(void 0,
24
+ `An Unhandled Rejection occurred while running the program: ${error}`,
25
+ config
26
+ );
27
+ exitWithError(config);
28
+ });
29
+ process.on("uncaughtException", (error) => {
30
+ _chunk7STXZ7BNcjs.writeError.call(void 0,
31
+ `An Uncaught Exception occurred while running the program: ${error.message}
32
+ Stacktrace: ${error.stack}`,
33
+ config
34
+ );
35
+ exitWithError(config);
36
+ });
37
+ process.on("SIGTERM", (signal) => {
38
+ _chunk7STXZ7BNcjs.writeError.call(void 0, `The program terminated with signal code: ${signal}`, config);
39
+ exitWithError(config);
40
+ });
41
+ process.on("SIGINT", (signal) => {
42
+ _chunk7STXZ7BNcjs.writeError.call(void 0, `The program terminated with signal code: ${signal}`, config);
43
+ exitWithError(config);
44
+ });
45
+ process.on("SIGHUP", (signal) => {
46
+ _chunk7STXZ7BNcjs.writeError.call(void 0, `The program terminated with signal code: ${signal}`, config);
47
+ exitWithError(config);
48
+ });
49
+ };
50
+
51
+
52
+
53
+
54
+
55
+ exports.exitWithError = exitWithError; exports.exitWithSuccess = exitWithSuccess; exports.handleProcess = handleProcess;
@@ -0,0 +1,40 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2
+
3
+
4
+ var _chunk7STXZ7BNcjs = require('./chunk-7STXZ7BN.cjs');
5
+
6
+
7
+ var _chunkU436743Ucjs = require('./chunk-U436743U.cjs');
8
+
9
+
10
+ var _chunkIRCFHYKZcjs = require('./chunk-IRCFHYKZ.cjs');
11
+
12
+ // src/logger/create-logger.ts
13
+ var _chalk = require('chalk'); var _chalk2 = _interopRequireDefault(_chalk);
14
+ async function createLogger(config) {
15
+ const workspaceRoot = _chunkU436743Ucjs.findWorkspaceRoot.call(void 0, );
16
+ if (!workspaceRoot) {
17
+ throw new Error("Cannot find workspace root");
18
+ }
19
+ const writeFatal = _chunk7STXZ7BNcjs.getLogFn.call(void 0, _chunkIRCFHYKZcjs.LogLevel.FATAL, config, _chalk2.default);
20
+ const writeError = _chunk7STXZ7BNcjs.getLogFn.call(void 0, _chunkIRCFHYKZcjs.LogLevel.ERROR, config, _chalk2.default);
21
+ const writeWarning = _chunk7STXZ7BNcjs.getLogFn.call(void 0, _chunkIRCFHYKZcjs.LogLevel.WARN, config, _chalk2.default);
22
+ const writeInfo = _chunk7STXZ7BNcjs.getLogFn.call(void 0, _chunkIRCFHYKZcjs.LogLevel.INFO, config, _chalk2.default);
23
+ const writeSuccess = _chunk7STXZ7BNcjs.getLogFn.call(void 0, _chunkIRCFHYKZcjs.LogLevel.SUCCESS, config, _chalk2.default);
24
+ const writeDebug = _chunk7STXZ7BNcjs.getLogFn.call(void 0, _chunkIRCFHYKZcjs.LogLevel.DEBUG, config, _chalk2.default);
25
+ const writeTrace = _chunk7STXZ7BNcjs.getLogFn.call(void 0, _chunkIRCFHYKZcjs.LogLevel.DEBUG, config, _chalk2.default);
26
+ return {
27
+ fatal: writeFatal,
28
+ error: writeError,
29
+ warning: writeWarning,
30
+ info: writeInfo,
31
+ success: writeSuccess,
32
+ debug: writeDebug,
33
+ trace: writeTrace,
34
+ getStopwatch: _chunk7STXZ7BNcjs.getStopwatch
35
+ };
36
+ }
37
+
38
+
39
+
40
+ exports.createLogger = createLogger;
@@ -3,7 +3,7 @@ import {
3
3
  writeFatal,
4
4
  writeSuccess,
5
5
  writeTrace
6
- } from "./chunk-OUYYXBZX.js";
6
+ } from "./chunk-JCPJSRHW.js";
7
7
 
8
8
  // src/utilities/process-handler.ts
9
9
  var exitWithError = (config) => {
@@ -1,25 +1,25 @@
1
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
2
 
3
- var _chunkBMDGKEGPcjs = require('./chunk-BMDGKEGP.cjs');
3
+ var _chunkKYNO2VMScjs = require('./chunk-KYNO2VMS.cjs');
4
4
 
5
5
 
6
6
 
7
+ var _chunkS2BDGENQcjs = require('./chunk-S2BDGENQ.cjs');
7
8
 
8
- var _chunkDX767CQScjs = require('./chunk-DX767CQS.cjs');
9
9
 
10
+ var _chunk4G5FBDI6cjs = require('./chunk-4G5FBDI6.cjs');
10
11
 
11
12
 
12
- var _chunk4PAEA5KVcjs = require('./chunk-4PAEA5KV.cjs');
13
13
 
14
14
 
15
- var _chunkAEZINHEAcjs = require('./chunk-AEZINHEA.cjs');
15
+ var _chunk7STXZ7BNcjs = require('./chunk-7STXZ7BN.cjs');
16
16
 
17
17
 
18
- var _chunkCPWR3CZZcjs = require('./chunk-CPWR3CZZ.cjs');
19
18
 
19
+ var _chunkKH5SONKWcjs = require('./chunk-KH5SONKW.cjs');
20
20
 
21
21
 
22
- var _chunkAH2DDCPNcjs = require('./chunk-AH2DDCPN.cjs');
22
+ var _chunkU436743Ucjs = require('./chunk-U436743U.cjs');
23
23
 
24
24
  // src/create-storm-config.ts
25
25
  var _schema = require('@storm-software/config/schema');
@@ -31,13 +31,13 @@ var createStormWorkspaceConfig = async (extensionName, schema, workspaceRoot, sk
31
31
  if (!_optionalChain([_static_cache, 'optionalAccess', _ => _.data]) || !_optionalChain([_static_cache, 'optionalAccess', _2 => _2.timestamp]) || _static_cache.timestamp < Date.now() - 8e3) {
32
32
  let _workspaceRoot = workspaceRoot;
33
33
  if (!_workspaceRoot) {
34
- _workspaceRoot = _chunkAEZINHEAcjs.findWorkspaceRoot.call(void 0, );
34
+ _workspaceRoot = _chunkU436743Ucjs.findWorkspaceRoot.call(void 0, );
35
35
  }
36
- const configEnv = _chunkAH2DDCPNcjs.getConfigEnv.call(void 0, );
37
- const configFile = await _chunkBMDGKEGPcjs.getConfigFile.call(void 0, _workspaceRoot);
36
+ const configEnv = _chunkS2BDGENQcjs.getConfigEnv.call(void 0, );
37
+ const configFile = await _chunk4G5FBDI6cjs.getConfigFile.call(void 0, _workspaceRoot);
38
38
  if (!configFile) {
39
39
  if (!skipLogs) {
40
- _chunkDX767CQScjs.writeWarning.call(void 0,
40
+ _chunk7STXZ7BNcjs.writeWarning.call(void 0,
41
41
  "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",
42
42
  { logLevel: "all" }
43
43
  );
@@ -46,8 +46,8 @@ var createStormWorkspaceConfig = async (extensionName, schema, workspaceRoot, sk
46
46
  return void 0;
47
47
  }
48
48
  }
49
- const defaultConfig = await _chunk4PAEA5KVcjs.getPackageJsonConfig.call(void 0, _workspaceRoot);
50
- result = _chunk4PAEA5KVcjs.applyDefaultConfig.call(void 0,
49
+ const defaultConfig = await _chunkKH5SONKWcjs.getPackageJsonConfig.call(void 0, _workspaceRoot);
50
+ result = _chunkKH5SONKWcjs.applyDefaultConfig.call(void 0,
51
51
  await _schema.stormWorkspaceConfigSchema.parseAsync(
52
52
  _defu2.default.call(void 0, configEnv, configFile, defaultConfig)
53
53
  )
@@ -73,7 +73,7 @@ var createConfigExtension = (extensionName, schema) => {
73
73
  if (_extension_cache.has(extension_cache_key)) {
74
74
  return _extension_cache.get(extension_cache_key);
75
75
  }
76
- let extension = _chunkAH2DDCPNcjs.getExtensionEnv.call(void 0, extensionName);
76
+ let extension = _chunkS2BDGENQcjs.getExtensionEnv.call(void 0, extensionName);
77
77
  if (schema) {
78
78
  extension = schema.parse(extension);
79
79
  }
@@ -88,11 +88,11 @@ var loadStormWorkspaceConfig = async (workspaceRoot, skipLogs = false) => {
88
88
  skipLogs,
89
89
  true
90
90
  );
91
- _chunkCPWR3CZZcjs.setConfigEnv.call(void 0, config);
91
+ _chunkKYNO2VMScjs.setConfigEnv.call(void 0, config);
92
92
  if (!skipLogs && !config.skipConfigLogging) {
93
- _chunkDX767CQScjs.writeTrace.call(void 0,
93
+ _chunk7STXZ7BNcjs.writeTrace.call(void 0,
94
94
  `\u2699\uFE0F Using Storm Workspace configuration:
95
- ${_chunkDX767CQScjs.formatLogMessage.call(void 0, config)}`,
95
+ ${_chunk7STXZ7BNcjs.formatLogMessage.call(void 0, config)}`,
96
96
  config
97
97
  );
98
98
  }
@@ -110,18 +110,18 @@ var tryLoadStormWorkspaceConfig = async (workspaceRoot, skipLogs = true, useDefa
110
110
  if (!config) {
111
111
  return void 0;
112
112
  }
113
- _chunkCPWR3CZZcjs.setConfigEnv.call(void 0, config);
113
+ _chunkKYNO2VMScjs.setConfigEnv.call(void 0, config);
114
114
  if (!skipLogs && !config.skipConfigLogging) {
115
- _chunkDX767CQScjs.writeTrace.call(void 0,
115
+ _chunk7STXZ7BNcjs.writeTrace.call(void 0,
116
116
  `\u2699\uFE0F Using Storm Workspace configuration:
117
- ${_chunkDX767CQScjs.formatLogMessage.call(void 0, config)}`,
117
+ ${_chunk7STXZ7BNcjs.formatLogMessage.call(void 0, config)}`,
118
118
  config
119
119
  );
120
120
  }
121
121
  return config;
122
122
  } catch (error) {
123
123
  if (!skipLogs) {
124
- _chunkDX767CQScjs.writeWarning.call(void 0,
124
+ _chunk7STXZ7BNcjs.writeWarning.call(void 0,
125
125
  `\u26A0\uFE0F Failed to load Storm Workspace configuration: ${error}`,
126
126
  { logLevel: "all" }
127
127
  );
@@ -0,0 +1,40 @@
1
+ import {
2
+ loadStormWorkspaceConfig,
3
+ tryLoadStormWorkspaceConfig
4
+ } from "./chunk-6ZPXQNSV.js";
5
+ import {
6
+ findWorkspaceRoot
7
+ } from "./chunk-PTHGOJU6.js";
8
+
9
+ // src/get-config.ts
10
+ var getConfig = (workspaceRoot, skipLogs = false) => {
11
+ return loadStormWorkspaceConfig(workspaceRoot, skipLogs);
12
+ };
13
+ var 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
+ var tryGetWorkspaceConfig = async (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
+ };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  findWorkspaceRoot
3
- } from "./chunk-VLWSWYG7.js";
3
+ } from "./chunk-PTHGOJU6.js";
4
4
 
5
5
  // src/utilities/apply-workspace-tokens.ts
6
6
  var applyWorkspaceBaseTokens = async (option, tokenParams) => {
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  correctPaths
3
- } from "./chunk-FRR2ZRWD.js";
3
+ } from "./chunk-7IMLZPZF.js";
4
4
  import {
5
5
  getLogLevel
6
- } from "./chunk-4XRV4CVP.js";
6
+ } from "./chunk-K4CDYUQR.js";
7
7
  import {
8
8
  LogLevel
9
- } from "./chunk-3QAWRU2B.js";
9
+ } from "./chunk-POXTJ6GF.js";
10
10
 
11
11
  // src/env/set-env.ts
12
12
  var setExtensionEnv = (extensionName, extension) => {
@@ -1,22 +1,22 @@
1
1
  import {
2
2
  DEFAULT_COLOR_CONFIG
3
- } from "./chunk-4KZ3BMNG.js";
4
- import {
5
- getChalk
6
- } from "./chunk-T3MUE32G.js";
7
- import {
8
- CONSOLE_ICONS
9
- } from "./chunk-OJP4XIBV.js";
3
+ } from "./chunk-SHD7ZUSQ.js";
10
4
  import {
11
5
  formatTimestamp
12
- } from "./chunk-XEZGYUS2.js";
6
+ } from "./chunk-CZ4IE2QN.js";
13
7
  import {
14
8
  getLogLevel
15
- } from "./chunk-4XRV4CVP.js";
9
+ } from "./chunk-K4CDYUQR.js";
10
+ import {
11
+ getChalk
12
+ } from "./chunk-P2KJ6EZO.js";
13
+ import {
14
+ CONSOLE_ICONS
15
+ } from "./chunk-LM2UMGYA.js";
16
16
  import {
17
17
  LogLevel,
18
18
  LogLevelLabel
19
- } from "./chunk-3QAWRU2B.js";
19
+ } from "./chunk-POXTJ6GF.js";
20
20
 
21
21
  // src/logger/console.ts
22
22
  var getLogFn = (logLevel = LogLevel.INFO, config = {}, _chalk = getChalk()) => {
@@ -0,0 +1,55 @@
1
+ import {
2
+ writeError,
3
+ writeFatal,
4
+ writeSuccess,
5
+ writeTrace
6
+ } from "./chunk-SMVSQFZ3.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}`,
25
+ config
26
+ );
27
+ exitWithError(config);
28
+ });
29
+ process.on("uncaughtException", (error) => {
30
+ writeError(
31
+ `An Uncaught Exception occurred while running the program: ${error.message}
32
+ Stacktrace: ${error.stack}`,
33
+ config
34
+ );
35
+ exitWithError(config);
36
+ });
37
+ process.on("SIGTERM", (signal) => {
38
+ writeError(`The program terminated with signal code: ${signal}`, config);
39
+ exitWithError(config);
40
+ });
41
+ process.on("SIGINT", (signal) => {
42
+ writeError(`The program terminated with signal code: ${signal}`, config);
43
+ exitWithError(config);
44
+ });
45
+ process.on("SIGHUP", (signal) => {
46
+ writeError(`The program terminated with signal code: ${signal}`, config);
47
+ exitWithError(config);
48
+ });
49
+ };
50
+
51
+ export {
52
+ exitWithError,
53
+ exitWithSuccess,
54
+ handleProcess
55
+ };
@@ -1,6 +1,6 @@
1
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
2
 
3
- var _chunk4JREL2GQcjs = require('./chunk-4JREL2GQ.cjs');
3
+ var _chunkM3REM2FUcjs = require('./chunk-M3REM2FU.cjs');
4
4
 
5
5
  // src/utilities/file-path-utils.ts
6
6
  var removeExtension = (filePath) => {
@@ -14,7 +14,7 @@ var removeExtension = (filePath) => {
14
14
  return result;
15
15
  };
16
16
  function findFileName(filePath, { requireExtension, withExtension } = {}) {
17
- const result = _nullishCoalesce(_optionalChain([_chunk4JREL2GQcjs.normalizeWindowsPath.call(void 0, filePath), 'optionalAccess', _ => _.split, 'call', _2 => _2(_optionalChain([filePath, 'optionalAccess', _3 => _3.includes, 'call', _4 => _4("\\")]) ? "\\" : "/"), 'optionalAccess', _5 => _5.pop, 'call', _6 => _6()]), () => ( ""));
17
+ const result = _nullishCoalesce(_optionalChain([_chunkM3REM2FUcjs.normalizeWindowsPath.call(void 0, filePath), 'optionalAccess', _ => _.split, 'call', _2 => _2(_optionalChain([filePath, 'optionalAccess', _3 => _3.includes, 'call', _4 => _4("\\")]) ? "\\" : "/"), 'optionalAccess', _5 => _5.pop, 'call', _6 => _6()]), () => ( ""));
18
18
  if (requireExtension === true && !result.includes(".")) {
19
19
  return "";
20
20
  }
@@ -24,7 +24,7 @@ function findFileName(filePath, { requireExtension, withExtension } = {}) {
24
24
  return result;
25
25
  }
26
26
  function findFilePath(filePath) {
27
- const normalizedPath = _chunk4JREL2GQcjs.normalizeWindowsPath.call(void 0, filePath);
27
+ const normalizedPath = _chunkM3REM2FUcjs.normalizeWindowsPath.call(void 0, filePath);
28
28
  return normalizedPath.replace(
29
29
  findFileName(normalizedPath, { requireExtension: true }),
30
30
  ""
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  LogLevel,
3
3
  LogLevelLabel
4
- } from "./chunk-3QAWRU2B.js";
4
+ } from "./chunk-POXTJ6GF.js";
5
5
 
6
6
  // src/logger/get-log-level.ts
7
7
  var getLogLevel = (label) => {
@@ -0,0 +1,138 @@
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 _chunkN5TOHWQYcjs = require('./chunk-N5TOHWQY.cjs');
4
+
5
+
6
+
7
+
8
+ var _chunkXPQXNNGZcjs = require('./chunk-XPQXNNGZ.cjs');
9
+
10
+
11
+
12
+ var _chunkKH5SONKWcjs = require('./chunk-KH5SONKW.cjs');
13
+
14
+
15
+ var _chunkU436743Ucjs = require('./chunk-U436743U.cjs');
16
+
17
+
18
+ var _chunkKYNO2VMScjs = require('./chunk-KYNO2VMS.cjs');
19
+
20
+
21
+
22
+ var _chunkS2BDGENQcjs = require('./chunk-S2BDGENQ.cjs');
23
+
24
+ // src/create-storm-config.ts
25
+ var _schema = require('@storm-software/config/schema');
26
+ var _defu = require('defu'); var _defu2 = _interopRequireDefault(_defu);
27
+ var _extension_cache = /* @__PURE__ */ new WeakMap();
28
+ var _static_cache = void 0;
29
+ var createStormWorkspaceConfig = async (extensionName, schema, workspaceRoot, skipLogs = false, useDefault = true) => {
30
+ let result;
31
+ if (!_optionalChain([_static_cache, 'optionalAccess', _ => _.data]) || !_optionalChain([_static_cache, 'optionalAccess', _2 => _2.timestamp]) || _static_cache.timestamp < Date.now() - 8e3) {
32
+ let _workspaceRoot = workspaceRoot;
33
+ if (!_workspaceRoot) {
34
+ _workspaceRoot = _chunkU436743Ucjs.findWorkspaceRoot.call(void 0, );
35
+ }
36
+ const configEnv = _chunkS2BDGENQcjs.getConfigEnv.call(void 0, );
37
+ const configFile = await _chunkN5TOHWQYcjs.getConfigFile.call(void 0, _workspaceRoot);
38
+ if (!configFile) {
39
+ if (!skipLogs) {
40
+ _chunkXPQXNNGZcjs.writeWarning.call(void 0,
41
+ "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",
42
+ { logLevel: "all" }
43
+ );
44
+ }
45
+ if (useDefault === false) {
46
+ return void 0;
47
+ }
48
+ }
49
+ const defaultConfig = await _chunkKH5SONKWcjs.getPackageJsonConfig.call(void 0, _workspaceRoot);
50
+ result = _chunkKH5SONKWcjs.applyDefaultConfig.call(void 0,
51
+ await _schema.stormWorkspaceConfigSchema.parseAsync(
52
+ _defu2.default.call(void 0, configEnv, configFile, defaultConfig)
53
+ )
54
+ );
55
+ result.workspaceRoot ??= _workspaceRoot;
56
+ } else {
57
+ result = _static_cache.data;
58
+ }
59
+ if (schema && extensionName) {
60
+ result.extensions = {
61
+ ...result.extensions,
62
+ [extensionName]: createConfigExtension(extensionName, schema)
63
+ };
64
+ }
65
+ _static_cache = {
66
+ timestamp: Date.now(),
67
+ data: result
68
+ };
69
+ return result;
70
+ };
71
+ var createConfigExtension = (extensionName, schema) => {
72
+ const extension_cache_key = { extensionName };
73
+ if (_extension_cache.has(extension_cache_key)) {
74
+ return _extension_cache.get(extension_cache_key);
75
+ }
76
+ let extension = _chunkS2BDGENQcjs.getExtensionEnv.call(void 0, extensionName);
77
+ if (schema) {
78
+ extension = schema.parse(extension);
79
+ }
80
+ _extension_cache.set(extension_cache_key, extension);
81
+ return extension;
82
+ };
83
+ var loadStormWorkspaceConfig = async (workspaceRoot, skipLogs = false) => {
84
+ const config = await createStormWorkspaceConfig(
85
+ void 0,
86
+ void 0,
87
+ workspaceRoot,
88
+ skipLogs,
89
+ true
90
+ );
91
+ _chunkKYNO2VMScjs.setConfigEnv.call(void 0, config);
92
+ if (!skipLogs && !config.skipConfigLogging) {
93
+ _chunkXPQXNNGZcjs.writeTrace.call(void 0,
94
+ `\u2699\uFE0F Using Storm Workspace configuration:
95
+ ${_chunkXPQXNNGZcjs.formatLogMessage.call(void 0, config)}`,
96
+ config
97
+ );
98
+ }
99
+ return config;
100
+ };
101
+ var tryLoadStormWorkspaceConfig = async (workspaceRoot, skipLogs = true, useDefault = false) => {
102
+ try {
103
+ const config = await createStormWorkspaceConfig(
104
+ void 0,
105
+ void 0,
106
+ workspaceRoot,
107
+ skipLogs,
108
+ useDefault
109
+ );
110
+ if (!config) {
111
+ return void 0;
112
+ }
113
+ _chunkKYNO2VMScjs.setConfigEnv.call(void 0, config);
114
+ if (!skipLogs && !config.skipConfigLogging) {
115
+ _chunkXPQXNNGZcjs.writeTrace.call(void 0,
116
+ `\u2699\uFE0F Using Storm Workspace configuration:
117
+ ${_chunkXPQXNNGZcjs.formatLogMessage.call(void 0, config)}`,
118
+ config
119
+ );
120
+ }
121
+ return config;
122
+ } catch (error) {
123
+ if (!skipLogs) {
124
+ _chunkXPQXNNGZcjs.writeWarning.call(void 0,
125
+ `\u26A0\uFE0F Failed to load Storm Workspace configuration: ${error}`,
126
+ { logLevel: "all" }
127
+ );
128
+ }
129
+ return void 0;
130
+ }
131
+ };
132
+
133
+
134
+
135
+
136
+
137
+
138
+ exports.createStormWorkspaceConfig = createStormWorkspaceConfig; exports.createConfigExtension = createConfigExtension; exports.loadStormWorkspaceConfig = loadStormWorkspaceConfig; exports.tryLoadStormWorkspaceConfig = tryLoadStormWorkspaceConfig;