@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,18 +1,38 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
-
3
-
4
-
5
- var _chunkYBVOKYAMcjs = require('../chunk-YBVOKYAM.cjs');
6
- require('../chunk-TZZRLM5J.cjs');
7
- require('../chunk-FMDVBSP6.cjs');
8
- require('../chunk-LOY6ICHZ.cjs');
9
- require('../chunk-EC2KPWRG.cjs');
10
- require('../chunk-DTGT4OI3.cjs');
11
- require('../chunk-WQJYIPSL.cjs');
12
- require('../chunk-JWLDCEBZ.cjs');
13
- require('../chunk-7QBTVNMR.cjs');
14
-
15
-
16
-
17
-
18
- exports.exitWithError = _chunkYBVOKYAMcjs.exitWithError; exports.exitWithSuccess = _chunkYBVOKYAMcjs.exitWithSuccess; exports.handleProcess = _chunkYBVOKYAMcjs.handleProcess;
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_logger_console = require("../logger/console.cjs");
3
+ //#region src/utilities/process-handler.ts
4
+ const exitWithError = (config) => {
5
+ require_logger_console.writeFatal("Exiting script with an error status...", config);
6
+ process.exit(1);
7
+ };
8
+ const exitWithSuccess = (config) => {
9
+ require_logger_console.writeSuccess("Script completed successfully. Exiting...", config);
10
+ process.exit(0);
11
+ };
12
+ const handleProcess = (config) => {
13
+ require_logger_console.writeTrace(`Using the following arguments to process the script: ${process.argv.join(", ")}`, config);
14
+ process.on("unhandledRejection", (error) => {
15
+ require_logger_console.writeError(`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"} \nStacktrace: ${error && typeof error === "object" && "stack" in error && error?.stack ? error.stack : ""}`, config);
16
+ exitWithError(config);
17
+ });
18
+ process.on("uncaughtException", (error) => {
19
+ require_logger_console.writeError(`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"} \nStacktrace: ${error && typeof error === "object" && "stack" in error && error?.stack ? error.stack : ""}`, config);
20
+ exitWithError(config);
21
+ });
22
+ process.on("SIGTERM", (signal) => {
23
+ require_logger_console.writeError(`The program terminated with signal code: ${signal}`, config);
24
+ exitWithError(config);
25
+ });
26
+ process.on("SIGINT", (signal) => {
27
+ require_logger_console.writeError(`The program terminated with signal code: ${signal}`, config);
28
+ exitWithError(config);
29
+ });
30
+ process.on("SIGHUP", (signal) => {
31
+ require_logger_console.writeError(`The program terminated with signal code: ${signal}`, config);
32
+ exitWithError(config);
33
+ });
34
+ };
35
+ //#endregion
36
+ exports.exitWithError = exitWithError;
37
+ exports.exitWithSuccess = exitWithSuccess;
38
+ exports.handleProcess = handleProcess;
@@ -1,7 +1,7 @@
1
- import { StormWorkspaceConfig } from '@storm-software/config';
2
-
1
+ import { StormWorkspaceConfig } from "@storm-software/config";
2
+ //#region src/utilities/process-handler.d.ts
3
3
  declare const exitWithError: (config?: Partial<StormWorkspaceConfig>) => never;
4
4
  declare const exitWithSuccess: (config?: Partial<StormWorkspaceConfig>) => never;
5
5
  declare const handleProcess: (config?: Partial<StormWorkspaceConfig>) => void;
