@inceptionstack/roundhouse 0.3.5 → 0.3.7
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/package.json +1 -1
- package/src/cli/cli.ts +21 -9
package/package.json
CHANGED
package/src/cli/cli.ts
CHANGED
|
@@ -59,8 +59,9 @@ async function cmdStart() {
|
|
|
59
59
|
if (await fileExists(jsPath)) {
|
|
60
60
|
await import(jsPath);
|
|
61
61
|
} else {
|
|
62
|
+
const tsxPath = resolve(__dirname, "..", "..", "node_modules", "tsx", "dist", "cli.mjs");
|
|
62
63
|
execSync(
|
|
63
|
-
`node ${
|
|
64
|
+
`node ${tsxPath} ${indexPath}`,
|
|
64
65
|
{ stdio: "inherit", env: { ...process.env, ROUNDHOUSE_CONFIG: CONFIG_PATH } },
|
|
65
66
|
);
|
|
66
67
|
}
|
|
@@ -111,7 +112,7 @@ async function cmdInstall() {
|
|
|
111
112
|
// Resolve paths — prefer the installed bin, fall back to tsx + source
|
|
112
113
|
const binPath = run("which roundhouse", { silent: true });
|
|
113
114
|
const nodePath = run("which node", { silent: true }) || process.execPath;
|
|
114
|
-
const tsxPath = resolve(__dirname, "..", "node_modules", ".bin", "tsx");
|
|
115
|
+
const tsxPath = resolve(__dirname, "..", "..", "node_modules", ".bin", "tsx");
|
|
115
116
|
const srcIndex = resolve(__dirname, "..", "index.ts");
|
|
116
117
|
|
|
117
118
|
let execStart: string;
|
|
@@ -609,12 +610,23 @@ const commands: Record<string, () => void | Promise<void>> = {
|
|
|
609
610
|
agent: cmdAgent,
|
|
610
611
|
};
|
|
611
612
|
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
613
|
+
if (command === "--version" || command === "-v") {
|
|
614
|
+
try {
|
|
615
|
+
const pkg = JSON.parse(
|
|
616
|
+
await readFile(resolve(__dirname, "..", "..", "package.json"), "utf8")
|
|
617
|
+
);
|
|
618
|
+
console.log(pkg.version);
|
|
619
|
+
} catch {
|
|
620
|
+
console.log("unknown");
|
|
621
|
+
}
|
|
618
622
|
} else {
|
|
619
|
-
|
|
623
|
+
const fn = command ? commands[command] : undefined;
|
|
624
|
+
if (fn) {
|
|
625
|
+
Promise.resolve(fn()).catch((err) => {
|
|
626
|
+
console.error(`[roundhouse] ${command} failed:`, err);
|
|
627
|
+
process.exit(1);
|
|
628
|
+
});
|
|
629
|
+
} else {
|
|
630
|
+
printHelp();
|
|
631
|
+
}
|
|
620
632
|
}
|