mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-27 18:01:46 +00:00
fix: harden update dev switch and refresh changelog
This commit is contained in:
@@ -2,7 +2,6 @@ import { spawnSync } from "node:child_process";
|
||||
import fs from "node:fs/promises";
|
||||
import os from "node:os";
|
||||
import path from "node:path";
|
||||
import { resolveStateDir } from "../../config/paths.js";
|
||||
import { resolveOpenClawPackageRoot } from "../../infra/openclaw-root.js";
|
||||
import { readPackageName, readPackageVersion } from "../../infra/package-json.js";
|
||||
import { normalizePackageTagInput } from "../../infra/package-tag.js";
|
||||
@@ -11,6 +10,7 @@ import { parseSemver } from "../../infra/runtime-guard.js";
|
||||
import { fetchNpmTagVersion } from "../../infra/update-check.js";
|
||||
import {
|
||||
canResolveRegistryVersionForPackageTarget,
|
||||
createGlobalInstallEnv,
|
||||
detectGlobalInstallManagerByPresence,
|
||||
detectGlobalInstallManagerForRoot,
|
||||
type CommandRunner,
|
||||
@@ -121,7 +121,7 @@ export function resolveGitInstallDir(): string {
|
||||
}
|
||||
|
||||
function resolveDefaultGitDir(): string {
|
||||
return resolveStateDir(process.env, os.homedir);
|
||||
return path.join(os.homedir(), "openclaw");
|
||||
}
|
||||
|
||||
export function resolveNodeRunner(): string {
|
||||
@@ -192,12 +192,15 @@ export async function ensureGitCheckout(params: {
|
||||
dir: string;
|
||||
timeoutMs: number;
|
||||
progress?: UpdateStepProgress;
|
||||
env?: NodeJS.ProcessEnv;
|
||||
}): Promise<UpdateStepResult | null> {
|
||||
const gitEnv = params.env ?? (await createGlobalInstallEnv());
|
||||
const dirExists = await pathExists(params.dir);
|
||||
if (!dirExists) {
|
||||
return await runUpdateStep({
|
||||
name: "git clone",
|
||||
argv: ["git", "clone", OPENCLAW_REPO_URL, params.dir],
|
||||
env: gitEnv,
|
||||
timeoutMs: params.timeoutMs,
|
||||
progress: params.progress,
|
||||
});
|
||||
@@ -215,6 +218,7 @@ export async function ensureGitCheckout(params: {
|
||||
name: "git clone",
|
||||
argv: ["git", "clone", OPENCLAW_REPO_URL, params.dir],
|
||||
cwd: params.dir,
|
||||
env: gitEnv,
|
||||
timeoutMs: params.timeoutMs,
|
||||
progress: params.progress,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user