(channel: Channel)
| 130 | } |
| 131 | |
| 132 | export async function resolveUpdateTarget(channel: Channel): Promise<UpdateTarget> { |
| 133 | const platform = await detectPlatform(); |
| 134 | const version = await resolveVersion(channel); |
| 135 | const manifest = await fetchManifest(version); |
| 136 | |
| 137 | const entry = manifest.platforms[platform]; |
| 138 | if (!entry) { |
| 139 | throw new CLIError( |
| 140 | `Platform "${platform}" not found in manifest for ${version}.`, |
| 141 | ExitCode.GENERAL, |
| 142 | ); |
| 143 | } |
| 144 | |
| 145 | const downloadUrl = `https://github.com/${REPO}/releases/download/${version}/mmx-${platform}`; |
| 146 | return { version, downloadUrl, checksum: entry.checksum }; |
| 147 | } |
| 148 | |
| 149 | export async function applySelfUpdate(target: UpdateTarget, currentBin: string): Promise<void> { |
| 150 | const tmp = join(tmpdir(), `mmx-update-${Date.now()}`); |
nothing calls this directly
no test coverage detected