init create cli, added node and partially cloudflare

This commit is contained in:
dswbx
2025-02-13 08:51:48 +01:00
parent d84731d89e
commit 8e72b5b615
15 changed files with 544 additions and 4 deletions

View File

@@ -1,3 +1,4 @@
import { execSync } from "node:child_process";
import { readFile } from "node:fs/promises";
import path from "node:path";
import url from "node:url";
@@ -38,3 +39,15 @@ export async function fileExists(filePath: string) {
return false;
}
}
export function exec(command: string, opts?: { silent?: boolean; env?: Record<string, string> }) {
const stdio = opts?.silent ? "pipe" : "inherit";
const output = execSync(command, {
stdio: ["inherit", stdio, stdio],
env: { ...process.env, ...opts?.env }
});
if (!opts?.silent) {
return;
}
return output.toString();
}