Skip to content

Commit

Permalink
squash!
Browse files Browse the repository at this point in the history
  • Loading branch information
NikolaRHristov committed Mar 19, 2024
1 parent 711f3ce commit 1ee1251
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 12 deletions.
4 changes: 2 additions & 2 deletions Source/Class/TypeScriptESBuild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default new (await import("commander")).Command()
.version(process.env["VERSION_PACKAGE"] ?? "0.0.1")
.description("🌀 Build TypeScript.")
.argument("<File...>", "Build File.")
.option("-es, --ESBuild <File>", "ESBuild Configuration.")
.option("-ts, --TypeScript <File>", "TypeScript Configuration.")
.option("-ES, --ESBuild <File>", "ESBuild Configuration.")
.option("-TS, --TypeScript <File>", "TypeScript Configuration.")
.action((await import("../Function/Build.js")).default)
.parse();
5 changes: 4 additions & 1 deletion Source/Function/Exec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@ export default (async (
...[Command, Echo = (Return) => console.log(Return)]: Parameters<Type>
) => {
try {
const { stdout } = (await import("child_process")).exec(Command);
const { stdout, stderr } = (await import("child_process")).exec(
Command,
);

if (typeof Echo === "function") {
stdout?.on("data", (Data) => Echo(Data));
stderr?.on("data", (Data) => Echo(Data));
}
} catch (_Error) {
console.log(_Error);
Expand Down
8 changes: 4 additions & 4 deletions Source/Interface/Exec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
export default interface Type {
/**
* The 'Exec' function is an asynchronous function that executes a command and logs the
* stdout of the child process.
* stdout and stderr of the child process.
*
* @param Command - The 'Command' parameter is a string that represents the
* command you want to execute. It can be any valid command that can be executed in a
* terminal or command prompt.
*
* @param Echo - An optional parameter that controls whether the stdout
* @param Echo - An optional parameter that controls whether the stdout and stderr
* of the child process should be logged. If set to 'false', no logging will occur. If set
* to a function, the function will be called with the stdout data as a parameter for custom
* logging. If not provided, stdout will be logged to the console by default.
* to a function, the function will be called with the stdout and stderr data as a parameter for custom
* logging. If not provided, stdout and stderr will be logged to the console by default.
*
*/
(
Expand Down
2 changes: 1 addition & 1 deletion Target/Function/Exec.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions Target/Interface/Exec.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
export default interface Type {
/**
* The 'Exec' function is an asynchronous function that executes a command and logs the
* stdout of the child process.
* stdout and stderr of the child process.
*
* @param Command - The 'Command' parameter is a string that represents the
* command you want to execute. It can be any valid command that can be executed in a
* terminal or command prompt.
*
* @param Echo - An optional parameter that controls whether the stdout
* @param Echo - An optional parameter that controls whether the stdout and stderr
* of the child process should be logged. If set to 'false', no logging will occur. If set
* to a function, the function will be called with the stdout data as a parameter for custom
* logging. If not provided, stdout will be logged to the console by default.
* to a function, the function will be called with the stdout and stderr data as a parameter for custom
* logging. If not provided, stdout and stderr will be logged to the console by default.
*
*/
(Command: string, Echo?: false | ((Return: any) => void)): Promise<void>;
Expand Down

0 comments on commit 1ee1251

Please sign in to comment.