6
-
7
- export { exitWithError, exitWithSuccess, handleProcess };
6
+ //#endregion
7
+ export { exitWithError, exitWithSuccess, handleProcess };
@@ -0,0 +1,9 @@
1
+ import __tsdown_shims_path from 'node:path';
2
+ import __tsdown_shims_url from 'node:url';
3
+ import { StormWorkspaceConfig } from "@storm-software/config";
4
+ //#region src/utilities/process-handler.d.ts
5
+ declare const exitWithError: (config?: Partial<StormWorkspaceConfig>) => never;
6
+ declare const exitWithSuccess: (config?: Partial<StormWorkspaceConfig>) => never;
7
+ declare const handleProcess: (config?: Partial<StormWorkspaceConfig>) => void;
8
+ //#endregion
9
+ export { exitWithError, exitWithSuccess, handleProcess };
@@ -0,0 +1,38 @@
1
+ import "node:path";
2
+ import "node:url";
3
+ import.meta.url;
4
+ import { writeError, writeFatal, writeSuccess, writeTrace } from "../logger/console.mjs";
5
+ //#region src/utilities/process-handler.ts
6
+ const exitWithError = (config) => {
7
+ writeFatal("Exiting script with an error status...", config);
8
+ process.exit(1);
9
+ };
10
+ const exitWithSuccess = (config) => {
11
+ writeSuccess("Script completed successfully. Exiting...", config);
12
+ process.exit(0);
13
+ };
14
+ const handleProcess = (config) => {
15
+ writeTrace(`Using the following arguments to process the script: ${process.argv.join(", ")}`, config);
16
+ process.on("unhandledRejection", (error) => {
17
+ writeError(`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"} \nStacktrace: ${error && typeof error === "object" && "stack" in error && error?.stack ? error.stack : ""}`, config);
18
+ exitWithError(config);
19
+ });
20
+ process.on("uncaughtException", (error) => {
21
+ writeError(`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"} \nStacktrace: ${error && typeof error === "object" && "stack" in error && error?.stack ? error.stack : ""}`, config);
22
+ exitWithError(config);
23
+ });
24
+ process.on("SIGTERM", (signal) => {
25
+ writeError(`The program terminated with signal code: ${signal}`, config);
26
+ exitWithError(config);
27
+ });
28
+ process.on("SIGINT", (signal) => {
29
+ writeError(`The program terminated with signal code: ${signal}`, config);
30
+ exitWithError(config);
31
+ });
32
+ process.on("SIGHUP", (signal) => {
33
+ writeError(`The program terminated with signal code: ${signal}`, config);
34
+ exitWithError(config);
35
+ });
36
+ };
37
+ //#endregion
38
+ export { exitWithError, exitWithSuccess, handleProcess };
@@ -1,10 +1,64 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
-
3
-
4
-
5
- var _chunk6Y623TCScjs = require('../chunk-6Y623TCS.cjs');
6
-
7
-
8
-
9
-
10
- exports.LARGE_BUFFER = _chunk6Y623TCScjs.LARGE_BUFFER; exports.run = _chunk6Y623TCScjs.run; exports.runAsync = _chunk6Y623TCScjs.runAsync;
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ let node_child_process = require("node:child_process");
3
+ //#region src/utilities/run.ts
4
+ const LARGE_BUFFER = 1024e6;
5
+ /**
6
+ * Run a command line process
7
+ *
8
+ * @remarks
9
+ * A wrapper around `execSync` to run our command line processes
10
+ *
11
+ * @param config - The Storm configuration object
12
+ * @param command - The command to run
13
+ * @param cwd - The current working directory
14
+ * @param stdio - The standard input/output options
15
+ * @param env - The environment variables
16
+ * @returns The result of the command
17
+ */
18
+ const run = (config, command, cwd = config.workspaceRoot ?? process.cwd(), stdio = "inherit", env = process.env) => {
19
+ return (0, node_child_process.execSync)(command, {
20
+ cwd,
21
+ env: {
22
+ ...process.env,
23
+ ...env,
24
+ CLICOLOR: "true",
25
+ FORCE_COLOR: "true"
26
+ },
27
+ windowsHide: true,
28
+ stdio,
29
+ maxBuffer: LARGE_BUFFER,
30
+ killSignal: "SIGTERM",
31
+ encoding: "utf8"
32
+ });
33
+ };
34
+ /**
35
+ * Run an asynchronous command line process
36
+ *
37
+ * @remarks
38
+ * A wrapper around `exec` to run our command line processes
39
+ *
40
+ * @param config - The Storm configuration object
41
+ * @param command - The command to run
42
+ * @param cwd - The current working directory
43
+ * @param env - The environment variables
44
+ * @returns A promise with the result of the command
45
+ */
46
+ const runAsync = (config, command, cwd = config.workspaceRoot ?? process.cwd(), env = process.env) => {
47
+ return (0, node_child_process.exec)(command, {
48
+ cwd,
49
+ env: {
50
+ ...process.env,
51
+ ...env,
52
+ CLICOLOR: "true",
53
+ FORCE_COLOR: "true"
54
+ },
55
+ windowsHide: true,
56
+ maxBuffer: LARGE_BUFFER,
57
+ killSignal: "SIGTERM",
58
+ encoding: "utf8"
59
+ });
60
+ };
61
+ //#endregion
62
+ exports.LARGE_BUFFER = LARGE_BUFFER;
63
+ exports.run = run;
64
+ exports.runAsync = runAsync;
@@ -1,6 +1,5 @@
1
- import * as node_child_process from 'node:child_process';
2
- import { StormWorkspaceConfig } from '@storm-software/config';
3
-
1
+ import { StormWorkspaceConfig } from "@storm-software/config";
2
+ //#region src/utilities/run.d.ts
4
3
  declare const LARGE_BUFFER: number;
