From dadc4fa5e44e6b38d1953fa7ffaa226a8f891e4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=8B=E4=BA=91?= Date: Mon, 28 Apr 2025 22:19:15 +0800 Subject: [PATCH] Update build.js --- build/build.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/build/build.js b/build/build.js index af19913b..9b1e93ef 100644 --- a/build/build.js +++ b/build/build.js @@ -15,10 +15,8 @@ function calculateSHA1(filePath) { function getGitTimestamp(filePath) { try { - // 文件创建时间 - const fs = require('fs'); - const stats = fs.statSync(filePath); - return stats.mtime; // 或 stats.ctime + const time = execSync(`git log -1 --format="%ai" -- ${filePath}`).toString().trim(); + return time || 'No commit found'; } catch (e) { console.warn(`无法通过 Git 获取时间: ${filePath}`, e); return null;