Update build.js

This commit is contained in:
秋云
2025-04-28 22:19:15 +08:00
committed by GitHub
parent 9578f650cd
commit dadc4fa5e4

View File

@@ -15,10 +15,8 @@ function calculateSHA1(filePath) {
function getGitTimestamp(filePath) { function getGitTimestamp(filePath) {
try { try {
// 文件创建时间 const time = execSync(`git log -1 --format="%ai" -- ${filePath}`).toString().trim();
const fs = require('fs'); return time || 'No commit found';
const stats = fs.statSync(filePath);
return stats.mtime; // 或 stats.ctime
} catch (e) { } catch (e) {
console.warn(`无法通过 Git 获取时间: ${filePath}`, e); console.warn(`无法通过 Git 获取时间: ${filePath}`, e);
return null; return null;