1
0
mirror of https://github.com/hanxi/xiaomusic.git synced 2025-12-10 15:28:15 +08:00

docs: changelog 页面问题

This commit is contained in:
涵曦
2024-12-13 20:52:26 +08:00
parent 96083bee89
commit 3737c7359f
5 changed files with 13 additions and 4 deletions

View File

@@ -135,6 +135,14 @@ function copyFile(source: string, destination: string) {
}
}
// 在文件开头插入内容
function prependToFile(filePath: string, text: string) {
const content = fs.readFileSync(filePath, 'utf-8');
const updatedContent = `${text}\n\n${content}`;
fs.writeFileSync(filePath, updatedContent, 'utf-8');
console.log(`Prepended text to ${filePath}`);
}
function replaceGithubAssetUrls(content: string, githubProxy: string): string {
const pattern1 = /https:\/\/github\.com\/[^\/]+\/[^\/]+\/assets\/[\w-]+/g;
const pattern2 = /https:\/\/github\.com\/user-attachments\/assets\/[\w-]+/g;
@@ -182,6 +190,7 @@ export default function GitHubIssuesPlugin(options: GitHubIssuesPluginOptions):
const changelogSource = path.join(process.cwd(), '../CHANGELOG.md');
const changelogDestination = path.join(docsDir, 'changelog.md');
copyFile(changelogSource, changelogDestination);
prependToFile(changelogDestination, '# 变更日志');
for (const issue of issues) {
// 仅处理包含 "文档" 标签的 issue