fix(update): harden global updates

This commit is contained in:
Peter Steinberger
2026-02-02 04:44:35 -08:00
parent 6b0d6e2540
commit 57d008a33d
7 changed files with 122 additions and 3 deletions

View File

@@ -5,7 +5,11 @@ import { type CommandOptions, runCommandWithTimeout } from "../process/exec.js";
import { trimLogTail } from "./restart-sentinel.js";
import { DEV_BRANCH, isBetaTag, isStableTag, type UpdateChannel } from "./update-channels.js";
import { compareSemverStrings } from "./update-check.js";
import { detectGlobalInstallManagerForRoot, globalInstallArgs } from "./update-global.js";
import {
cleanupGlobalRenameDirs,
detectGlobalInstallManagerForRoot,
globalInstallArgs,
} from "./update-global.js";
export type UpdateStepResult = {
name: string;
@@ -792,6 +796,10 @@ export async function runGatewayUpdate(opts: UpdateRunnerOptions = {}): Promise<
const globalManager = await detectGlobalInstallManagerForRoot(runCommand, pkgRoot, timeoutMs);
if (globalManager) {
const packageName = (await readPackageName(pkgRoot)) ?? DEFAULT_PACKAGE_NAME;
await cleanupGlobalRenameDirs({
globalRoot: path.dirname(pkgRoot),
packageName,
});
const spec = `${packageName}@${normalizeTag(opts.tag)}`;
const updateStep = await runStep({
runCommand,