TheRouter
是货拉拉基于HMRouter深度定制的开源路由框架,提供了 Android、iOS、Harmony 三端高一致性使用,在支持平台化应用实现组件化、跨模块调用、动态化等功能的集成等功能基础上,支持动态路由下发、编译时安全检查、路由Path一对多等高度动态能力。
Github: https://github.com/HuolalaTech/hll-wp-therouter-harmony/
官网:http://therouter.cn/
使用命令行:
git clone git@github.com:HuolalaTech/hll-wp-therouter-harmony.git
在项目根目录中,新建一个名为 build-profile.json5
的文件,文件内加入如下内容。
{
"app": {
"signingConfigs": [
// 签名部分需要手动从官网获取自己的开发者信息
],
"products": [
{
"name": "default",
"signingConfig": "xxxxx填上面的签名信息",
"compatibleSdkVersion": "可根据自己SDK情况填写",
"runtimeOS": "HarmonyOS",
"buildOption": {
"strictMode": {
"caseSensitiveCheck": true,
"useNormalizedOHMUrl": true
}
}
}
],
"buildModeSet": [
{
"name": "debug",
},
{
"name": "release"
}
]
},
"modules": [
{
"name": "entry",
"srcPath": "./entry",
"targets": [
{
"name": "default",
"applyToProducts": [
"default"
]
}
]
},
{
"name": "therouter",
"srcPath": "./therouter"
},
{
"name": "business_a",
"srcPath": "./business_a"
},
{
"name": "business_b",
"srcPath": "./business_b"
},
{
"name": "base",
"srcPath": "./base"
}
]
}
在工程根目录新建一个名为 hvigor
的文件夹
文件夹内新建一个名为 hvigor-config.json5
的文件,文件内加入如下内容:
{
"modelVersion": "根据实际情况填写版本号",
"dependencies": {
"@therouter/plugin": "根据实际情况填写版本号"
},
"execution": {
// "analyze": "normal", /* Define the build analyze mode. Value: [ "normal" | "advanced" | false ]. Default: "normal" */
// "daemon": true, /* Enable daemon compilation. Value: [ true | false ]. Default: true */
// "incremental": true, /* Enable incremental compilation. Value: [ true | false ]. Default: true */
// "parallel": true, /* Enable parallel compilation. Value: [ true | false ]. Default: true */
// "typeCheck": false, /* Enable typeCheck. Value: [ true | false ]. Default: false */
},
"logging": {
// "level": "info" /* Define the log level. Value: [ "debug" | "info" | "warn" | "error" ]. Default: "info" */
},
"debugging": {
// "stacktrace": false /* Disable stacktrace compilation. Value: [ true | false ]. Default: false */
},
"nodeOptions": {
// "maxOldSpaceSize": 8192 /* Enable nodeOptions maxOldSpaceSize compilation. Unit M. Used for the daemon process. Default: 8192*/
// "exposeGC": true /* Enable to trigger garbage collection explicitly. Default: true*/
}
}