Add 'update' command to upgrade routstrd and cocod globally

This commit is contained in:
redshift
2026-07-06 18:27:00 +08:00
parent 1a06093b96
commit f58e807807
2 changed files with 32 additions and 1 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "routstrd",
"version": "0.3.5",
"version": "0.3.6",
"module": "src/index.ts",
"type": "module",
"private": false,
+31
View File
@@ -235,6 +235,37 @@ program
.description("Routstr daemon - Manage routstr processes")
.version(packageJson.version, "--version", "output the version number");
program
.command("update")
.description("Update routstrd and cocod to the latest versions")
.action(async () => {
console.log("Updating routstrd...");
const routstrdProc = Bun.spawn(["bun", "install", "-g", "routstrd"], {
stdout: "inherit",
stderr: "inherit",
});
const routstrdCode = await routstrdProc.exited;
if (routstrdCode !== 0) {
console.error("Failed to update routstrd.");
process.exit(1);
}
console.log("routstrd updated successfully.\n");
console.log("Updating cocod...");
const cocodProc = Bun.spawn(["bun", "install", "-g", "@routstr/cocod"], {
stdout: "inherit",
stderr: "inherit",
});
const cocodCode = await cocodProc.exited;
if (cocodCode !== 0) {
console.error("Failed to update cocod.");
process.exit(1);
}
console.log("cocod updated successfully.\n");
console.log("Both routstrd and cocod have been updated!");
});
program
.command("refund")
.description("Refund pending tokens and API keys to a specified mint")