赞
踩
打包工具:ets2bundle
工具仓库:https://gitee.com/openharmony/developtools_ace_ets2bundle
依赖仓库:https://gitee.com/openharmony/interface_sdk-js
1、配置工具依赖
interface_sdk-js仓库为此工具提供组件类型信息,在打包脚本中需要正确配置
"scripts": {
"build": "npm run generateDeclarations && ./node_modules/.bin/babel ./src --out-dir lib --extensions .ts && node uglify-source.js lib",
"generateDeclarations": "node ./build_declarations_file.js ../../interface_sdk-js/api/@internal/component/ets ./declarations ./lib",
}
2、配置本地组件依赖
"dependencies": {
"typescript": "file:./deps/ohos-typescript-4.2.3-r2.tgz",
"arkguard": "file:./deps/arkguard-1.0.0.tgz"
}
3、下载依赖+编译
$ npm install
$ npm run build
工具位于developtools_ace_ets2bundle/compiler目录。
1、创建arkui工程
$ npm run create xxxx
2、编译工程
$ npm run compile
1、打包ViewPU
默认打包出来的继承View,修改manifest.json文件中的minPlatformVersion值为9,是数字9,即可实现打包出来的View继承ViewPU。或者直接修改create.ts文件,将默认的1.0.1字符串修改是数字9也可以。
"appID": "com.example.` + appID + `",
"appName": "` + appName + `",
"versionName": "1.0.0",
"versionCode": 1,
//"minPlatformVersion": "1.0.1",
"minPlatformVersion": 9,
"pages": [
"pages/index"
],
2、修改编译默认地址
默认的项目地址在compiler目录下,如果在其他地方,可修改webpack.config.js
文件中projectPath值,到指定目录
if (args.indexOf('projectName') === args.length - 2) {
// projectConfig.projectPath = path.join(process.cwd(), args[args.length - 1]);
projectConfig.projectPath = path.join("/home/client/Desktop", args[args.length - 1]);
}
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。