5
4
  type IOType = "overlapped" | "pipe" | "ignore" | "inherit";
6
5
  type StdioOptions = IOType | Array<IOType | "ipc" | number | null | undefined>;
@@ -30,6 +29,6 @@ declare const run: (config: Partial<StormWorkspaceConfig>, command: string, cwd?
30
29
  * @param env - The environment variables
31
30
  * @returns A promise with the result of the command
32
31
  */
33
- declare const runAsync: (config: Partial<StormWorkspaceConfig>, command: string, cwd?: string, env?: NodeJS.ProcessEnv) => node_child_process.ChildProcess;
34
-
35
- export { type IOType, LARGE_BUFFER, type StdioOptions, run, runAsync };
32
+ declare const runAsync: (config: Partial<StormWorkspaceConfig>, command: string, cwd?: string, env?: NodeJS.ProcessEnv) => import("node:child_process").ChildProcess;
33
+ //#endregion
34
+ export { IOType, LARGE_BUFFER, StdioOptions, run, runAsync };
@@ -1,6 +1,7 @@
1
- import * as node_child_process from 'node:child_process';
2
- import { StormWorkspaceConfig } from '@storm-software/config';
3
-
1
+ import __tsdown_shims_path from 'node:path';
2
+ import __tsdown_shims_url from 'node:url';
3
+ import { StormWorkspaceConfig } from "@storm-software/config";
4
+ //#region src/utilities/run.d.ts
4
5
  declare const LARGE_BUFFER: number;
5
6
  type IOType = "overlapped" | "pipe" | "ignore" | "inherit";
6
7
  type StdioOptions = IOType | Array<IOType | "ipc" | number | null | undefined>;
@@ -30,6 +31,6 @@ declare const run: (config: Partial<StormWorkspaceConfig>, command: string, cwd?
30
31
  * @param env - The environment variables
31
32
  * @returns A promise with the result of the command
32
33
  */
33
- declare const runAsync: (config: Partial<StormWorkspaceConfig>, command: string, cwd?: string, env?: NodeJS.ProcessEnv) => node_child_process.ChildProcess;
34
-
35
- export { type IOType, LARGE_BUFFER, type StdioOptions, run, runAsync };
34
+ declare const runAsync: (config: Partial<StormWorkspaceConfig>, command: string, cwd?: string, env?: NodeJS.ProcessEnv) => import("node:child_process").ChildProcess;
35
+ //#endregion
36
+ export { IOType, LARGE_BUFFER, StdioOptions, run, runAsync };
@@ -0,0 +1,64 @@
1
+ import "node:path";
2
+ import "node:url";
3
+ import.meta.url;
4
+ import { exec, execSync } from "node:child_process";
5
+ //#region src/utilities/run.ts
6
+ const LARGE_BUFFER = 1024e6;
7
+ /**
8
+ * Run a command line process
9
+ *
10
+ * @remarks
11
+ * A wrapper around `execSync` to run our command line processes
12
+ *
13
+ * @param config - The Storm configuration object
14
+ * @param command - The command to run
15
+ * @param cwd - The current working directory
16
+ * @param stdio - The standard input/output options
17
+ * @param env - The environment variables
18
+ * @returns The result of the command
19
+ */
20
+ const run = (config, command, cwd = config.workspaceRoot ?? process.cwd(), stdio = "inherit", env = process.env) => {
21
+ return execSync(command, {
22
+ cwd,
23
+ env: {
24
+ ...process.env,
25
+ ...env,
26
+ CLICOLOR: "true",
27
+ FORCE_COLOR: "true"
28
+ },
29
+ windowsHide: true,
30
+ stdio,
31
+ maxBuffer: LARGE_BUFFER,
32
+ killSignal: "SIGTERM",
33
+ encoding: "utf8"
34
+ });
35
+ };
36
+ /**
37
+ * Run an asynchronous command line process
38
+ *
39
+ * @remarks
40
+ * A wrapper around `exec` to run our command line processes
41
+ *
42
+ * @param config - The Storm configuration object
43
+ * @param command - The command to run
44
+ * @param cwd - The current working directory
45
+ * @param env - The environment variables
46
+ * @returns A promise with the result of the command
47
+ */
48
+ const runAsync = (config, command, cwd = config.workspaceRoot ?? process.cwd(), env = process.env) => {
49
+ return exec(command, {
50
+ cwd,
51
+ env: {
52
+ ...process.env,
53
+ ...env,
54
+ CLICOLOR: "true",
55
+ FORCE_COLOR: "true"
56
+ },
57
+ windowsHide: true,
58
+ maxBuffer: LARGE_BUFFER,
59
+ killSignal: "SIGTERM",
60
+ encoding: "utf8"
61
+ });
62
+ };
63
+ //#endregion
64
+ export { LARGE_BUFFER, run, runAsync };
@@ -1,24 +1,37 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
-
3
-
4
-
5
-
6
-
7
- var _chunkMBG2FTBLcjs = require('../chunk-MBG2FTBL.cjs');
8
- require('../chunk-7PV6L7I7.cjs');
9
- require('../chunk-ENI4UUSK.cjs');
10
- require('../chunk-TZZRLM5J.cjs');
11
- require('../chunk-FMDVBSP6.cjs');
12
- require('../chunk-LOY6ICHZ.cjs');
13
- require('../chunk-EC2KPWRG.cjs');
14
- require('../chunk-DTGT4OI3.cjs');
15
- require('../chunk-WQJYIPSL.cjs');
16
- require('../chunk-JWLDCEBZ.cjs');
17
- require('../chunk-7QBTVNMR.cjs');
18
-
19
-
20
-
21
-
22
-
23
-
24
- exports.modifyCargoNestedTable = _chunkMBG2FTBLcjs.modifyCargoNestedTable; exports.modifyCargoTable = _chunkMBG2FTBLcjs.modifyCargoTable; exports.parseCargoToml = _chunkMBG2FTBLcjs.parseCargoToml; exports.parseCargoTomlWithTree = _chunkMBG2FTBLcjs.parseCargoTomlWithTree; exports.stringifyCargoToml = _chunkMBG2FTBLcjs.stringifyCargoToml;
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_runtime = require("../_virtual/_rolldown/runtime.cjs");
3
+ const require_logger_console = require("../logger/console.cjs");
4
+ let _ltd_j_toml = require("@ltd/j-toml");
5
+ _ltd_j_toml = require_runtime.__toESM(_ltd_j_toml, 1);
6
+ //#region src/utilities/toml.ts
7
+ function parseCargoTomlWithTree(tree, projectRoot, projectName) {
8
+ const cargoTomlString = tree.read(`${projectRoot}/Cargo.toml`)?.toString();
9
+ if (!cargoTomlString) {
10
+ require_logger_console.writeError(`Cannot find a Cargo.toml file in the ${projectName}`);
11
+ throw new Error();
12
+ }
13
+ return parseCargoToml(cargoTomlString);
14
+ }
15
+ function parseCargoToml(cargoString) {
16
+ if (!cargoString) throw new Error("Cargo.toml is empty");
17
+ return _ltd_j_toml.default.parse(cargoString, { x: { comment: true } });
18
+ }
19
+ function stringifyCargoToml(cargoToml) {
20
+ const tomlString = _ltd_j_toml.default.stringify(cargoToml, { newlineAround: "section" });
21
+ if (Array.isArray(tomlString)) return tomlString.join("\n");
22
+ return tomlString;
23
+ }
24
+ function modifyCargoTable(toml, section, key, value) {
25
+ toml[section] ??= _ltd_j_toml.default.Section({});
26
+ toml[section][key] = typeof value === "object" && !Array.isArray(value) ? _ltd_j_toml.default.inline(value) : typeof value === "function" ? value() : value;
27
+ }
28
+ function modifyCargoNestedTable(toml, section, key, value) {
29
+ toml[section] ??= {};
30
+ toml[section][key] = _ltd_j_toml.default.Section(value);
31
+ }
32
+ //#endregion
33
+ exports.modifyCargoNestedTable = modifyCargoNestedTable;
34
+ exports.modifyCargoTable = modifyCargoTable;
35
+ exports.parseCargoToml = parseCargoToml;
36
+ exports.parseCargoTomlWithTree = parseCargoTomlWithTree;
37
+ exports.stringifyCargoToml = stringifyCargoToml;