Skip to content

Commit

Permalink
fix: Set version to 0.0.1 when git is unable to determine a version i…
Browse files Browse the repository at this point in the history
…n case no tags exist in repository (#402)
  • Loading branch information
pziemkowski authored Sep 25, 2023
1 parent 85a8b6d commit 07cda15
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions packages/internal/cli/src/config/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,16 @@ export async function loadVersionEnv() {
return process.env.VERSION;
}

const { stdout: versionRaw } = await exec(
'git describe --tags --first-parent --abbrev=11 --long --dirty --always',
);
let versionRaw = '';
try {
const { stdout } = await exec(
'git describe --tags --first-parent --abbrev=11 --long --dirty --always',
);
versionRaw = stdout;
} catch {
versionRaw = '0.0.1';
}

const version = versionRaw.trim();
process.env.VERSION = version;
return version;
Expand Down

0 comments on commit 07cda15

Please sign in to comment.