@myapihq/cli 1.0.71 → 1.0.72
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.js +12 -4
- package/package.json +1 -1
package/dist/commands/update.js
CHANGED
|
@@ -17,12 +17,20 @@ export async function checkForUpdate(currentVersion) {
|
|
|
17
17
|
const data = await res.json();
|
|
18
18
|
const latest = data.version;
|
|
19
19
|
if (latest && isNewer(latest, currentVersion)) {
|
|
20
|
+
// Verify the tarball is actually available before attempting install —
|
|
21
|
+
// the registry metadata can report a new version before the tarball is uploaded.
|
|
22
|
+
const tarballUrl = `https://registry.npmjs.org/@myapihq/cli/-/cli-${latest}.tgz`;
|
|
23
|
+
try {
|
|
24
|
+
const check = await fetch(tarballUrl, { method: 'HEAD', signal: AbortSignal.timeout(3000) });
|
|
25
|
+
if (!check.ok)
|
|
26
|
+
return; // Tarball not ready yet — silently skip, retry next command.
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
20
31
|
info(`\n› New version available (${currentVersion} → ${latest}) — installing…`);
|
|
21
32
|
try {
|
|
22
|
-
|
|
23
|
-
// ETARGET races where registry metadata briefly reports a version before
|
|
24
|
-
// its tarball is available.
|
|
25
|
-
execSync(`"${npmBin()}" install -g @myapihq/cli@latest`, { stdio: 'pipe' });
|
|
33
|
+
execSync(`"${npmBin()}" install -g @myapihq/cli@${latest}`, { stdio: 'pipe' });
|
|
26
34
|
const config = loadConfig();
|
|
27
35
|
if (config?.skills_installed) {
|
|
28
36
|
await installSkills();
|