Update build.js

This commit is contained in:
秋云
2025-04-28 21:50:13 +08:00
committed by GitHub
parent 453c19bb31
commit a9831058e3

View File

@@ -38,10 +38,18 @@ function extractInfoFromCombatFile(filePath) {
.map(char => char.trim()) .map(char => char.trim())
.filter(char => char.length > 0 && !char.match(/^[,.]$/)); // 过滤掉单个逗号或句号 .filter(char => char.length > 0 && !char.match(/^[,.]$/)); // 过滤掉单个逗号或句号
let version = getGitTimestamp(filePath);
if (!version) {
version = calculateSHA1(filePath).substring(0, 7);
} else {
version = formatTime(version);
}
return { return {
author: authorMatch ? authorMatch[1].trim() : '', author: authorMatch ? authorMatch[1].trim() : '',
description: descriptionMatch ? convertNewlines(descriptionMatch[1].trim()) : '', description: descriptionMatch ? convertNewlines(descriptionMatch[1].trim()) : '',
tags: tags tags: tags,
version: version
}; };
} }
@@ -131,10 +139,18 @@ function extractInfoFromTCGFile(filePath, parentFolder) {
tags = ['酒馆挑战', ...tags]; tags = ['酒馆挑战', ...tags];
} }
let version = getGitTimestamp(filePath);
if (!version) {
version = calculateSHA1(filePath).substring(0, 7);
} else {
version = formatTime(version);
}
return { return {
author: authorMatch ? authorMatch[1].trim() : '', author: authorMatch ? authorMatch[1].trim() : '',
description: descriptionMatch ? convertNewlines(descriptionMatch[1].trim()) : '', description: descriptionMatch ? convertNewlines(descriptionMatch[1].trim()) : '',
tags: [...new Set(tags)] // 去重 tags: [...new Set(tags)], // 去重
version: version
}; };
} }