diff --git a/CHANGELOG.md b/CHANGELOG.md index 7714aeee..aae1c1f1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Change Log +## 2024-10-30 - AssemblyScript SDK 0.13.3 + +- Actually fix issue with git info capture [#537](https://github.com/hypermodeinc/modus/pull/537) + ## 2024-10-30 - AssemblyScript SDK 0.13.2 - Fix issue with git info capture [#536](https://github.com/hypermodeinc/modus/pull/536) diff --git a/sdk/assemblyscript/src/transform/src/metadata.ts b/sdk/assemblyscript/src/transform/src/metadata.ts index 85dc0dee..72fcf107 100644 --- a/sdk/assemblyscript/src/transform/src/metadata.ts +++ b/sdk/assemblyscript/src/transform/src/metadata.ts @@ -39,8 +39,15 @@ export class Metadata { m.sdk = getSdkInfo(); if (isGitRepo()) { - m.gitRepo = getGitRepo(); - m.gitCommit = getGitCommit(); + const gitRepo = getGitRepo(); + if (gitRepo) { + m.gitRepo = getGitRepo(); + } + + const gitCommit = getGitCommit(); + if (gitCommit) { + m.gitCommit = getGitCommit(); + } } return m; @@ -182,7 +189,11 @@ function isGitRepo(): boolean { function getGitRepo(): string | undefined { try { - let url = execSync("git remote get-url origin").toString().trim(); + let url = execSync("git remote get-url origin", { + stdio: ["ignore", "pipe", "ignore"], + }) + .toString() + .trim(); // Convert ssh to https if (url.startsWith("git@")) { @@ -202,7 +213,11 @@ function getGitRepo(): string | undefined { function getGitCommit(): string | undefined { try { - return execSync("git rev-parse HEAD").toString().trim(); + return execSync("git rev-parse HEAD", { + stdio: ["ignore", "pipe", "ignore"], + }) + .toString() + .trim(); } catch { return undefined; }