diff --git a/package.json b/package.json index f0245de..042aeb7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "routstrd", - "version": "0.3.5", + "version": "0.3.6", "module": "src/index.ts", "type": "module", "private": false, diff --git a/src/cli.ts b/src/cli.ts index 24f2e8c..586b000 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -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")