diff --git a/.gitignore b/.gitignore index 269295a6105bf7c8a7197f19c64d66cb0d317372..7e6f18615fe9e5d35b6591b005a416245eb40d1e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ unpackage/ .hbuilderx node_modules -.DS_Store \ No newline at end of file +.DS_Store +uni_modules_tools/copy \ No newline at end of file diff --git a/changelog.md b/changelog.md index 85ff0ba2d55e8ab9ddfcbeff824f378d6f986873..4a93f5a21f947544d6388acb49e50dac18d18e89 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,7 @@ +## 1.0.14(2021-06-07) +修改错误的表名称uni-verify为opendb-verify-codes +## 1.0.13(2021-06-04) +新增一键登陆界面的第三方快捷登陆按钮 ## 1.0.12(2021-05-28) 修复拦截器在ios app端会报错:Unhandled promise...的问题 ## 1.0.10(2021-05-27) diff --git a/package.json b/package.json index 921eacb2c54f350969783e18b4d8394bbdf6bc5d..ebf3c99e6fd7dde5555bdefe5978f573561cfd56 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "id": "uni-starter", "displayName": "uni-starter", - "version": "1.0.12", + "version": "1.0.14", "description": "云端一体应用快速开发模版", "keywords": [ "uni-starter", @@ -12,7 +12,7 @@ ], "repository": "https://codechina.csdn.net/dcloud/uni-starter.git", "engines": { - "HBuilderX": "^3.1.16" + "HBuilderX": "^3.1.17" }, "dcloudext": { "category": [ diff --git a/uniCloud-aliyun/cloudfunctions/uni-id-cf/index.js b/uniCloud-aliyun/cloudfunctions/uni-id-cf/index.js index 01def7fed3ce21fb0a268b42d99a8c7f3becd5c7..b2fc69675077eee647820e41a4cef3166b52ab9a 100644 --- a/uniCloud-aliyun/cloudfunctions/uni-id-cf/index.js +++ b/uniCloud-aliyun/cloudfunctions/uni-id-cf/index.js @@ -219,7 +219,7 @@ exports.main = async (event, context) => { type: params.type }) // 简单限制一下客户端调用频率 - const ipLimit = await db.collection('uni-verify').where({ + const ipLimit = await db.collection('opendb-verify-codes').where({ ip: context.CLIENTIP, created_at: dbCmd.gt(Date.now() - 60000) }).get() diff --git a/uni_modules_tools/change_after.js b/uni_modules_tools/change_after.js new file mode 100644 index 0000000000000000000000000000000000000000..502f3e7ef82f000d3a085d030fc2476dedcf2e28 --- /dev/null +++ b/uni_modules_tools/change_after.js @@ -0,0 +1,25 @@ +const fs = require('fs'); +module.exports = function(){ + console.log('开始执行脚本change_after'); + let changelog = fs.readFileSync(process.cwd()+'/changelog.md', 'utf-8').split("\n")[1]; + console.log(changelog); + + // 这里是修改完相关敏感配置后执行的脚本,你可以在这里自定义逻辑, + // 比如执行git提交命令 + var shell = require("shelljs"); + var exec = shell.exec; + + if (exec('git add .').code !== 0) { + shell.echo('Error: Git add failed'); + shell.exit(1); + } + if (exec(`git commit -am "${changelog}"`).code !== 0) { + shell.echo('Error: Git commit failed'); + shell.exit(1); + } + if (exec('git push').code !== 0) { + shell.echo('Error: Git commit failed'); + shell.exit(1); + } + shell.exec(`echo git success ${changelog}`); +} \ No newline at end of file diff --git a/uni_modules_tools/main.js b/uni_modules_tools/main.js index 4e2b476d6af259c84f37b54264dc561bfbfcb652..9b0c5936e681e65b31a40b9bc3a3e3b92f5b03ca 100644 --- a/uni_modules_tools/main.js +++ b/uni_modules_tools/main.js @@ -5,27 +5,34 @@ const fs = require('fs'), Hjson = require('hjson'), config = Hjson.rt.parse(fs.readFileSync(__dirname+'/config.js', 'utf-8')) - +const change_after = require('./change_after') if(process.argv[2] == 'change'){ - change(config) + change(config,()=>{ + console.log('脚本change已经执行成功'); + change_after() + }) }else{ recovery(config) } -function change(config){ +function change(config,callback){ + const total = Object.keys(config).length + let index = 0; for (let fileName in config) { let path = process.cwd() + fileName let copyPath = __dirname + '/copy' + fileName let fileText = fs.readFileSync(path, 'utf-8') - //保持原文件名先备份一份到脚本目录下 - writeFileRecursive(copyPath, fileText, function(err) { + //保持原文件名先备份一份到/uni_modules_tools/copy目录下,然后再覆盖 + writeFileRecursive(copyPath, fileText, function(err) { //创建目录并写入文件 if (err) { return console.log(err); } //改写 let HfileObj = Hjson.rt.parse(fileText) + //递归合并,为了保留注释内容 mergeJSON(HfileObj,config[fileName]) + fs.writeFile(path, Hjson.rt.stringify(HfileObj, { quotes: 'all', separator: true, @@ -35,6 +42,10 @@ function change(config){ if (err) { return console.log(err); } + index++ + if(index == total){ + callback() + } }) }) }