mirror of
https://github.com/hansjone/dsh-im-ops.git
synced 2026-10-11 04:03:16 +08:00
feat(ui): add manual update commands and simplify update dialog
This commit is contained in:
parent
45c0a7f77f
commit
57eef234b1
13 changed files with 1050 additions and 41 deletions
|
|
@ -280,6 +280,8 @@ export function createUpdateRuntime(options = {}) {
|
|||
|
||||
const profile = await packageAt(runtime.profileDir);
|
||||
const installed = await packageAt(join(runtime.profileDir, 'node_modules', PACKAGE_NAME));
|
||||
result.sourceInstall = !registrySpec(profile.manifest.dependencies?.[PACKAGE_NAME])
|
||||
|| !inside(join(runtime.profileDir, 'node_modules'), installed.directory);
|
||||
result.installedVersion = typeof installed.manifest.version === 'string' ? installed.manifest.version : null;
|
||||
result.packageValid = await validPackage(installed);
|
||||
const loaded = await loadedPackage;
|
||||
|
|
@ -298,8 +300,7 @@ export function createUpdateRuntime(options = {}) {
|
|||
if (boundProfile !== undefined && boundProfile !== identity) result.blockedReason = 'installation-changed';
|
||||
else if (!sameLoadedPackage && boundProfile === undefined) result.blockedReason = 'installation-changed';
|
||||
else if (!result.packageValid) result.blockedReason = 'invalid-installation';
|
||||
else if (!registrySpec(profile.manifest.dependencies?.[PACKAGE_NAME])
|
||||
|| !inside(join(runtime.profileDir, 'node_modules'), installed.directory)) result.blockedReason = 'source-install';
|
||||
else if (result.sourceInstall) result.blockedReason = 'source-install';
|
||||
else if (runtime.blockedReason) result.blockedReason = runtime.blockedReason;
|
||||
else if (!sameLoadedPackage) result.blockedReason = 'pending-restart';
|
||||
else if (preflight) await checkRegistry(runtime);
|
||||
|
|
|
|||
|
|
@ -201,6 +201,8 @@ export function createUpdateService({
|
|||
latestVersion: checked?.release.version ?? null,
|
||||
profileName: environment.profileName ?? null,
|
||||
environmentKind: environment.environmentKind ?? 'cli',
|
||||
// Preserve source protection even when restart/recovery takes status priority.
|
||||
sourceInstall: environment.sourceInstall === true || environment.blockedReason === 'source-install',
|
||||
canInstall,
|
||||
blockedReason,
|
||||
checkedAt: checked?.checkedAt ?? null,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue