(
method: Extract<InstallMethod, { kind: 'bundle' }>,
pinned: string | undefined,
deps: UpgradeDeps
)
| 539 | } |
| 540 | |
| 541 | function upgradeUnixBundle( |
| 542 | method: Extract<InstallMethod, { kind: 'bundle' }>, |
| 543 | pinned: string | undefined, |
| 544 | deps: UpgradeDeps |
| 545 | ): number { |
| 546 | const downloader = deps.hasCommand('curl') |
| 547 | ? `curl -fsSL ${INSTALL_SH_URL}` |
| 548 | : deps.hasCommand('wget') |
| 549 | ? `wget -qO- ${INSTALL_SH_URL}` |
| 550 | : null; |
| 551 | if (!downloader) { |
| 552 | deps.error('Neither curl nor wget is available to download the installer.'); |
| 553 | deps.log(c.dim(`Install curl, or run manually: ${INSTALL_SH_URL} | sh`)); |
| 554 | return 1; |
| 555 | } |
| 556 | |
| 557 | const env: NodeJS.ProcessEnv = { ...process.env }; |
| 558 | if (method.installDir) env.CODEGRAPH_INSTALL_DIR = method.installDir; |
| 559 | if (pinned) env.CODEGRAPH_VERSION = pinned; |
| 560 | |
| 561 | deps.log(c.dim(`Running the installer (${downloader} | sh)…`)); |
| 562 | const code = deps.run('sh', ['-c', `${downloader} | sh`], env); |
| 563 | if (code !== 0) { |
| 564 | deps.error(`Installer exited with code ${code}.`); |
| 565 | return 1; |
| 566 | } |
| 567 | deps.log(''); |
| 568 | // No "open a new terminal" hedge here — after the swap, runUpgrade probes |
| 569 | // the PATH-resolved `codegraph --version` and reports the real outcome. |
| 570 | deps.log(c.green('✓ Upgrade complete.')); |
| 571 | deps.log(reindexAdvisory()); |
| 572 | return 0; |
| 573 | } |
| 574 | |
| 575 | /** Build the in-place Windows upgrade script (exported for unit-testing). */ |
| 576 | export function buildWindowsUpgradeScript(bundleRoot: string, version: string, arch: string): string { |
no test coverage detected