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

16
package.json Normal file
View File

@ -0,0 +1,16 @@
{
"name": "wo_scripts",
"version": "1.0.0",
"description": "",
"main": "app_versioning.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "https://git.faronear.org/npm/wo_scripts"
},
"keywords": [],
"author": "",
"license": "ISC"
}