mirror of
https://github.com/ILoveBingLu/CipherTalk.git
synced 2026-03-24 06:59:30 +08:00
Update README version to 1.0.6 and add script to automate version updates
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
# 密语 CipherTalk
|
||||
|
||||
[](LICENSE)
|
||||
[](package.json)
|
||||
[](package.json)
|
||||
[]()
|
||||
|
||||
基于 Electron + React + TypeScript 构建的聊天记录查看工具界面,基于原项目 [EchoTrace](https://github.com/ycccccccy/echotrace) 重构。
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
"main": "dist-electron/main.js",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"prebuild": "node scripts/update-readme-version.js",
|
||||
"build": "tsc && vite build && electron-builder && node scripts/add-size-to-yml.js",
|
||||
"preview": "vite preview",
|
||||
"electron:dev": "vite --mode electron",
|
||||
|
||||
30
scripts/update-readme-version.js
Normal file
30
scripts/update-readme-version.js
Normal file
@@ -0,0 +1,30 @@
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
|
||||
const packageJsonPath = path.join(__dirname, '../package.json')
|
||||
const readmePath = path.join(__dirname, '../README.md')
|
||||
|
||||
// 读取 package.json 获取版本号
|
||||
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'))
|
||||
const version = packageJson.version
|
||||
|
||||
if (!version) {
|
||||
console.error('未找到版本号')
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
// 读取 README.md
|
||||
let readmeContent = fs.readFileSync(readmePath, 'utf-8')
|
||||
|
||||
// 使用正则表达式替换版本号
|
||||
// 匹配 [](package.json)
|
||||
const versionPattern = /(\[!\[Version\]\(https:\/\/img\.shields\.io\/badge\/version-)([0-9]+\.[0-9]+\.[0-9]+)(-green\.svg\)\]\(package\.json\))/
|
||||
|
||||
if (versionPattern.test(readmeContent)) {
|
||||
readmeContent = readmeContent.replace(versionPattern, `$1${version}$3`)
|
||||
fs.writeFileSync(readmePath, readmeContent, 'utf-8')
|
||||
console.log(`✅ 已更新 README.md 中的版本号为: ${version}`)
|
||||
} else {
|
||||
console.error('❌ 未找到版本号徽章,请检查 README.md 格式')
|
||||
process.exit(1)
|
||||
}
|
||||
Reference in New Issue
Block a user