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

@@ -37,11 +37,19 @@ function extractInfoFromCombatFile(filePath) {
const tags = [...new Set(characterMatches || [])] const tags = [...new Set(characterMatches || [])]
.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
}; };
} }
@@ -130,11 +138,19 @@ function extractInfoFromTCGFile(filePath, parentFolder) {
if (filePath.includes('酒馆挑战')) { if (filePath.includes('酒馆挑战')) {
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
}; };
} }