mdlife-cli
v1.0.1
Published
MDLife命令行工具
Downloads
9
Maintainers
Readme
mdlife-cli
一个MDLife开发的简单工具集合,目前暂只支持安卓真机同步和widget命令压缩
安装
先决条件:Node.js (>= 12.x) 代码中使用的ES2018的await/async语法,需要最新版本的Node.js支持
$ npm install --save-dev mdlife-cli
使用
1. 查看使用帮助
查看整个命令的使用帮助
$ npx mdlife -h
查看具体操作命令的使用帮助
$ npx mdlife android -h # 安卓升级
$ npx mdlife package -h # 压缩widget命令使用帮助
2. 安卓真机同步
基本方法(使用项目下dict目录为源代码目录进行真机同步测试)
$ npx mdlife android
指定源代码目录
$ npx mdlife android -s mdlife-demo
仅重连日志(用于USB线断开、调整logcat参数等情况)
$ npx mdlife android -l
3. 压缩Widget包
基本方法(使用项目下dict目录为源代码目录压缩Widget包)
$ npx mdlife package
指定源代码目录
$ npx mdlife android -s mdlife-demo
4. 配置参数
- -s, --src 操作源文件目录,默认为当前路径下的dict目录
- -l, --log 仅与android命令结合使用,不同步代码,仅重连日志
- -h, --help 输出命令行帮助使用手册,如果指定cmd参数,查看指定命令的使用说明
配置文件
.mdliferc
在项目根目录下添加.mdliferc文件,对mdlife命令行工具进行配置,有以下配置
{
"adb": "", // 安卓真机同步使用的adb工具路径,win32平台有自带adb工具,其他系统需要手工设置
"mainActivity": "", // 安卓MDLoader启动主类,默认为com.yinhai.hybird.md.engine.ui.SplashActivity,一般不需要修改
"logcat": [] // 安卓真机同步时logcat命令参数,默认只取MDLIFE_Debuger的日志
}
package.json
可以在项目package.json中增加mdlife配置项,内容和.mdliferc相同
{
"mdlife": {}
}
其他
1. 打包和同步时忽略文件
- 所有以"."开头的文件和目录(隐藏文件)
- 所有以".log"结尾的文件和目录(日志文件)
- CustomLoader 目录(自定义loader)
2. 需要提供自定义Loader
工具未提供默认的自定义load实现,项目需要提供自定义loader实现