zelari-code 2.0.0-alpha.2 → 2.0.0-alpha.4
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/cli/main.bundled.js
CHANGED
|
@@ -42199,10 +42199,12 @@ __export(updater_exports, {
|
|
|
42199
42199
|
REGISTRY_URL: () => REGISTRY_URL,
|
|
42200
42200
|
checkForUpdate: () => checkForUpdate,
|
|
42201
42201
|
compareSemver: () => compareSemver,
|
|
42202
|
+
distTagForVersion: () => distTagForVersion,
|
|
42202
42203
|
fetchLatestVersion: () => fetchLatestVersion,
|
|
42203
42204
|
getCurrentVersion: () => getCurrentVersion,
|
|
42204
42205
|
looksLikeBrokenShim: () => looksLikeBrokenShim,
|
|
42205
42206
|
performUpdate: () => performUpdate,
|
|
42207
|
+
registryUrlForTag: () => registryUrlForTag,
|
|
42206
42208
|
resolveBundledNpmCli: () => resolveBundledNpmCli
|
|
42207
42209
|
});
|
|
42208
42210
|
import { createRequire as createRequire2 } from "node:module";
|
|
@@ -42256,6 +42258,15 @@ function compareSemver(a, b) {
|
|
|
42256
42258
|
if (bPre === null) return -1;
|
|
42257
42259
|
return aPre < bPre ? -1 : 1;
|
|
42258
42260
|
}
|
|
42261
|
+
function distTagForVersion(version2) {
|
|
42262
|
+
if (version2.includes("-alpha.")) return "alpha";
|
|
42263
|
+
if (version2.includes("-beta.")) return "beta";
|
|
42264
|
+
if (version2.includes("-next.")) return "next";
|
|
42265
|
+
return "latest";
|
|
42266
|
+
}
|
|
42267
|
+
function registryUrlForTag(tag = distTagForVersion(getCurrentVersion())) {
|
|
42268
|
+
return `https://registry.npmjs.org/zelari-code/${tag}`;
|
|
42269
|
+
}
|
|
42259
42270
|
async function fetchLatestVersion(fetcher = fetch, registryUrl = REGISTRY_URL, timeoutMs = 5e3) {
|
|
42260
42271
|
try {
|
|
42261
42272
|
const controller = new AbortController();
|
|
@@ -42277,7 +42288,8 @@ async function fetchLatestVersion(fetcher = fetch, registryUrl = REGISTRY_URL, t
|
|
|
42277
42288
|
}
|
|
42278
42289
|
async function checkForUpdate(fetcher = fetch, registryUrl) {
|
|
42279
42290
|
const currentVersion = getCurrentVersion();
|
|
42280
|
-
const
|
|
42291
|
+
const url2 = registryUrl ?? registryUrlForTag();
|
|
42292
|
+
const latest = await fetchLatestVersion(fetcher, url2);
|
|
42281
42293
|
if ("error" in latest) {
|
|
42282
42294
|
return {
|
|
42283
42295
|
currentVersion,
|
|
@@ -42293,8 +42305,9 @@ async function checkForUpdate(fetcher = fetch, registryUrl) {
|
|
|
42293
42305
|
updateAvailable: cmp < 0
|
|
42294
42306
|
};
|
|
42295
42307
|
}
|
|
42296
|
-
async function performUpdate(packageName = "zelari-code", executor = spawn12, resolveNpmCli = resolveBundledNpmCli) {
|
|
42297
|
-
const
|
|
42308
|
+
async function performUpdate(packageName = "zelari-code", executor = spawn12, resolveNpmCli = resolveBundledNpmCli, channel) {
|
|
42309
|
+
const tag = channel ?? distTagForVersion(getCurrentVersion());
|
|
42310
|
+
const args = ["install", "-g", `${packageName}@${tag}`];
|
|
42298
42311
|
const primary = await runNpm(executor, args, "shim");
|
|
42299
42312
|
if (primary.ok) return primary;
|
|
42300
42313
|
const npmCli = resolveNpmCli();
|
|
@@ -58838,12 +58851,13 @@ async function handleUpdateCheck(ctx) {
|
|
|
58838
58851
|
}
|
|
58839
58852
|
}
|
|
58840
58853
|
async function handleUpdatePerform(ctx) {
|
|
58841
|
-
appendSystem(
|
|
58842
|
-
ctx.setMessages,
|
|
58843
|
-
"[update] running `npm install -g zelari-code@latest`..."
|
|
58844
|
-
);
|
|
58845
58854
|
try {
|
|
58846
|
-
const { performUpdate: performUpdate2 } = await Promise.resolve().then(() => (init_updater(), updater_exports));
|
|
58855
|
+
const { performUpdate: performUpdate2, distTagForVersion: distTagForVersion2, getCurrentVersion: getCurrentVersion2 } = await Promise.resolve().then(() => (init_updater(), updater_exports));
|
|
58856
|
+
const tag = distTagForVersion2(getCurrentVersion2());
|
|
58857
|
+
appendSystem(
|
|
58858
|
+
ctx.setMessages,
|
|
58859
|
+
`[update] running \`npm install -g zelari-code@${tag}\`...`
|
|
58860
|
+
);
|
|
58847
58861
|
const res = await performUpdate2();
|
|
58848
58862
|
if (res.ok) {
|
|
58849
58863
|
let prereqBlock = "";
|