提交 22accee5 编写于 作者: DCloud_JSON's avatar DCloud_JSON 提交者: study夏羽

v2版本正式发布

上级 76c9b054
## 2.0.0(2022-08-10)
- 重要:应用`uni-id-pages``uniIdRouter`
## 2.0.1(2022-09-16)
- 更改默认值
## 2.0.0(2022-09-16)
- 【重要】 v2版正式发布 应用`uni-id-pages``uniIdRouter`;(注意:此版本更新内容较多,升级请注意备份)
- 考虑到部分旧项目不想升级,保留`uni-starter v1`版源码,托管在仓库的[v1分支](https://gitcode.net/dcloud/uni-starter/-/blob/v1/README.md);继续使用v1版,遇到问题可以提交[Issue](https://gitcode.net/dcloud/uni-starter/-/issues/new?issue%5Bassignee_id%5D=&issue%5Bmilestone_id%5D=)有bug仍然会修复,但v1版本不再新增功能。
## 1.2.7(2022-08-10)
- 修复微信小程序绑定手机号失败的问题
## 1.2.6(2022-06-29)
......
{
"id": "uni-starter",
"displayName": "uni-starter",
"version": "2.0.0",
"version": "2.0.1",
"description": "云端一体应用快速开发基本项目模版",
"keywords": [
"login",
......
{
"scripts":{
"preupload": "node uni_modules_tools/main.js change",
"postupload": "node uni_modules_tools/main.js recovery"
}
}
\ No newline at end of file
const fs = require('fs');
module.exports = function(){
console.log('开始执行脚本change_after');
/* let changelog = fs.readFileSync(process.cwd() + '/changelog.md', 'utf-8').split("##")[1].split("\n").slice(1).join(' ');
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 -a -m "${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
{
"name": "uni_modules_tools",
"version": "1.0.0",
"description": "本插件是一个[uni_modules钩子脚本](https://uniapp.dcloud.io/uni_modules?id=uni_modulesconfigjson),仅限uni_modules插件使用 #### 为什么使用 uni_modules_tools 在实际开发中很多插件需要配置文件才可以正常运行,比如uni-id、uni-pay等; 有些配置内容属于密钥,在发表到插件市场的时候我们通常不希望这些配置被暴露。 传统的方式你需要手动备份密钥内容,上传结束后再将配置填回。这样插件作者发表插件会比较不便。",
"main": "main.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"hjson": "^3.2.2"
}
}
本插件是一个[uni_modules钩子脚本](https://uniapp.dcloud.io/uni_modules?id=uni_modulesconfigjson),仅限uni_modules插件使用
#### 为什么使用 uni_modules_tools
在实际开发中很多插件需要配置文件才可以正常运行,比如uni-id、uni-pay等;
有些配置内容属于密钥,在发表到插件市场的时候我们通常不希望这些配置被暴露。
传统的方式你需要手动备份密钥内容,上传结束后再将配置填回。这样插件作者发表插件会比较不便。
而现在有了 `uni_modules_tools` 只需配置`/uni_modules_tools/config.js`即实现
- 在插件上传之前,自动根据配置改写项目中对应配置。
- 上传结束(成功和失败都触发)后自动恢复项目中的配置。
#### 示例目录结构
<pre>
├─ uni_modules // 存放uni_module规范的插件。
│ └─uni-config-center
│ └─uniCloud
│ └─cloudfunctions
│ └─common
│ └─uni-config-center
│ └─uni-id
│ └─config.json
├─ manifest.json
├─ uni_modules.config.json //uni_modules的配置文件
└─ uni_modules_tools
├─ copy //用于自动修改配置文件时的,临时备份目录
├─ config.js //插件配置文件,下面会有示例说明
├─ main.js //插件核心代码,入口文件;你无需修改此文件中的代码,除非你了解内部逻辑
└─ readme.md //插件文档
</pre>
#### 使用方式
`/uni_modules_tools/config.js`的格式为:
```
{
"文件路径" : {"键名":"改后的内容"}
}
```
- 文件仅支持json格式,如:`manifest.json``uni-config-center`下的`config.json`
使用示例,比如你需要:
- 修改manifest.json文件的appid内容改为:请重新获取appid
- 修改uni_modules/uni-config-center/uniCloud/cloudfunctions/common/uni-config-center/uni-id/config.json 文件的内容app-plus -> oauth -> weixin 和 apple 下的 `appid` `appsecret` `apple`值为:`请填写你的自己的appid` `请填写你的自己的appsecret` `请填写你的自己的bundleId`
1. 配置,根目录下的`/uni_modules_tools/config.js`文件,如下:
```
{
"/manifest.json": {
"appid": "请重新获取appid"
},
"/uni_modules/uni-config-center/uniCloud/cloudfunctions/common/uni-config-center/uni-id/config.json": {
"app-plus": {
"oauth": {
"weixin": {
"appid": "请填写你的自己的appid",
"appsecret": "请填写你的自己的appsecret"
},
"apple": {
"bundleId": "请填写你的自己的bundleId"
}
}
}
}
}
```
2. 根目录下的`/uni_modules.config.json`配置如下:
```
{
"scripts":{
"preupload": "node uni_modules_tools/main.js change",
"postupload": "node uni_modules_tools/main.js recovery"
}
}
```
3. 项目依赖hjson-js需要在uni_modules_tools目录,执行npm install完成依赖的安装
#### 测试方式
- 在项目根目录直接执行 `node uni_modules_tools/main.js change` 即可测试修改相关配置的效果
- 在项目根目录直接执行 `node uni_modules_tools/main.js recovery` 即可测试恢复相关配置的效果
> 本插件中使用了[hjson-js](https://www.npmjs.com/package/hjson) 感谢@hjson-js的作者
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册