|
@@ -0,0 +1,152 @@
|
|
|
+const fs = require('fs');
|
|
|
+
|
|
|
+const args = process.argv.slice(2)[0];
|
|
|
+const filesToModify = ['./src/manifest.json', './src/pages.json'];
|
|
|
+filesToModify.forEach((file) => {
|
|
|
+ fs.readFile(file, 'utf8', function (err, data) {
|
|
|
+ if (err) throw err;
|
|
|
+ let cleanedData = data.replace(/\/\/.*|\/\*[\s\S]*?\*\//g, '');// 使用正则表达式去除单行注释
|
|
|
+ let state = JSON.parse(cleanedData);// 解析JSON数据
|
|
|
+
|
|
|
+ if (file == './src/manifest.json') {
|
|
|
+ var maps = state["app-plus"].distribute.sdkConfigs.maps
|
|
|
+ var geolocation = state["app-plus"].distribute.sdkConfigs.geolocation
|
|
|
+ var icons = state["app-plus"].distribute.icons
|
|
|
+ var push = state["app-plus"].distribute.sdkConfigs.push
|
|
|
+
|
|
|
+ if (args === 'huiYi') {
|
|
|
+ state.name = '智能会议'
|
|
|
+ state.appid = '__UNI__F3963F8'
|
|
|
+ state.description = '智能会议APP,是一款集成了现代信息技术和智能化管理功能的移动应用程序,旨在提升会议体验和管理效率。'
|
|
|
+ state.versionName = "1.0.3"
|
|
|
+ state.versionCode = 3
|
|
|
+ state.h5.title = '智能会议'
|
|
|
+
|
|
|
+ maps.amap.name = "amapBOujshtbA"
|
|
|
+ maps.amap.appkey_ios = "fb35d03fbb17cbf7a8743a522da3c7fc"
|
|
|
+ maps.amap.appkey_android = "ffc71dfd4e576596027f8f45a1b8fb2f"
|
|
|
+
|
|
|
+ geolocation.amap.name = "amapBOujshtbA"
|
|
|
+ geolocation.amap.appkey_ios = "fb35d03fbb17cbf7a8743a522da3c7fc"
|
|
|
+ geolocation.amap.appkey_android = "ffc71dfd4e576596027f8f45a1b8fb2f"
|
|
|
+ geolocation.tencent.apikey_ios = "EGOBZ-74ZET-ST7XS-VYICT-RBLHZ-KLFEX"
|
|
|
+ geolocation.tencent.apikey_android = "EGOBZ-74ZET-ST7XS-VYICT-RBLHZ-KLFEX"
|
|
|
+ icons.android = {
|
|
|
+ "hdpi": "unpackage/res/icons/72x72.png",
|
|
|
+ "xhdpi": "unpackage/res/icons/96x96.png",
|
|
|
+ "xxhdpi": "unpackage/res/icons/144x144.png",
|
|
|
+ "xxxhdpi": "unpackage/res/icons/192x192.png"
|
|
|
+ }
|
|
|
+ icons.ios.appstore = "unpackage/res/icons/1024x1024.png"
|
|
|
+ icons.ios.ipad = {
|
|
|
+ "app": "unpackage/res/icons/76x76.png",
|
|
|
+ "app@2x": "unpackage/res/icons/152x152.png",
|
|
|
+ "notification": "unpackage/res/icons/20x20.png",
|
|
|
+ "notification@2x": "unpackage/res/icons/40x40.png",
|
|
|
+ "proapp@2x": "unpackage/res/icons/167x167.png",
|
|
|
+ "settings": "unpackage/res/icons/29x29.png",
|
|
|
+ "settings@2x": "unpackage/res/icons/58x58.png",
|
|
|
+ "spotlight": "unpackage/res/icons/40x40.png",
|
|
|
+ "spotlight@2x": "unpackage/res/icons/80x80.png"
|
|
|
+ }
|
|
|
+ icons.ios.iphone = {
|
|
|
+ "app@2x": "unpackage/res/icons/120x120.png",
|
|
|
+ "app@3x": "unpackage/res/icons/180x180.png",
|
|
|
+ "notification@2x": "unpackage/res/icons/40x40.png",
|
|
|
+ "notification@3x": "unpackage/res/icons/60x60.png",
|
|
|
+ "settings@2x": "unpackage/res/icons/58x58.png",
|
|
|
+ "settings@3x": "unpackage/res/icons/87x87.png",
|
|
|
+ "spotlight@2x": "unpackage/res/icons/80x80.png",
|
|
|
+ "spotlight@3x": "unpackage/res/icons/120x120.png"
|
|
|
+ }
|
|
|
+ push.unipush.icons.small = {
|
|
|
+ "hdpi": "unpackage/res/push/36x36.png",
|
|
|
+ "ldpi": "unpackage/res/push/18x18.png",
|
|
|
+ "mdpi": "unpackage/res/push/24x24.png",
|
|
|
+ "xhdpi": "unpackage/res/push/48x48.png",
|
|
|
+ "xxhdpi": "unpackage/res/push/72x72.png"
|
|
|
+ }
|
|
|
+ } else if (args === 'menJin') {
|
|
|
+ state.name = '智能门禁'
|
|
|
+ state.appid = '__UNI__8D6E9FD'
|
|
|
+ state.description = '智能门禁APP,是一款集成了现代信息技术和智能化管理功能的移动应用程序。'
|
|
|
+ state.versionName = "1.0.1"
|
|
|
+ state.versionCode = 2
|
|
|
+ state.h5.title = '智能门禁'
|
|
|
+
|
|
|
+ maps.amap.name = "amapBOujshtbA"
|
|
|
+ maps.amap.appkey_ios = "fb35d03fbb17cbf7a8743a522da3c7fc"
|
|
|
+ maps.amap.appkey_android = "ffc71dfd4e576596027f8f45a1b8fb2f"
|
|
|
+
|
|
|
+ geolocation.amap.name = "amapBOujshtbA"
|
|
|
+ geolocation.amap.appkey_ios = "fb35d03fbb17cbf7a8743a522da3c7fc"
|
|
|
+ geolocation.amap.appkey_android = "ffc71dfd4e576596027f8f45a1b8fb2f"
|
|
|
+ geolocation.tencent.apikey_ios = "EGOBZ-74ZET-ST7XS-VYICT-RBLHZ-KLFEX"
|
|
|
+ geolocation.tencent.apikey_android = "EGOBZ-74ZET-ST7XS-VYICT-RBLHZ-KLFEX"
|
|
|
+ icons.android = {
|
|
|
+ "hdpi": "unpackage/res/icons/72x72.png",
|
|
|
+ "xhdpi": "unpackage/res/icons/96x96.png",
|
|
|
+ "xxhdpi": "unpackage/res/icons/144x144.png",
|
|
|
+ "xxxhdpi": "unpackage/res/icons/192x192.png"
|
|
|
+ }
|
|
|
+ icons.ios.appstore = "unpackage/res/icons/1024x1024.png"
|
|
|
+ icons.ios.ipad = {
|
|
|
+ "app": "unpackage/res/icons/76x76.png",
|
|
|
+ "app@2x": "unpackage/res/icons/152x152.png",
|
|
|
+ "notification": "unpackage/res/icons/20x20.png",
|
|
|
+ "notification@2x": "unpackage/res/icons/40x40.png",
|
|
|
+ "proapp@2x": "unpackage/res/icons/167x167.png",
|
|
|
+ "settings": "unpackage/res/icons/29x29.png",
|
|
|
+ "settings@2x": "unpackage/res/icons/58x58.png",
|
|
|
+ "spotlight": "unpackage/res/icons/40x40.png",
|
|
|
+ "spotlight@2x": "unpackage/res/icons/80x80.png"
|
|
|
+ }
|
|
|
+ icons.ios.iphone = {
|
|
|
+ "app@2x": "unpackage/res/icons/120x120.png",
|
|
|
+ "app@3x": "unpackage/res/icons/180x180.png",
|
|
|
+ "notification@2x": "unpackage/res/icons/40x40.png",
|
|
|
+ "notification@3x": "unpackage/res/icons/60x60.png",
|
|
|
+ "settings@2x": "unpackage/res/icons/58x58.png",
|
|
|
+ "settings@3x": "unpackage/res/icons/87x87.png",
|
|
|
+ "spotlight@2x": "unpackage/res/icons/80x80.png",
|
|
|
+ "spotlight@3x": "unpackage/res/icons/120x120.png"
|
|
|
+ }
|
|
|
+ push.unipush.icons.small = {
|
|
|
+ "hdpi": "unpackage/res/push/36x36.png",
|
|
|
+ "ldpi": "unpackage/res/push/18x18.png",
|
|
|
+ "mdpi": "unpackage/res/push/24x24.png",
|
|
|
+ "xhdpi": "unpackage/res/push/48x48.png",
|
|
|
+ "xxhdpi": "unpackage/res/push/72x72.png"
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if ('./src/pages.json') {
|
|
|
+ state.pages.forEach((e, index) => {
|
|
|
+ if (args === 'huiYi') {
|
|
|
+ if (e.style.navigationBarTitleText === "人脸识别") {
|
|
|
+ if (index != 0) {
|
|
|
+ state.pages.splice(0, 1, ...state.pages.splice(index, 1, state.pages[0]))
|
|
|
+ }
|
|
|
+ }
|
|
|
+ state.condition.list[0].path = "pages/face/index"
|
|
|
+ } else if (args === 'menJin') {
|
|
|
+ if (e.style.navigationBarTitleText === "门禁识别") {
|
|
|
+ if (index != 0) {
|
|
|
+ state.pages.splice(0, 1, ...state.pages.splice(index, 1, state.pages[0]))
|
|
|
+ }
|
|
|
+ }
|
|
|
+ state.condition.list[0].path = "pages/door/index"
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ // 将修改后的对象转换回JSON字符串
|
|
|
+ const updated = JSON.stringify(state, null, 4);
|
|
|
+
|
|
|
+ // 写入新的配置到manifest.json
|
|
|
+ fs.writeFile(file, updated, 'utf8', function (err) {
|
|
|
+ if (err) throw err;
|
|
|
+ console.log(file + ' updated successfully');
|
|
|
+ });
|
|
|
+ });
|
|
|
+})
|
|
|
+
|