Skip to content

Commit

Permalink
modus new: Fix issues with Go/TinyGo version detection (#540)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattjohnsonpint authored Oct 31, 2024
1 parent f263cf8 commit c8cd5ac
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
# Change Log

## 2024-10-30 - CLI 0.13.6

- `modus new`: Initialize git repo on interactive flow [#538](https://github.com/hypermodeinc/modus/pull/538)
- `modus new`: Skip confirmation if all required params are provided [#539](https://github.com/hypermodeinc/modus/pull/539)
- `modus new`: Fix issues with Go/TinyGo version detection [#540](https://github.com/hypermodeinc/modus/pull/540)

## 2024-10-30 - AssemblyScript SDK 0.13.3

- Actually fix issue with git info capture [#537](https://github.com/hypermodeinc/modus/pull/537)
- `modus new`: Initialize git repo on interactive flow: [#538](https://github.com/hypermodeinc/modus/pull/538)

## 2024-10-30 - AssemblyScript SDK 0.13.2

Expand Down
11 changes: 9 additions & 2 deletions cli/src/util/systemVersions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ export async function getGoVersion(): Promise<string | undefined> {
const parts = result.stdout.split(" ");
const str = parts.length > 2 ? parts[2] : undefined;
if (str?.startsWith("go")) {
return str.slice(2);
const ver = str.slice(2);

// if version is two parts, add a .0 to make it semver compatible
return ver.split(".").length === 2 ? ver + ".0" : ver;
}
} catch {}
}
Expand All @@ -30,7 +33,11 @@ export async function getTinyGoVersion(): Promise<string | undefined> {
try {
const result = await execFile("tinygo", ["version"], EXEC_OPTIONS);
const parts = result.stdout.split(" ");
return parts.length > 2 ? parts[2] : undefined;
const ver = parts.length > 2 ? parts[2] : undefined;
if (!ver) return undefined;

// if version is two parts, add a .0 to make it semver compatible
return ver.split(".").length === 2 ? ver + ".0" : ver;
} catch {}
}

Expand Down

0 comments on commit c8cd5ac

Please sign in to comment.