@corvio/admin-cli 0.1.0-beta.27 → 0.1.0-beta.29
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.js +1 -1
- package/dist/core.js +19 -15
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
writeResult,
|
|
25
25
|
} from "./core.js";
|
|
26
26
|
|
|
27
|
-
const VERSION = "0.1.0-beta.
|
|
27
|
+
const VERSION = "0.1.0-beta.29";
|
|
28
28
|
const DEFAULT_API_BASE = "https://api.corvio.ai/v1";
|
|
29
29
|
const USER_AGENT = `corvio-admin-cli/${VERSION}`;
|
|
30
30
|
const GLOBAL_OPTIONS = Object.freeze(["api-base", "json", "no-input", "help", "version"]);
|
package/dist/core.js
CHANGED
|
@@ -244,6 +244,7 @@ export async function resolveNpmUpdateStatus({
|
|
|
244
244
|
policy,
|
|
245
245
|
userAgent,
|
|
246
246
|
allowRegistryFailure = false,
|
|
247
|
+
checkRegistry = true,
|
|
247
248
|
fetchImpl = globalThis.fetch,
|
|
248
249
|
registryBase = process.env.CORVIO_NPM_REGISTRY_BASE || "https://registry.npmjs.org",
|
|
249
250
|
}) {
|
|
@@ -253,22 +254,24 @@ export async function resolveNpmUpdateStatus({
|
|
|
253
254
|
const encoded = encodeURIComponent(packageName).replace("%40", "@");
|
|
254
255
|
let latestVersion = null;
|
|
255
256
|
let registryError = null;
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
if (!response.ok) throw new Error(`npm registry returned ${response.status}`);
|
|
263
|
-
const metadata = await response.json();
|
|
264
|
-
latestVersion = String(metadata?.["dist-tags"]?.[distTag] || "").trim() || null;
|
|
265
|
-
} catch (error) {
|
|
266
|
-
registryError = error instanceof Error ? error.message : String(error);
|
|
267
|
-
if (!allowRegistryFailure) {
|
|
268
|
-
throw new CliError(`Unable to check npm for updates: ${registryError}`, {
|
|
269
|
-
code: "update_check_failed",
|
|
270
|
-
exitCode: EXIT.REMOTE,
|
|
257
|
+
if (checkRegistry) {
|
|
258
|
+
try {
|
|
259
|
+
const registry = String(registryBase).replace(/\/+$/, "");
|
|
260
|
+
const response = await fetchImpl(`${registry}/${encoded}`, {
|
|
261
|
+
headers: { accept: "application/json", "user-agent": userAgent },
|
|
262
|
+
signal: AbortSignal.timeout(2500),
|
|
271
263
|
});
|
|
264
|
+
if (!response.ok) throw new Error(`npm registry returned ${response.status}`);
|
|
265
|
+
const metadata = await response.json();
|
|
266
|
+
latestVersion = String(metadata?.["dist-tags"]?.[distTag] || "").trim() || null;
|
|
267
|
+
} catch (error) {
|
|
268
|
+
registryError = error instanceof Error ? error.message : String(error);
|
|
269
|
+
if (!allowRegistryFailure) {
|
|
270
|
+
throw new CliError(`Unable to check npm for updates: ${registryError}`, {
|
|
271
|
+
code: "update_check_failed",
|
|
272
|
+
exitCode: EXIT.REMOTE,
|
|
273
|
+
});
|
|
274
|
+
}
|
|
272
275
|
}
|
|
273
276
|
}
|
|
274
277
|
const minimum = String(policy.minimum_supported_version || "").trim() || null;
|
|
@@ -278,6 +281,7 @@ export async function resolveNpmUpdateStatus({
|
|
|
278
281
|
dist_tag: distTag,
|
|
279
282
|
current_version: currentVersion,
|
|
280
283
|
latest_published_version: latestVersion,
|
|
284
|
+
registry_checked: checkRegistry,
|
|
281
285
|
reviewed_version: String(policy.reviewed_version || "").trim() || null,
|
|
282
286
|
minimum_supported_version: minimum,
|
|
283
287
|
update_available: Boolean(latestVersion && compareVersions(latestVersion, currentVersion) > 0),
|