This commit is contained in:
Luk
2024-10-28 23:55:42 +08:00
parent 80f0ceb906
commit 4aa5a23864
2 changed files with 18 additions and 2 deletions

View File

@@ -3,7 +3,7 @@ const fs = require('fs')
// 读取 manifest.json ,修改后重新写入
// https://uniapp.dcloud.net.cn/collocation/vue-config.html
const manifestPath = path.join(__dirname, 'manifest.json')
const manifestPath = path.resolve('manifest.json')
let Manifest = fs.readFileSync(manifestPath, { encoding: 'utf-8' })
function replaceManifest (path, value) {
const arr = path.split('.')
@@ -18,7 +18,7 @@ function replaceManifest (path, value) {
const hasComma = /,/.test(item)
ManifestArr[index] = item.replace(
new RegExp(`"${lastItem}"[\\s\\S]*:[\\s\\S]*`),
`"${lastItem}" : ${value}${hasComma ? ',' : ''}`
`"${lastItem}": ${value}${hasComma ? ',' : ''}`
)
break
}