@tuya-client/thing-hmbom-plugin
v0.0.2
Published
类似maven的bom功能,管理鸿蒙组件依赖
Readme
English | 简体中文
@tuya-client/thing-hmbom-plugin
HarmonyOS build extension plugin, similar to Maven's BOM (Bill of Materials), for unified management of project component version dependencies.
Features
- Version Overrides - Read version definitions from
sdk-requirements.jsonto enforce unified component versions across the project - Dependency Injection - Automatically add components from
thing-biz-components.jsonto HAP dependencies - Build Assurance (RuntimeOnly) - Add business components to runtimeOnly to ensure they exist during build
Installation
$ npm install @tuya-client/thing-hmbom-plugin
# or
$ yarn add @tuya-client/thing-hmbom-pluginUsage
1. Import the plugin in HAP module's hvigorfile.ts
import { thingBOMPlugin } from '@tuya-client/thing-hmbom-plugin';
import { hapTasks } from '@ohos/hvigor-ohos-plugin';
export default {
system: hapTasks,
plugins: [
thingBOMPlugin()
]
}2. Create configuration files in HAP module directory
thing-biz-components.json (Business component list)
{
"components": {
"@thingsmart/thingrouter": "1.0.0",
"@thingsmart/device": "1.1.73",
"@thingsmart/home": "1.2.21"
}
}sdk-requirements.json (Global version definitions)
{
"tag": "main",
"versions": {
"@thingsmart/thingrouter": "1.0.0",
"@thingsmart/device": "1.1.73",
"@thingsmart/home": "1.2.21",
"@thingsmart/security": "2.0.12"
}
}Version Priority
When the same component has inconsistent versions in both configuration files, sdk-requirements.json takes precedence.
License
MIT
