npm i @ftd-zf/cli -g
- ftdcli init projectname 初始化项目模版
- ftdcli taropage pagename 新建 Taro 页面模块
- ftdcli tarocomponent componentname 新建 Taro 组件模块
- ftdcli gen 根据 swagger 文档自动化生成前端 service 代码
- ftdcli oss 将资源上传阿里 OSS
- ftdcli lint 对项目进行代码检查,并生成检查结果文件
- fdtcli taropage-all 根据配置文件,生成所有 Taro 页面
- ftdcli taropage-ai 通过AI生成Taro页面
- ftdcli taropage-ai-all 根据配置文件,通过AI生成所有Taro页面
- ftdcli rnpage-ai 通过AI生成ReactNative页面
- ftdcli rnpage-all-ai 根据配置文件,通过AI生成所有ReactNative页面
{
"openApi": [
{
"requestLibPath": "",
"schemaPath": "",
"projectName": "",
"serversPath": ""
}
],
"upload": {
"dir": [
{
"assestDir": "",
"ossFileName": ""
}
],
"aliOSS": {
"region": "",
"accessKeyId": "",
"accessKeySecret": "",
"bucket": ""
}
},
"generateStatus": {
"value": false,
"description": "是否使用过page-all命令"
},
"ai": {
"aiModel": "",
"baseURL": "",
"apiKey": ""
}
}
- openApi 中 (可配置多个 swagger json 文档)
| 参数 | 描述 |
|---|---|
| requestLibPath | 当前请求方法文件相对路径 |
| schemaPath | swagger json 文档(本地文件或在线地址) |
| projectName | 生成文件名 |
| serversPath | 生成文件相对路径 |
- upload 中 dir(可配置多个上传文件)
| 参数 | 描述 |
|---|---|
| assestDir | 本地需要上传资源文件的相对路径 |
| ossFileName | 上传资源文件名 |
-
upload 中 aliOSS (参考阿里 oss 参数配置信息)
-
generateStatus 中 value (是否使用过 相关page-all 命令)
-
ai 中参数说明
| 参数 | 描述 |
|---|---|
| aiModel | AI 模型名称 |
| baseURL | AI 服务地址 |
| apiKey | AI 服务 apiKey |
-
ftdcli gen 和 ftdcli oss 需要配置文件 template.config.json 才能进行使用,均为项目根目录执行命令
-
ftdcli taropage [pagename] 创建页面 需要在 Taro 项目下,pages 文件夹下进行操作,同时在 pages 目录下生成 nav.js 文件,用于项目中页面跳转使用
-
ftdcli tarocomponent [componentname] 创建组件 在 Taro 项目中即可使用
-
ftdcli oss 命令仅用于上传资源,项目中还需将本地资源的引用路径转化为 oss 线上地址(可用插件 https://github.com/FTD-ZF/babel-plugin-replace-assets-with-url)
[
{
"title": "home",
"description": "主页",
"pageImg": ""
"children": [
{
"title": "detail",
"description": "详情",
"pageImg": ""
"children": [
{
"title": "detail1",
"description": "详情1",
"pageImg": ""
}
]
}
]
},
{
"title": "mine",
"description": "个人中心",
"pageImg": ""
"children": [
{
"title": "setting",
"description": "设置",
"pageImg": ""
},
{
"title": "info",
"description": "个人信息",
"pageImg": ""
}
]
}
]