From 4aa5a238647e51e954af8a044162e783f1a4c0e3 Mon Sep 17 00:00:00 2001 From: Luk Date: Mon, 28 Oct 2024 23:55:42 +0800 Subject: [PATCH] u --- app_versioning.js | 4 ++-- package.json | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 package.json diff --git a/app_versioning.js b/app_versioning.js index 5d5e7ed..d8fda6a 100644 --- a/app_versioning.js +++ b/app_versioning.js @@ -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 } diff --git a/package.json b/package.json new file mode 100644 index 0000000..a56f911 --- /dev/null +++ b/package.json @@ -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" +}