feat: SodiumPet 小钠桌宠 v0.1.0(Live2D 桌宠 / 经济任务 / 音乐 / 成就 / 编辑器 / MOD)
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
const fs = require('fs')
|
||||
const p = 'C:/Users/ASUS/Documents/deepseek-harness/default-workspace/desktop-pet/src/shared/petState.ts'
|
||||
const lines = fs.readFileSync(p, 'utf8').split('\n')
|
||||
let fixed = 0
|
||||
for (let i = 0; i < lines.length; i++) {
|
||||
const line = lines[i]
|
||||
if (!/^ \{ id: '/.test(line)) continue
|
||||
const trimmed = line.trimEnd()
|
||||
if (trimmed.endsWith('},') || trimmed === '}') continue
|
||||
// 找到数组的最后一个元素:下一行(跳过空行)以 ] 开头
|
||||
let j = i + 1
|
||||
while (j < lines.length && lines[j].trim() === '') j++
|
||||
const isLast = j < lines.length && /^\s*\]/.test(lines[j])
|
||||
lines[i] = trimmed + (isLast ? ' }' : ' },')
|
||||
fixed++
|
||||
}
|
||||
fs.writeFileSync(p, lines.join('\n'), 'utf8')
|
||||
console.log('lines repaired:', fixed)
|
||||
Reference in New Issue
Block a user