Skip to content

Commit c7f1e3b

Browse files
committed
fix(docs): avoid vitepress build failure when git is unavailable
1 parent a583452 commit c7f1e3b

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

docs/.vitepress/config.mts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
import { defineConfig } from "vitepress";
22
import { withPwa } from "@vite-pwa/vitepress";
33
import { groupIconVitePlugin } from "vitepress-plugin-group-icons";
4+
import { spawnSync } from "node:child_process";
45

56
const SITE_URL = "https://cli.fishxcode.com";
67
const SITE_TITLE = "FishXCode CLI";
78
const SITE_DESC =
89
"AI 编码工具管理器 — 一键接入 FishXCode API,支持 claude-code、aider、codex、opencode 等主流工具";
910

1011
const BASE = (process.env.VITEPRESS_BASE ?? "/").replace(/([^/])$/, "$1/");
12+
const hasGit = spawnSync("git", ["--version"], { stdio: "ignore" }).status === 0;
1113

1214
function p(path: string) {
1315
return BASE.replace(/\/$/, "") + path;
@@ -18,7 +20,7 @@ export default withPwa(
1820
base: BASE,
1921
title: SITE_TITLE,
2022
description: SITE_DESC,
21-
lastUpdated: true,
23+
lastUpdated: hasGit,
2224
cleanUrls: true,
2325
srcExclude: ["**/CLAUDE.md"],
2426
rewrites: {

0 commit comments

Comments
 (0)