Files
openpanel/packages/cli/src/commands/runner/runScript.ts
Stefan Pejcic 8496a83edb fork refine
2024-02-05 10:23:04 +01:00

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;
};