From 836f183b153a6f60761e92644af08d641cbaad28 Mon Sep 17 00:00:00 2001 From: Matt Johnson-Pint Date: Tue, 6 May 2025 10:38:09 -0700 Subject: [PATCH 1/4] reuse sdk install command in modus dev --- cli/src/commands/dev/index.ts | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/cli/src/commands/dev/index.ts b/cli/src/commands/dev/index.ts index 55dd56110..41cc14c91 100644 --- a/cli/src/commands/dev/index.ts +++ b/cli/src/commands/dev/index.ts @@ -25,6 +25,7 @@ import { getAppInfo } from "../../util/appinfo.js"; import { isOnline, withSpinner } from "../../util/index.js"; import { readHypermodeSettings } from "../../util/hypermode.js"; import BuildCommand from "../build/index.js"; +import SDKInstallCommand from "../sdk/install/index.js"; import { BaseCommand } from "../../baseCommand.js"; const MANIFEST_FILE = "modus.json"; @@ -85,16 +86,7 @@ export default class DevCommand extends BaseCommand { } if (!(await vi.sdkVersionIsInstalled(sdk, sdkVersion))) { - const sdkText = `Modus ${sdk} SDK ${sdkVersion}`; - await withSpinner(chalk.dim("Downloading and installing " + sdkText), async (spinner) => { - try { - await installer.installSDK(sdk, sdkVersion); - } catch (e) { - spinner.fail(chalk.red(`Failed to download ${sdkText}`)); - throw e; - } - spinner.succeed(chalk.dim(`Installed ${sdkText}`)); - }); + await SDKInstallCommand.run([sdk, sdkVersion, "--no-logo"]); } let runtimeVersion = flags.runtime; From 9a533c77fee539aeb36c12e8f95faac5dcb3ba51 Mon Sep 17 00:00:00 2001 From: Matt Johnson-Pint Date: Tue, 6 May 2025 10:55:48 -0700 Subject: [PATCH 2/4] detect and fix bad go sdk install --- cli/src/util/versioninfo.ts | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/cli/src/util/versioninfo.ts b/cli/src/util/versioninfo.ts index de744a6b2..bd28f5668 100644 --- a/cli/src/util/versioninfo.ts +++ b/cli/src/util/versioninfo.ts @@ -7,7 +7,9 @@ * SPDX-License-Identifier: Apache-2.0 */ +import chalk from "chalk"; import semver from "semver"; +import os from "node:os"; import path from "node:path"; import * as http from "./http.js"; import * as fs from "./fs.js"; @@ -179,7 +181,28 @@ export async function runtimeReleaseExists(version: string): Promise { } export async function sdkVersionIsInstalled(sdk: globals.SDK, version: string): Promise { - return await fs.exists(getSdkPath(sdk, version)); + // normal check for SDK path + const sdkPath = getSdkPath(sdk, version); + const installed = await fs.exists(sdkPath); + if (!installed) { + return false; + } + + // extra check for Go build tool, due to prior issue with it not being installed in all cases + if (sdk == globals.SDK.Go) { + const ext = os.platform() === "win32" ? ".exe" : ""; + const buildTool = path.join(sdkPath, "modus-go-build" + ext); + if (await fs.exists(buildTool)) { + return true; + } + + // SDK installed, but build tool not found, so delete and return false so it can be reinstalled + console.log(chalk.yellow(`ⓘ Detected incomplete installation of Modus Go SDK ${version}. Reinstalling...`)); + await fs.rm(sdkPath, { recursive: true, force: true }); + return false; + } + + return installed; } export async function runtimeVersionIsInstalled(version: string): Promise { From e752988097262b580ca3cee189516ff13085c300 Mon Sep 17 00:00:00 2001 From: Matt Johnson-Pint Date: Tue, 6 May 2025 10:55:57 -0700 Subject: [PATCH 3/4] Update CHANGELOG.md --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 598c0f449..4e3701dd3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ # Change Log +## 2025-05-06 - CLI 0.17.4 + +- fix: fully install go sdk in dev mode [#811](https://github.com/hypermodeinc/modus/pull/811) + ## 2025-04-29 - Go SDK 0.17.4 - fix: Relax postgresql connString regex to allow host to be templated [#830](https://github.com/hypermodeinc/modus/pull/830) From 3d25462d345c331f23ca83cdb6bd3b6991891141 Mon Sep 17 00:00:00 2001 From: Matt Johnson-Pint Date: Tue, 6 May 2025 11:11:00 -0700 Subject: [PATCH 4/4] Update cli/src/util/versioninfo.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- cli/src/util/versioninfo.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli/src/util/versioninfo.ts b/cli/src/util/versioninfo.ts index bd28f5668..a3f918917 100644 --- a/cli/src/util/versioninfo.ts +++ b/cli/src/util/versioninfo.ts @@ -189,7 +189,7 @@ export async function sdkVersionIsInstalled(sdk: globals.SDK, version: string): } // extra check for Go build tool, due to prior issue with it not being installed in all cases - if (sdk == globals.SDK.Go) { + if (sdk === globals.SDK.Go) { const ext = os.platform() === "win32" ? ".exe" : ""; const buildTool = path.join(sdkPath, "modus-go-build" + ext); if (await fs.exists(buildTool)) {