fix: prefer stable release when beta lags

This commit is contained in:
Peter Steinberger
2026-01-20 16:28:25 +00:00
parent 4fda10c508
commit 3d5ffee07f
4 changed files with 54 additions and 17 deletions

View File

@@ -9,6 +9,7 @@ import {
checkUpdateStatus,
compareSemverStrings,
fetchNpmTagVersion,
resolveNpmChannelTag,
} from "../infra/update-check.js";
import { parseSemver } from "../infra/runtime-guard.js";
import {
@@ -411,10 +412,16 @@ export async function updateCommand(opts: UpdateCommandOptions): Promise<void> {
const gitCheckout = await isGitCheckout(root);
const defaultChannel = gitCheckout ? DEFAULT_GIT_CHANNEL : DEFAULT_PACKAGE_CHANNEL;
const channel = requestedChannel ?? storedChannel ?? defaultChannel;
const tag = normalizeTag(opts.tag) ?? channelToNpmTag(channel);
const explicitTag = normalizeTag(opts.tag);
let tag = explicitTag ?? channelToNpmTag(channel);
if (!gitCheckout) {
const currentVersion = await readPackageVersion(root);
const targetVersion = await resolveTargetVersion(tag, timeoutMs);
const targetVersion = explicitTag
? await resolveTargetVersion(tag, timeoutMs)
: await resolveNpmChannelTag({ channel, timeoutMs }).then((resolved) => {
tag = resolved.tag;
return resolved.version;
});
const cmp =
currentVersion && targetVersion ? compareSemverStrings(currentVersion, targetVersion) : null;
const needsConfirm =