@wahooks/cli 0.12.0 → 0.13.1
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/install.js +16 -4
- package/package.json +1 -1
package/install.js
CHANGED
|
@@ -47,10 +47,22 @@ async function install() {
|
|
|
47
47
|
const ext = goos === "windows" ? ".exe" : "";
|
|
48
48
|
const assetName = `wahooks-${goos}-${goarch}${ext}`;
|
|
49
49
|
|
|
50
|
-
// Find latest CLI release
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
50
|
+
// Find latest CLI release (use /releases/latest first, fall back to listing)
|
|
51
|
+
let cliRelease;
|
|
52
|
+
try {
|
|
53
|
+
const latestData = await fetch(`https://api.github.com/repos/${REPO}/releases/latest`);
|
|
54
|
+
const latest = JSON.parse(latestData.toString());
|
|
55
|
+
if (latest.tag_name && latest.tag_name.startsWith("cli-v")) {
|
|
56
|
+
cliRelease = latest;
|
|
57
|
+
}
|
|
58
|
+
} catch {}
|
|
59
|
+
if (!cliRelease) {
|
|
60
|
+
const releasesData = await fetch(`https://api.github.com/repos/${REPO}/releases`);
|
|
61
|
+
const releases = JSON.parse(releasesData.toString());
|
|
62
|
+
const cliReleases = releases.filter((r) => r.tag_name.startsWith("cli-v"));
|
|
63
|
+
cliReleases.sort((a, b) => new Date(b.published_at) - new Date(a.published_at));
|
|
64
|
+
cliRelease = cliReleases[0];
|
|
65
|
+
}
|
|
54
66
|
|
|
55
67
|
if (!cliRelease) {
|
|
56
68
|
throw new Error("No CLI release found. Please install from source: https://github.com/dhruvyad/wahooks/tree/main/cli");
|