@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.
- package/README.md +1 -1
- package/bin/config.cjs +1213 -1558
- package/bin/config.mjs +1271 -0
- package/dist/_virtual/_rolldown/runtime.cjs +23 -0
- package/dist/config-file/get-config-file.cjs +67 -28
- package/dist/config-file/get-config-file.d.cts +5 -5
- package/dist/config-file/{get-config-file.d.ts → get-config-file.d.mts} +7 -5
- package/dist/config-file/get-config-file.mjs +66 -0
- package/dist/config-file/index.cjs +4 -29
- package/dist/config-file/index.d.cts +2 -3
- package/dist/config-file/index.d.mts +4 -0
- package/dist/config-file/index.mjs +5 -0
- package/dist/create-storm-config.cjs +115 -34
- package/dist/create-storm-config.d.cts +5 -5
- package/dist/{create-storm-config.d.ts → create-storm-config.d.mts} +7 -5
- package/dist/create-storm-config.mjs +113 -0
- package/dist/env/get-env.cjs +202 -11
- package/dist/env/get-env.d.cts +5 -5
- package/dist/env/{get-env.d.ts → get-env.d.mts} +7 -5
- package/dist/env/get-env.mjs +203 -0
- package/dist/env/index.cjs +7 -18
- package/dist/env/index.d.cts +3 -4
- package/dist/env/index.d.mts +5 -0
- package/dist/env/index.mjs +6 -0
- package/dist/env/set-env.cjs +230 -11
- package/dist/env/set-env.d.cts +8 -8
- package/dist/env/{set-env.d.ts → set-env.d.mts} +10 -8
- package/dist/env/set-env.mjs +231 -0
- package/dist/get-config.cjs +46 -34
- package/dist/get-config.d.cts +18 -18
- package/dist/{get-config.d.ts → get-config.d.mts} +20 -18
- package/dist/get-config.mjs +46 -0
- package/dist/index.cjs +98 -201
- package/dist/index.d.cts +27 -28
- package/dist/index.d.mts +29 -0
- package/dist/index.mjs +26 -0
- package/dist/logger/chalk.cjs +43 -6
- package/dist/logger/chalk.d.cts +18 -17
- package/dist/logger/chalk.d.mts +37 -0
- package/dist/logger/chalk.mjs +43 -0
- package/dist/logger/console-icons.cjs +18 -8
- package/dist/logger/console-icons.d.cts +5 -8
- package/dist/logger/console-icons.d.mts +7 -0
- package/dist/logger/console-icons.mjs +20 -0
- package/dist/logger/console.cjs +195 -37
- package/dist/logger/console.d.cts +25 -25
- package/dist/logger/{console.d.ts → console.d.mts} +27 -25
- package/dist/logger/console.mjs +185 -0
- package/dist/logger/create-logger.cjs +34 -14
- package/dist/logger/create-logger.d.cts +5 -6
- package/dist/logger/{create-logger.d.ts → create-logger.d.mts} +7 -6
- package/dist/logger/create-logger.mjs +34 -0
- package/dist/logger/format-timestamp.cjs +14 -6
- package/dist/logger/format-timestamp.d.cts +3 -2
- package/dist/logger/{format-timestamp.d.ts → format-timestamp.d.mts} +5 -2
- package/dist/logger/format-timestamp.mjs +16 -0
- package/dist/logger/get-log-level.cjs +54 -11
- package/dist/logger/get-log-level.d.cts +4 -5
- package/dist/logger/{get-log-level.d.ts → get-log-level.d.mts} +6 -5
- package/dist/logger/get-log-level.mjs +54 -0
- package/dist/logger/index.cjs +29 -61
- package/dist/logger/index.d.cts +8 -10
- package/dist/logger/index.d.mts +10 -0
- package/dist/logger/index.mjs +11 -0
- package/dist/logger/is-unicode-supported.cjs +8 -6
- package/dist/logger/is-unicode-supported.d.cts +3 -2
- package/dist/logger/is-unicode-supported.d.mts +6 -0
- package/dist/logger/is-unicode-supported.mjs +10 -0
- package/dist/types.cjs +29 -8
- package/dist/types.d.cts +39 -41
- package/dist/types.d.mts +53 -0
- package/dist/types.mjs +30 -0
- package/dist/utilities/apply-workspace-tokens.cjs +37 -13
- package/dist/utilities/apply-workspace-tokens.d.cts +4 -5
- package/dist/utilities/{apply-workspace-tokens.d.ts → apply-workspace-tokens.d.mts} +6 -5
- package/dist/utilities/apply-workspace-tokens.mjs +37 -0
- package/dist/utilities/colors.cjs +98 -12
- package/dist/utilities/colors.d.cts +4 -4
- package/dist/utilities/{colors.d.ts → colors.d.mts} +6 -4
- package/dist/utilities/colors.mjs +97 -0
- package/dist/utilities/correct-paths.cjs +201 -32
- package/dist/utilities/correct-paths.d.cts +4 -4
- package/dist/utilities/{correct-paths.d.ts → correct-paths.d.mts} +6 -4
- package/dist/utilities/correct-paths.mjs +190 -0
- package/dist/utilities/file-path-utils.cjs +48 -11
- package/dist/utilities/file-path-utils.d.cts +15 -14
- package/dist/utilities/{file-path-utils.d.ts → file-path-utils.d.mts} +17 -14
- package/dist/utilities/file-path-utils.mjs +48 -0
- package/dist/utilities/find-up.cjs +17 -6
- package/dist/utilities/find-up.d.cts +3 -2
- package/dist/utilities/{find-up.d.ts → find-up.d.mts} +5 -2
- package/dist/utilities/find-up.mjs +19 -0
- package/dist/utilities/find-workspace-root.cjs +72 -10
- package/dist/utilities/find-workspace-root.d.cts +3 -2
- package/dist/utilities/{find-workspace-root.d.ts → find-workspace-root.d.mts} +5 -2
- package/dist/utilities/find-workspace-root.mjs +73 -0
- package/dist/utilities/get-default-config.cjs +73 -11
- package/dist/utilities/get-default-config.d.cts +4 -4
- package/dist/utilities/{get-default-config.d.ts → get-default-config.d.mts} +6 -4
- package/dist/utilities/get-default-config.mjs +74 -0
- package/dist/utilities/index.cjs +49 -109
- package/dist/utilities/index.d.cts +10 -14
- package/dist/utilities/index.d.mts +12 -0
- package/dist/utilities/index.mjs +13 -0
- package/dist/utilities/process-handler.cjs +38 -18
- package/dist/utilities/process-handler.d.cts +4 -4
- package/dist/utilities/process-handler.d.mts +9 -0
- package/dist/utilities/process-handler.mjs +38 -0
- package/dist/utilities/run.cjs +64 -10
- package/dist/utilities/run.d.cts +5 -6
- package/dist/utilities/{run.d.ts → run.d.mts} +7 -6
- package/dist/utilities/run.mjs +64 -0
- package/dist/utilities/toml.cjs +37 -24
- package/dist/utilities/toml.d.cts +148 -147
- package/dist/utilities/toml.d.mts +192 -0
- package/dist/utilities/toml.mjs +33 -0
- package/package.json +106 -158
- package/bin/config.js +0 -1616
- package/dist/chunk-24B36RDB.cjs +0 -81
- package/dist/chunk-27N3QEX5.js +0 -40
- package/dist/chunk-2AVLCXLT.js +0 -0
- package/dist/chunk-2RLMTBVZ.js +0 -233
- package/dist/chunk-2WBD2G3E.cjs +0 -38
- package/dist/chunk-3COHMHPU.cjs +0 -1
- package/dist/chunk-4Q45WJYQ.js +0 -165
- package/dist/chunk-5C7PIENF.js +0 -92
- package/dist/chunk-5J2SS4QU.js +0 -83
- package/dist/chunk-65SWKEHV.cjs +0 -1
- package/dist/chunk-6Y623TCS.cjs +0 -40
- package/dist/chunk-7PV6L7I7.cjs +0 -1
- package/dist/chunk-7QBTVNMR.cjs +0 -30
- package/dist/chunk-BDATZ3UB.cjs +0 -233
- package/dist/chunk-BZRTSWH4.cjs +0 -395
- package/dist/chunk-D3FRXXDE.js +0 -947
- package/dist/chunk-DTGT4OI3.cjs +0 -14
- package/dist/chunk-EC2KPWRG.cjs +0 -24
- package/dist/chunk-EENQN6N2.js +0 -40
- package/dist/chunk-ENI4UUSK.cjs +0 -35
- package/dist/chunk-FJNXECWU.js +0 -395
- package/dist/chunk-FMDVBSP6.cjs +0 -83
- package/dist/chunk-G2MK47WL.js +0 -14
- package/dist/chunk-HFS7WJVW.js +0 -81
- package/dist/chunk-HVVJHTFS.js +0 -36
- package/dist/chunk-IWD6YQKX.cjs +0 -1
- package/dist/chunk-IWQRXQ4N.cjs +0 -84
- package/dist/chunk-JK4TT5IV.js +0 -35
- package/dist/chunk-JWLDCEBZ.cjs +0 -70
- package/dist/chunk-JZAYHDV3.js +0 -8
- package/dist/chunk-KSMN3HSC.js +0 -38
- package/dist/chunk-L6UNTUC4.js +0 -0
- package/dist/chunk-LOY6ICHZ.cjs +0 -36
- package/dist/chunk-MBG2FTBL.cjs +0 -47
- package/dist/chunk-MQG74XF7.js +0 -102
- package/dist/chunk-MSAQEGBK.cjs +0 -92
- package/dist/chunk-NJFLUTGH.cjs +0 -25
- package/dist/chunk-PCYB64MB.cjs +0 -40
- package/dist/chunk-RALMUN5C.js +0 -30
- package/dist/chunk-RRKB32OH.js +0 -0
- package/dist/chunk-RUKM6FCF.js +0 -25
- package/dist/chunk-SIW7AXUG.js +0 -56
- package/dist/chunk-SLICWTO2.cjs +0 -165
- package/dist/chunk-SO3FWVXC.js +0 -84
- package/dist/chunk-SXPH7ILL.js +0 -70
- package/dist/chunk-T7YISGRS.cjs +0 -102
- package/dist/chunk-TZZRLM5J.cjs +0 -947
- package/dist/chunk-UJ77IBHD.cjs +0 -233
- package/dist/chunk-UKGRDKIH.js +0 -0
- package/dist/chunk-V3GMJ4TX.js +0 -233
- package/dist/chunk-WQJYIPSL.cjs +0 -8
- package/dist/chunk-YBVOKYAM.cjs +0 -56
- package/dist/chunk-YX4736HU.js +0 -47
- package/dist/chunk-ZFNAUMQS.js +0 -24
- package/dist/config-file/get-config-file.js +0 -28
- package/dist/config-file/index.d.ts +0 -3
- package/dist/config-file/index.js +0 -29
- package/dist/create-storm-config.js +0 -35
- package/dist/env/get-env.js +0 -11
- package/dist/env/index.d.ts +0 -4
- package/dist/env/index.js +0 -18
- package/dist/env/set-env.js +0 -11
- package/dist/get-config.js +0 -34
- package/dist/index.d.ts +0 -28
- package/dist/index.js +0 -201
- package/dist/logger/chalk.d.ts +0 -34
- package/dist/logger/chalk.js +0 -6
- package/dist/logger/console-icons.d.ts +0 -8
- package/dist/logger/console-icons.js +0 -8
- package/dist/logger/console.js +0 -37
- package/dist/logger/create-logger.js +0 -14
- package/dist/logger/format-timestamp.js +0 -6
- package/dist/logger/get-log-level.js +0 -11
- package/dist/logger/index.d.ts +0 -10
- package/dist/logger/index.js +0 -61
- package/dist/logger/is-unicode-supported.d.ts +0 -3
- package/dist/logger/is-unicode-supported.js +0 -6
- package/dist/types.d.ts +0 -53
- package/dist/types.js +0 -8
- package/dist/utilities/apply-workspace-tokens.js +0 -13
- package/dist/utilities/colors.js +0 -12
- package/dist/utilities/correct-paths.js +0 -32
- package/dist/utilities/file-path-utils.js +0 -11
- package/dist/utilities/find-up.js +0 -6
- package/dist/utilities/find-workspace-root.js +0 -10
- package/dist/utilities/get-default-config.js +0 -11
- package/dist/utilities/index.d.ts +0 -14
- package/dist/utilities/index.js +0 -109
- package/dist/utilities/process-handler.d.ts +0 -7
- package/dist/utilities/process-handler.js +0 -18
- package/dist/utilities/run.js +0 -10
- package/dist/utilities/toml.d.ts +0 -189
- package/dist/utilities/toml.js +0 -24
|
@@ -1,18 +1,38 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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
|
|
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 };
|
package/dist/utilities/run.cjs
CHANGED
|
@@ -1,10 +1,64 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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;
|
package/dist/utilities/run.d.cts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
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) =>
|
|
34
|
-
|
|
35
|
-
export {
|
|
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
|
|
2
|
-
import
|
|
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) =>
|
|
34
|
-
|
|
35
|
-
export {
|
|
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 };
|
package/dist/utilities/toml.cjs
CHANGED
|
@@ -1,24 +1,37 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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;
|