Update build.js
This commit is contained in:
@@ -15,9 +15,10 @@ function calculateSHA1(filePath) {
|
|||||||
|
|
||||||
function getGitTimestamp(filePath) {
|
function getGitTimestamp(filePath) {
|
||||||
try {
|
try {
|
||||||
// 获取最后一次提交时间(ISO 格式)
|
// 文件创建时间
|
||||||
const iso = execSync(`git log -1 --format=\"%ci\" -- "${filePath}"`, { encoding: 'utf8' }).trim();
|
const fs = require('fs');
|
||||||
return new Date(iso);
|
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;
|
||||||
|
|||||||
Reference in New Issue
Block a user