mirror of
https://github.com/stefanpejcic/openpanel
synced 2025-06-26 18:28:26 +00:00
31 lines
941 B
TypeScript
31 lines
941 B
TypeScript
import { ProjectTypes } from "@definitions/projectTypes";
|
|
import execa from "execa";
|
|
|
|
export const runScript = async (binPath: string, args: string[]) => {
|
|
if (binPath === "unknown") {
|
|
const supportedProjectTypes = Object.values(ProjectTypes)
|
|
.filter((v) => v !== "unknown")
|
|
.join(", ");
|
|
|
|
console.error(
|
|
`We couldn't find executable for your project. Supported executables are ${supportedProjectTypes}.\nPlease use your own script directly. If you think this is an issue, please report it at: https://github.com/refinedev/refine/issues`,
|
|
);
|
|
|
|
return;
|
|
}
|
|
|
|
const execution = execa(binPath, args, {
|
|
stdio: "pipe",
|
|
windowsHide: false,
|
|
env: {
|
|
FORCE_COLOR: "true",
|
|
...process.env,
|
|
},
|
|
});
|
|
|
|
execution.stdout?.pipe(process.stdout);
|
|
execution.stderr?.pipe(process.stderr);
|
|
|
|
return await execution;
|
|
};
|