21 lines
1.0 KiB
JavaScript
21 lines
1.0 KiB
JavaScript
const fs = require('fs')
|
||
const p = 'C:/Users/ASUS/Documents/deepseek-harness/default-workspace/desktop-pet/README.md'
|
||
const lines = fs.readFileSync(p, 'utf8').split(/\r?\n/)
|
||
|
||
const badges = [
|
||
'[](https://github.com/Tian-XiaRi/SodiumPet)',
|
||
'[](https://gitee.com/TianXiaRi/sodium-pet)',
|
||
'[](LICENSE)',
|
||
''
|
||
]
|
||
if (!lines.join('\n').includes('img.shields.io/badge/Gitee')) {
|
||
lines.splice(1, 0, ...badges)
|
||
}
|
||
const mirror = '> **仓库**:GitHub(主)<https://github.com/Tian-XiaRi/SodiumPet> · Gitee 国内镜像 <https://gitee.com/TianXiaRi/sodium-pet> · 欢迎 PR / issue'
|
||
if (!lines.join('\n').includes('Gitee 国内镜像')) {
|
||
const i = lines.findIndex((l) => l.startsWith('> 内置角色'))
|
||
lines.splice(i + 1, 0, mirror)
|
||
}
|
||
fs.writeFileSync(p, lines.join('\n'), 'utf8')
|
||
console.log('README patched')
|