@apso/cli 0.22.0 → 0.23.0
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/commands/update.d.ts +14 -0
- package/dist/commands/update.js +69 -0
- package/npm-shrinkwrap.json +2 -2
- package/oclif.manifest.json +24 -1
- package/package.json +1 -1
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import BaseCommand from "../lib/base-command";
|
|
2
|
+
/**
|
|
3
|
+
* Update the CLI in place. Detects whether it was installed via Homebrew or npm
|
|
4
|
+
* and runs the matching upgrade command, so users don't have to remember the
|
|
5
|
+
* incantation. `--check` only reports whether an update is available.
|
|
6
|
+
*/
|
|
7
|
+
export default class Update extends BaseCommand {
|
|
8
|
+
static description: string;
|
|
9
|
+
static examples: string[];
|
|
10
|
+
static flags: {
|
|
11
|
+
check: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
12
|
+
};
|
|
13
|
+
run(): Promise<void>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const core_1 = require("@oclif/core");
|
|
5
|
+
const child_process_1 = require("child_process");
|
|
6
|
+
const base_command_1 = tslib_1.__importDefault(require("../lib/base-command"));
|
|
7
|
+
/**
|
|
8
|
+
* Update the CLI in place. Detects whether it was installed via Homebrew or npm
|
|
9
|
+
* and runs the matching upgrade command, so users don't have to remember the
|
|
10
|
+
* incantation. `--check` only reports whether an update is available.
|
|
11
|
+
*/
|
|
12
|
+
class Update extends base_command_1.default {
|
|
13
|
+
async run() {
|
|
14
|
+
const { flags } = await this.parse(Update);
|
|
15
|
+
const current = this.config.version;
|
|
16
|
+
let latest = "";
|
|
17
|
+
try {
|
|
18
|
+
latest = (0, child_process_1.execSync)("npm view @apso/cli version", {
|
|
19
|
+
encoding: "utf-8",
|
|
20
|
+
timeout: 15000,
|
|
21
|
+
}).trim();
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
this.warn("Could not reach npm to check for the latest version.");
|
|
25
|
+
}
|
|
26
|
+
if (latest) {
|
|
27
|
+
this.log(` Installed: ${current}`);
|
|
28
|
+
this.log(` Latest: ${latest}`);
|
|
29
|
+
this.log("");
|
|
30
|
+
}
|
|
31
|
+
if (latest && latest === current) {
|
|
32
|
+
this.log("You're on the latest version.");
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
if (flags.check) {
|
|
36
|
+
if (latest)
|
|
37
|
+
this.log(`Update available: ${current} -> ${latest}`);
|
|
38
|
+
this.log("Run 'apso update' to upgrade.");
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
// Pick the upgrade command based on how the CLI was installed.
|
|
42
|
+
const installRoot = `${this.config.root || ""} ${process.execPath}`;
|
|
43
|
+
const isBrew = /(?:Cellar|homebrew|\/opt\/homebrew)/i.test(installRoot);
|
|
44
|
+
const cmd = isBrew
|
|
45
|
+
? "brew upgrade apsoai/tap/apso"
|
|
46
|
+
: "npm install -g @apso/cli@latest";
|
|
47
|
+
this.log(`Updating via: ${cmd}`);
|
|
48
|
+
this.log("");
|
|
49
|
+
try {
|
|
50
|
+
(0, child_process_1.execSync)(cmd, { stdio: "inherit" });
|
|
51
|
+
}
|
|
52
|
+
catch {
|
|
53
|
+
this.error(`Update failed. Run it manually:\n ${cmd}` +
|
|
54
|
+
(isBrew ? "" : "\n(or 'brew upgrade apsoai/tap/apso' if you used Homebrew)"));
|
|
55
|
+
}
|
|
56
|
+
this.log("");
|
|
57
|
+
this.log(`Updated to ${latest || "the latest version"}.`);
|
|
58
|
+
this.log("Run 'apso --version' to confirm.");
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
Update.description = "Update the Apso CLI to the latest version";
|
|
62
|
+
Update.examples = ["$ apso update", "$ apso update --check"];
|
|
63
|
+
Update.flags = {
|
|
64
|
+
check: core_1.Flags.boolean({
|
|
65
|
+
description: "Only check whether a newer version is available",
|
|
66
|
+
default: false,
|
|
67
|
+
}),
|
|
68
|
+
};
|
|
69
|
+
exports.default = Update;
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@apso/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.23.0",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@apso/cli",
|
|
9
|
-
"version": "0.
|
|
9
|
+
"version": "0.23.0",
|
|
10
10
|
"license": "Apache-2.0",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@biomejs/biome": "^1.9.4",
|
package/oclif.manifest.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.
|
|
2
|
+
"version": "0.23.0",
|
|
3
3
|
"commands": {
|
|
4
4
|
"config": {
|
|
5
5
|
"id": "config",
|
|
@@ -501,6 +501,29 @@
|
|
|
501
501
|
},
|
|
502
502
|
"args": {}
|
|
503
503
|
},
|
|
504
|
+
"update": {
|
|
505
|
+
"id": "update",
|
|
506
|
+
"description": "Update the Apso CLI to the latest version",
|
|
507
|
+
"strict": true,
|
|
508
|
+
"pluginName": "@apso/cli",
|
|
509
|
+
"pluginAlias": "@apso/cli",
|
|
510
|
+
"pluginType": "core",
|
|
511
|
+
"aliases": [],
|
|
512
|
+
"hiddenAliases": [],
|
|
513
|
+
"examples": [
|
|
514
|
+
"$ apso update",
|
|
515
|
+
"$ apso update --check"
|
|
516
|
+
],
|
|
517
|
+
"flags": {
|
|
518
|
+
"check": {
|
|
519
|
+
"name": "check",
|
|
520
|
+
"type": "boolean",
|
|
521
|
+
"description": "Only check whether a newer version is available",
|
|
522
|
+
"allowNo": false
|
|
523
|
+
}
|
|
524
|
+
},
|
|
525
|
+
"args": {}
|
|
526
|
+
},
|
|
504
527
|
"use": {
|
|
505
528
|
"id": "use",
|
|
506
529
|
"description": "Select the active workspace for CLI commands",
|