Skip to content

Commit 35e01f0

Browse files
committed
Fix git version variable.
1 parent e3edad2 commit 35e01f0

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

astro.config.mjs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ import deleteUnusedImages from "astro-delete-unused-images";
1313
import preload from "astro-preload";
1414
import { execSync } from "node:child_process";
1515

16+
let gitVersion = "";
17+
try {
18+
gitVersion = execSync("git rev-parse --short HEAD 2>&1 > /dev/null");
19+
} catch (e) {}
20+
1621
// https://astro.build/config
1722
export default defineConfig({
1823
vite: {
@@ -22,7 +27,7 @@ export default defineConfig({
2227
.replace(/[-:T.Z]/g, "")
2328
.slice(0, 14),
2429
"import.meta.env.GIT_VERSION": new String(
25-
execSync("git rev-parse --short HEAD")
30+
gitVersion
2631
),
2732
},
2833
resolve: {

0 commit comments

Comments
 (0)