123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115 |
- 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') {
- if (args === 'zhiHuiYun') {
- state.name = '综合智慧云'
- state.appid = '__UNI__36DE3A0'
- state.description = '综合智慧云APP,是一款助力于企业数字化的应用平台,帮助企业提升办公效率,实现组织数字化和业务数字化。'
- state.versionName = "2.1.9"
- state.versionCode = 19
- state.h5.title = '综合智慧云'
- } else if (args === 'xunJian') {
- state.name = '智能巡更'
- state.appid = '__UNI__BF1A1F0'
- state.description = '智能巡更app,是一款用于监督和记录巡逻人员按照预定路线和时间进行巡逻的系统。'
- state.versionName = "2.2.0"
- state.versionCode = 20
- state.h5.title = '智能巡更'
- } else if (args === 'huiYi') {
- state.name = '智能会议'
- state.appid = '__UNI__F3963F8'
- state.description = '智能会议APP,是一款集成了现代信息技术和智能化管理功能的移动应用程序,旨在提升会议体验和管理效率。'
- state.versionName = "2.0.1"
- state.versionCode = 1
- state.h5.title = '智能会议'
- }
- } else if ('./src/pages.json') {
- state.pages = [
- {
- "path": "pages/index",
- "style": {
- "navigationStyle": "custom",
- "navigationBarTitleText": "工作台",
- "app-plus": {
- "bounce": "none",
- "titleNView": false
- }
- }
- },
- {
- "path": "pages/login",
- "style": {
- "navigationBarTitleText": "登录",
- "navigationStyle": "custom",
- "navigationBarTextStyle": "black"
- }
- },
- {
- "path": "pages/register",
- "style": {
- "navigationBarTitleText": "注册",
- "navigationStyle": "custom",
- "navigationBarTextStyle": "black"
- }
- },
- {
- "path": "pages/serveConfigSelect",
- "style": {
- "navigationBarTitleText": "服务器配置",
- "navigationStyle": "custom",
- "navigationBarTextStyle": "black"
- }
- },
- {
- "path": "pages/serveConfig",
- "style": {
- "navigationBarTitleText": "服务器配置",
- "navigationStyle": "custom",
- "navigationBarTextStyle": "black"
- }
- },
- {
- "path": "pages/info",
- "style": {
- "navigationBarTitleText": "消息",
- "navigationStyle": "custom",
- "enablePullDownRefresh": false,
- "app-plus": {
- "bounce": "none",
- "titleNView": false
- }
- }
- },
- {
- "path": "pages/mine",
- "style": {
- "navigationBarTitleText": "我的",
- "navigationStyle": "custom",
- "app-plus": {
- "bounce": "none",
- "titleNView": false
- }
- }
- }
- ]
- }
- // 将修改后的对象转换回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');
- });
- });
- })
|