- Keyboard:? 帮助浮层 + t 明暗 + g-chords 导航(300ms 缓冲,输入域旁路);
路由表经 data-routes 注入(module 脚本 currentScript 为 null 的坑)
- BuildInfo:vite.define 四重回退注入 commit/时间,hash 链到 gitea
- ClientRouter 页面转场(reduced-motion 降级在 global.css 总闸)
- ProjectWall:构建时双源拉取(gitea+github)置顶排序+缓存兜底,零运行时 JS
- Header 补主题可视切换钮:键盘 t 的触屏等价物(同 key 同逻辑)
验证: pnpm astro build exit 0;dist 标记 built from×2/kbd-help×4/
view-transition×2; astro check 未跑(无类型错误构建期可证伪面有限)
Spec: 2026-10-24_add-blog-skeleton
Co-authored-by: GLM-5.3
25 lines
921 B
JavaScript
25 lines
921 B
JavaScript
// @ts-check
|
|
import { defineConfig } from 'astro/config';
|
|
import { execSync } from 'node:child_process';
|
|
|
|
// 构建透明(T7):commit/时间经 vite.define 注入,页脚与 /about 引用。
|
|
// 四重回退:CI 环境变量优先(GITEA_ACTIONS/GITHUB_SHA)→ 本地 git → dev 占位。
|
|
const sha =
|
|
process.env.GITEA_COMMIT_SHA ||
|
|
process.env.GITHUB_SHA ||
|
|
(() => { try { return execSync('git rev-parse HEAD').toString().trim(); } catch { return 'dev'; } })();
|
|
const date =
|
|
process.env.GITEA_COMMIT_DATE ||
|
|
process.env.GITHUB_COMMIT_DATE ||
|
|
(() => { try { return execSync('git log -1 --format=%cI').toString().trim(); } catch { return new Date().toISOString(); } })();
|
|
|
|
export default defineConfig({
|
|
site: 'https://wait4x.online',
|
|
vite: {
|
|
define: {
|
|
'import.meta.env.GIT_COMMIT_SHA': JSON.stringify(sha),
|
|
'import.meta.env.GIT_COMMIT_DATE': JSON.stringify(date),
|
|
},
|
|
},
|
|
});
|