@rendotdev/rig 0.0.6 → 0.0.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/dist/rig.js +22 -0
- package/package.json +1 -1
package/dist/rig.js
CHANGED
|
@@ -86,6 +86,7 @@ class CliApplication {
|
|
|
86
86
|
this.configureRunCommand();
|
|
87
87
|
this.configureTypecheckCommand();
|
|
88
88
|
this.configureDevCommands();
|
|
89
|
+
this.configureUpdateCommand();
|
|
89
90
|
this.program.command("help").argument("<target>", "Tool name or command id (<tool>.<command>.)").description("Print tool docs.").action(async (target) => {
|
|
90
91
|
this.requestGeneratedSync();
|
|
91
92
|
const { ToolHelpService } = await import("./help-dz0f9jjb.js");
|
|
@@ -198,6 +199,27 @@ class CliApplication {
|
|
|
198
199
|
process.exitCode = result.exitCode;
|
|
199
200
|
});
|
|
200
201
|
}
|
|
202
|
+
configureUpdateCommand() {
|
|
203
|
+
this.program.command("update").description("Update rig to the latest published version.").action(async () => {
|
|
204
|
+
const currentVersion = this.version();
|
|
205
|
+
console.log(`Current version: ${currentVersion}`);
|
|
206
|
+
console.log("Checking for updates...");
|
|
207
|
+
const result = spawnSync("npm", ["install", "-g", "@rendotdev/rig@latest", "--force"], {
|
|
208
|
+
stdio: "inherit"
|
|
209
|
+
});
|
|
210
|
+
if (result.status !== 0) {
|
|
211
|
+
console.error("Update failed.");
|
|
212
|
+
process.exit(1);
|
|
213
|
+
}
|
|
214
|
+
const check = spawnSync("rig", ["--version"], { encoding: "utf8", stdio: "pipe" });
|
|
215
|
+
const newVersion = check.stdout?.trim() ?? "unknown";
|
|
216
|
+
if (newVersion === currentVersion) {
|
|
217
|
+
console.log(`Already on the latest version (${currentVersion}).`);
|
|
218
|
+
} else {
|
|
219
|
+
console.log(`Updated: ${currentVersion} -> ${newVersion}`);
|
|
220
|
+
}
|
|
221
|
+
});
|
|
222
|
+
}
|
|
201
223
|
configureDevCommands() {
|
|
202
224
|
const devCommand = this.program.command("dev").description("Local development helpers.");
|
|
203
225
|
devCommand.command("link").description("Link this checkout as the local rig command for development.").option("--bin-dir <path>", "Directory where the rig shim should be written.").option("--force", "Overwrite an existing non-Rig shim.").action(async (commandOptions) => {
|