aiot-toolkit 1.0.20-importfile-dev.2 → 2.0.1-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/README.md +26 -192
  2. package/lib/bin.d.ts +2 -0
  3. package/lib/bin.js +229 -0
  4. package/lib/bin.js.map +1 -0
  5. package/lib/builder/IBuilder.d.ts +22 -0
  6. package/lib/builder/IBuilder.js +4 -0
  7. package/lib/builder/IBuilder.js.map +1 -0
  8. package/lib/builder/UxBuilder.d.ts +26 -0
  9. package/lib/builder/UxBuilder.js +102 -0
  10. package/lib/builder/UxBuilder.js.map +1 -0
  11. package/lib/builder/XtsBuilder.d.ts +15 -0
  12. package/lib/builder/XtsBuilder.js +65 -0
  13. package/lib/builder/XtsBuilder.js.map +1 -0
  14. package/lib/interface/CommandInterface.d.ts +15 -0
  15. package/lib/interface/CommandInterface.js +4 -0
  16. package/lib/interface/CommandInterface.js.map +1 -0
  17. package/lib/interface/VelaEmulatorInterface.d.ts +8 -0
  18. package/lib/interface/VelaEmulatorInterface.js +4 -0
  19. package/lib/interface/VelaEmulatorInterface.js.map +1 -0
  20. package/lib/utils/AdbUtils.d.ts +14 -0
  21. package/lib/utils/AdbUtils.js +103 -0
  22. package/lib/utils/AdbUtils.js.map +1 -0
  23. package/lib/utils/DeviceUtil.d.ts +62 -0
  24. package/lib/utils/DeviceUtil.js +366 -0
  25. package/lib/utils/DeviceUtil.js.map +1 -0
  26. package/lib/utils/RequestUtils.d.ts +11 -0
  27. package/lib/utils/RequestUtils.js +90 -0
  28. package/lib/utils/RequestUtils.js.map +1 -0
  29. package/lib/utils/VelaAvdUtils.d.ts +39 -0
  30. package/lib/utils/VelaAvdUtils.js +308 -0
  31. package/lib/utils/VelaAvdUtils.js.map +1 -0
  32. package/lib/waiter.d.ts +3 -0
  33. package/lib/waiter.js +39 -0
  34. package/lib/waiter.js.map +1 -0
  35. package/package.json +33 -47
  36. package/CHANGELOG.md +0 -353
  37. package/bin/index.js +0 -495
  38. package/gen-webpack-conf/get-devtool.js +0 -51
  39. package/gen-webpack-conf/helpers.js +0 -143
  40. package/gen-webpack-conf/index.js +0 -436
  41. package/gen-webpack-conf/manifest-schema.js +0 -284
  42. package/gen-webpack-conf/validate.js +0 -284
  43. package/lib/commands/compile.js +0 -2
  44. package/lib/commands/debug.js +0 -2
  45. package/lib/commands/init.js +0 -2
  46. package/lib/commands/packages.js +0 -2
  47. package/lib/commands/preview.js +0 -2
  48. package/lib/commands/report.js +0 -2
  49. package/lib/commands/resign.js +0 -2
  50. package/lib/commands/update.js +0 -2
  51. package/lib/commands/utils.js +0 -2
  52. package/lib/index.js +0 -2
  53. package/lib/plugins/manifest-watch-plugin.js +0 -2
  54. package/lib/utils.js +0 -2
package/README.md CHANGED
@@ -1,207 +1,41 @@
1
- # aiot-toolkit
1
+ # `aiot-toolkit`
2
2
 
3
- A command line toolkit for developing Aiot Quick Apps.
3
+ > aiot-toolkit 命令行工具
4
4
 
5
- ### 如何使用
5
+ ## 使用
6
6
 
7
- 1. 全局安装 aiot-toolkit
7
+ ## 贡献代码
8
8
 
9
- ```sh
10
- npm install -g aiot-toolkit
11
- ```
9
+ ### 增加打包支持的项目
12
10
 
13
- 2. 新建示例工程,方便开发者快速上手
11
+ 1. 在`./src/builder` 中新增类文件 XBuilder,并实现 IBuilder接口
14
12
 
15
- ```sh
16
- aiot init `<project-name>`
17
- ```
13
+ ```js
14
+ import ParamType from '@aiot-toolkit/commander/lib/interface/IParam'
15
+ import IBuild from './IBuild'
18
16
 
19
- 3. 安装 npm 依赖
17
+ class XBuilder implements IBuild {
18
+ params: ParamType[] = []
19
+ build(projectPath: string, options: any): void {
20
+ throw new Error('Method not implemented.')
21
+ }
22
+ match(projectPath: string): boolean {
23
+ throw new Error('Method not implemented.')
24
+ }
25
+ }
26
+ export default XBuilder
20
27
 
21
- ```sh
22
- cd `<project-name>`
23
- npm install
24
28
  ```
25
29
 
26
- 4. 开发项目
30
+ 2. 实现对应的方法
31
+ 3. 新增静态属性:
27
32
 
28
- ```sh
29
- npm run start
30
- npm run server
33
+ ```js
34
+ static readonly PROJECT_TYPE = '项目类型的名称'
31
35
  ```
32
36
 
33
- 5. 构建项目
37
+ 4. 在`./src/bin.ts` 的 `builderTypeList`中添加 XBuilder
34
38
 
35
- ```sh
36
- npm run build
37
- npm run release
39
+ ```js
40
+ const builderTypeList = [UxBuild, XtsBuild, XBuilder]
38
41
  ```
39
-
40
- 6. 其他命令([请参考开发者文档](https://doc.quickapp.cn/))
41
-
42
- ### 版本日志(详情请在 node_modules 中查看 CHANGELOG)
43
-
44
- #### [1.0.19] - 2023-10-24
45
-
46
- - 支持 `protobuf` 二进制版本 css 添加 `object` 值
47
- - 支持二进制添加 `cdc` 函数
48
- - 支持远程组件 `remotewidget`
49
- - 支持 `vela` 项目中 css 的 `@media`
50
- - 修改 `url` 匹配的写法
51
- - 修复 `ux` 瘦身,image、css 被意外删除的问题
52
- - 优化 `image` 的 `src` 属性值
53
- - 优化动态组件的函数
54
- - 增加 manifest.json 中的 `minAPILevel`
55
-
56
- #### [1.0.18] - 2023-08-02
57
-
58
- - 支持打包 Android 浮窗
59
- - 支持编译 `jsc` 字节码
60
- - 支持`Block-static dynamic`
61
- - 修复中文名称路径的签名问题
62
- - 修复 `vela` 项目唤起 Android 快应用调试器的问题
63
- - 优化 `protobuf` 二进制
64
- - 更新工具版本: `"node": ">=14.0.0"`
65
-
66
- #### [1.0.17] - 2023-04-26
67
-
68
- - 支持 `scroll` 组件
69
- - 支持 `maml` 组件(和`image`组件一致)
70
- - 修复路径为变量时,未转换成绝对路径的问题
71
- - `server` 命令新增 `--devtool` 配置参数
72
- - 增加 `maskRepeat` 属性
73
- - 增加 CSS 属性 `box-shadow`、`text-shadow` 和 `background-blend-mode`
74
-
75
- #### [1.0.16] - 2022-12-02
76
-
77
- - 支持打包应用服务 service 文件
78
- - 支持元素 `static` 属性的编译优化
79
- - 支持打包编译`.so`或`.jidl`文件
80
- - 修复 `src` 属性、行内样式等问题
81
- - 增加 `maml` 快应用组件配置文件
82
- - 增加 `enableOpsWrap`与`disableBuildRpk`参数
83
-
84
- #### [1.0.15] - 2022-08-16
85
-
86
- - 支持 `vela` 项目 --enable-custom-component 参数
87
- - 修复 `installdbg` 命令无法使用的问题
88
- - 增加供 ide 使用的安装调试工具 APK 函数
89
- - 增加 build 文件夹中的 `META-INF` 文件
90
-
91
- #### [1.0.14] - 2022-06-22
92
-
93
- - 修复 `vela` 项目 for 列表 tid 属性错误的问题
94
-
95
- #### [1.0.13] - 2022-06-15
96
-
97
- - 支持 `vela` 项目的全局样式
98
- - 支持 `vela` 项目 --enable-ops-wrap、--enable-export-function 参数
99
- - 重构 `vela` 项目的编译时函数
100
- - 修复 `vela` 项目 for、if 属性丢失等问题
101
- - 增加 `vela` 项目 jsc 转译功能
102
-
103
- #### [1.0.12] - 2022-03-23
104
-
105
- - 支持 `vela` 项目中事件参数可以加上{{}}
106
- - 修复 `vela` 项目 this 文本转换问题
107
- - 增加 `vela` 项目 qrcode 标签
108
-
109
- #### [1.0.11] - 2022-02-09
110
-
111
- - 支持 `vela` 项目分离文件中可以 import 文件
112
- - 修复 `vela` 项目热更新的问题
113
- - 增加 `vela` 项目基础模板
114
-
115
- #### [1.0.10] - 2021-11-30
116
-
117
- - 支持 `vela` 项目 template、js、css 分开编译
118
- - 修复 `H5` 项目监听 manifest 文件位置错误的问题
119
- - 增加 `aiot-toolkit` 项目的测试用例
120
-
121
- #### [1.0.9] - 2021-10-29
122
-
123
- - 支持 `vela` 项目编译时可带参数自启动 `nuttx` 模拟器
124
- - 修复 `vela` 模板中 for 编译错误的问题
125
-
126
- #### [1.0.8] - 2021-09-27
127
-
128
- - 支持 `vela` 项目 color 值带 alpha 通道的十六进制,如: `#fffa`、`#ff0011aa`
129
- - 增加 `vela` 项目的自动化测试
130
- - 增加 `vela` 项目的热更新
131
- - 修复 `H5` 项目中多级目录复制文件错误的问题
132
-
133
- #### [1.0.7] - 2021-08-24
134
-
135
- - `progress` 组件支持 `radius` 等样式
136
-
137
- #### [1.0.6] - 2021-07-05
138
-
139
- - 修复 `vela` 项目中属性 `@KEYFRAMES` 丢失的问题
140
- - 支持 `vela` 项目的原生组件 `chart`
141
- - 更新 H5 项目模板默认全屏处理
142
-
143
- #### [1.0.5] - 2021-06-23
144
-
145
- - 更新 H5 项目模板
146
-
147
- #### [1.0.4]
148
-
149
- - `vela` 应用中支持 `@keyframes` 样式
150
-
151
- #### [1.0.3]
152
-
153
- - 新增 `vela` 应用中 `progress` 组件的 `type` 属性支持 `arc` 值
154
-
155
- #### [1.0.2]
156
-
157
- - 新增 `aiot packages` 命令,可独立打包 rpk
158
- - 更新 H5 项目模板
159
-
160
- #### [1.0.1]
161
-
162
- - 增加 vela 项目的依赖模拟器 velasim
163
-
164
- #### [1.0.0]
165
-
166
- - 增加 vela 项目模板及编译打包能力
167
- - 增加 H5 项目模板及编译打包能力
168
- - 适配骨架屏功能
169
- - 添加打包来源及其他数据埋点文件
170
- - 增加项目重新签名的能力,新增命令行 resign
171
- - 新增 toolkit 增加在快应用注入输出 log 的能力
172
- - 支持编译全局公共组件
173
- - 增加编译动态引入 js 文件的能力,即开发者可以使用 import().then()的方式引入 js 文件
174
- - 调试器 支持`chrome[google-chrome]`浏览器和`chromium[chromium-browser]`浏览器
175
- - 增加了对多语言包打包的能力
176
- - 兼容 android 10 以上版本的 USB 调试功能
177
- - 增加 ux 项目提取公共 css 样式的能力
178
- - 增加快应用项目的 e2e 测试能力
179
- - 增加测试 ux 项目的代码覆盖率的能力
180
- - toolkit 配置统一使用 quickapp.config.js,兼容 hap.config.js
181
- - 支持抽取公共 js 文件的能力,使用方法为编译选项设置--split-chunks-mode <value>;默认不启动,value 为 smart 时启动该能力
182
- - 增加 lint 能力,开发者可以使用 eslint 模块对项目进行校验和格式化
183
- - 支持 app 全局样式的编译
184
- - 解决 template 里字符串模板错乱问题
185
- - 添加`--disable-stream-pack`参数用于禁用流式包(`build`,`release`,`watch`命令有效)
186
- - 支持自定义配置
187
- - 修复了 aiot update --force 时 JS 报错的问题
188
- - 1040 平台支持
189
- - 不再支持`node 6`,要求`node 8`以上版本
190
- - 不再创建备份文件
191
- - 新增`web`预览功能,打开服务`/preview`页面可使用浏览器预览快应用
192
- - 新增`aiot preview`子命令,可直接预览`rpk`文件或解压的`rpk`文件目录(包括`build`目录)
193
- - 新增`aiot view`子命令,可用于直接查看`rpk` 文件。详情可执行`aiot view --help`查看
194
- - 监听模式增加监听`manifest.json`文件
195
- - 支持分包
196
- - `chrome devtools` 升级到 66
197
- - 修复初始化模块的 elisnt 配置无效的问题
198
- - 优化错误栈信息
199
- - 修复`toolkit`误报使用`node`原生模块问题
200
- - 项目 package.json 的依赖只有 hap-toolkit,移除了其他依赖
201
- - 支持 postcss 解析 css
202
- - 支持可以自定义属性 data-xxx
203
- - slot 可以作为 text 的子组件
204
- - WebSocket 支持 ArrayBuffer
205
- - 更新对部分新属性,新事件,新样式的支持
206
-
207
- [反馈问题](https://github.com/quickappcn/issues/issues/new/choose)
package/lib/bin.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
package/lib/bin.js ADDED
@@ -0,0 +1,229 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
4
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
5
+ return new (P || (P = Promise))(function (resolve, reject) {
6
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
7
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
8
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
9
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
10
+ });
11
+ };
12
+ var __importDefault = (this && this.__importDefault) || function (mod) {
13
+ return (mod && mod.__esModule) ? mod : { "default": mod };
14
+ };
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ const commander_1 = require("@aiot-toolkit/commander");
17
+ const emulator_1 = require("@aiot-toolkit/emulator");
18
+ const shared_utils_1 = require("@aiot-toolkit/shared-utils");
19
+ const ColorConsole_1 = __importDefault(require("@aiot-toolkit/shared-utils/lib/ColorConsole"));
20
+ const create_aiot_1 = require("create-aiot");
21
+ const os_1 = __importDefault(require("os"));
22
+ const path_1 = __importDefault(require("path"));
23
+ const UxBuilder_1 = __importDefault(require("./builder/UxBuilder"));
24
+ const XtsBuilder_1 = __importDefault(require("./builder/XtsBuilder"));
25
+ const DeviceUtil_1 = __importDefault(require("./utils/DeviceUtil"));
26
+ const VelaAvdUtils_1 = __importDefault(require("./utils/VelaAvdUtils"));
27
+ const waiter_1 = __importDefault(require("./waiter"));
28
+ // 配置支持的 builder 类型,新增的项目类型,只需在此处加上类型
29
+ const builderTypeList = [UxBuilder_1.default, XtsBuilder_1.default];
30
+ function findBuilder(projectPath) {
31
+ for (const item of builderTypeList) {
32
+ const instance = new item();
33
+ if (instance.match(projectPath)) {
34
+ return instance;
35
+ }
36
+ }
37
+ return new UxBuilder_1.default();
38
+ }
39
+ function build(command, description) {
40
+ const projectPath = process.cwd();
41
+ const builder = findBuilder(projectPath);
42
+ const paramList = builder === null || builder === void 0 ? void 0 : builder.params;
43
+ return {
44
+ name: command,
45
+ description,
46
+ paramList,
47
+ action: (option) => __awaiter(this, void 0, void 0, function* () {
48
+ // 获取对应的 build;如果存在,执行 build 函数,不存在,提示
49
+ const projectPath = process.cwd();
50
+ const builder = findBuilder(projectPath);
51
+ if (builder) {
52
+ const { watch } = option;
53
+ yield builder.build(projectPath, option);
54
+ if (watch) {
55
+ waiter_1.default.describe();
56
+ waiter_1.default.start();
57
+ }
58
+ }
59
+ else {
60
+ ColorConsole_1.default.log({
61
+ message: `This type of project is not currently supported. The supported projects are: ${builderTypeList
62
+ .map((item) => item.PROJECT_TYPE)
63
+ .join('、')}`,
64
+ level: shared_utils_1.LOG_LEVEL.Error,
65
+ isOnlyPrintError: true
66
+ });
67
+ }
68
+ })
69
+ };
70
+ }
71
+ function start(command, description) {
72
+ const avdList = VelaAvdUtils_1.default.velaAvdCls.getVelaAvdList();
73
+ return {
74
+ name: command,
75
+ description,
76
+ paramList: [
77
+ {
78
+ name: 'avdname',
79
+ description: 'name of the avd to start',
80
+ type: 'select',
81
+ choices: avdList.map((item) => {
82
+ return { value: item.avdName };
83
+ }),
84
+ enableInquirer: true
85
+ },
86
+ {
87
+ name: 'devtool',
88
+ description: 'source map config'
89
+ },
90
+ {
91
+ name: 'disableNSH',
92
+ description: 'disable goldfish NSH terminal',
93
+ defaultValue: false,
94
+ type: 'confirm'
95
+ }
96
+ ],
97
+ action: (option) => __awaiter(this, void 0, void 0, function* () {
98
+ const goldfishInstance = new emulator_1.GoldfishInstance({
99
+ sdkHome: path_1.default.resolve(os_1.default.homedir(), '.export'),
100
+ avdHome: path_1.default.resolve(os_1.default.homedir(), '.android/avd'),
101
+ projectPath: process.cwd()
102
+ });
103
+ const startOptions = {
104
+ avdName: option.avdname,
105
+ devtool: option.devtool,
106
+ disableNSH: option.disableNSH
107
+ };
108
+ goldfishInstance.start(startOptions);
109
+ // waiter
110
+ const startWaiter = new commander_1.PersistentCommand({
111
+ description: 'aiot-toolkit start 的常驻命令',
112
+ options: [
113
+ {
114
+ key: 'r',
115
+ description: `重启快应用 ${option.disableNSH ? '' : '(需要手动关闭模拟器)'}`,
116
+ action() {
117
+ console.log('重启中......');
118
+ goldfishInstance.stop();
119
+ goldfishInstance.start(startOptions);
120
+ }
121
+ },
122
+ {
123
+ key: '?',
124
+ description: '显示所有命令',
125
+ action() {
126
+ startWaiter.clearLog();
127
+ startWaiter.describe();
128
+ }
129
+ }
130
+ ]
131
+ });
132
+ startWaiter.describe();
133
+ startWaiter.start();
134
+ })
135
+ };
136
+ }
137
+ function main() {
138
+ return __awaiter(this, void 0, void 0, function* () {
139
+ const aiotCreate = yield (0, create_aiot_1.getAiotCreateCommand)();
140
+ const config = {
141
+ name: 'aiot-toolkit',
142
+ description: 'contains build, dev, release, etc. commands for aiot toolkit',
143
+ version: '2.0.1',
144
+ commandList: [
145
+ build('build', 'build project'),
146
+ start('start', 'start project in goldfish'),
147
+ {
148
+ name: 'getConnectedDevices',
149
+ description: 'get all connected devices',
150
+ action: (option) => __awaiter(this, void 0, void 0, function* () {
151
+ try {
152
+ const connectedDevices = yield DeviceUtil_1.default.getAllConnectedDevices();
153
+ ColorConsole_1.default.log({
154
+ message: `The connected devices are: ${connectedDevices ? connectedDevices.join(', ') : 'null'}`
155
+ });
156
+ }
157
+ catch (error) {
158
+ ColorConsole_1.default.log({ message: error.message, level: shared_utils_1.LOG_LEVEL.Error });
159
+ }
160
+ })
161
+ },
162
+ {
163
+ name: 'getPlatforms',
164
+ description: 'get available platform(s) on selected device',
165
+ paramList: [
166
+ {
167
+ name: 'ip',
168
+ description: 'device ip(eg 127.0.0.1)',
169
+ type: 'string',
170
+ enableInquirer: true
171
+ },
172
+ {
173
+ name: 'port',
174
+ description: 'device port(eg 39517)',
175
+ type: 'string',
176
+ enableInquirer: true
177
+ },
178
+ {
179
+ name: 'sn',
180
+ description: 'view the serial number of the connected device through the "adb devices" command, if it is a device connected via wifi, the format is "ip address:5555"',
181
+ type: 'string',
182
+ enableInquirer: true
183
+ }
184
+ ],
185
+ action: (option) => __awaiter(this, void 0, void 0, function* () {
186
+ yield DeviceUtil_1.default.getAvailablePlatform(option);
187
+ })
188
+ },
189
+ {
190
+ name: 'installDbgAndMkp',
191
+ description: 'install "org.hapjs.debugger" & "org.hapjs.mockup" ',
192
+ paramList: [
193
+ {
194
+ name: 'ip',
195
+ description: 'device ip(eg 127.0.0.1)',
196
+ type: 'string'
197
+ },
198
+ {
199
+ name: 'port',
200
+ description: 'device ip(eg 5555)',
201
+ type: 'string'
202
+ }
203
+ ],
204
+ action: (option) => __awaiter(this, void 0, void 0, function* () {
205
+ try {
206
+ const successMessage = yield DeviceUtil_1.default.installDbgAndMkp(option);
207
+ ColorConsole_1.default.log({ message: successMessage, level: shared_utils_1.LOG_LEVEL.Success });
208
+ }
209
+ catch (error) {
210
+ ColorConsole_1.default.log({ message: error.message, level: shared_utils_1.LOG_LEVEL.Error });
211
+ }
212
+ })
213
+ },
214
+ {
215
+ name: 'createVelaAvd',
216
+ description: 'create a vela avd instance',
217
+ action: () => __awaiter(this, void 0, void 0, function* () {
218
+ VelaAvdUtils_1.default.createVelaAvdByInquire();
219
+ })
220
+ },
221
+ Object.assign(Object.assign({}, aiotCreate), { name: 'create', description: 'create aiot project' })
222
+ ]
223
+ };
224
+ commander_1.Command.registeProgram(config);
225
+ });
226
+ }
227
+ main();
228
+
229
+ //# sourceMappingURL=bin.js.map
package/lib/bin.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["bin.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAEA,uDAAwF;AACxF,qDAAyD;AACzD,6DAAsD;AACtD,+FAAsE;AACtE,6CAAkD;AAClD,4CAAmB;AACnB,gDAAuB;AAEvB,oEAA2C;AAC3C,sEAA6C;AAC7C,oEAA2C;AAC3C,wEAA8C;AAC9C,sDAA6B;AAC7B,qCAAqC;AACrC,MAAM,eAAe,GAAG,CAAC,mBAAS,EAAE,oBAAU,CAAC,CAAA;AAE/C,SAAS,WAAW,CAAC,WAAmB;IACtC,KAAK,MAAM,IAAI,IAAI,eAAe,EAAE;QAClC,MAAM,QAAQ,GAAG,IAAI,IAAI,EAAE,CAAA;QAC3B,IAAI,QAAQ,CAAC,KAAK,CAAC,WAAW,CAAC,EAAE;YAC/B,OAAO,QAAQ,CAAA;SAChB;KACF;IACD,OAAO,IAAI,mBAAS,EAAE,CAAA;AACxB,CAAC;AAED,SAAS,KAAK,CAAC,OAAe,EAAE,WAAmB;IACjD,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,EAAE,CAAA;IACjC,MAAM,OAAO,GAAG,WAAW,CAAC,WAAW,CAAC,CAAA;IACxC,MAAM,SAA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b,IAAI,EAAE,QAAQ,EACd,WAAW,EAAE,qBAAqB;aAErC;SACF,CAAA;QACD,mBAAO,CAAC,cAAc,CAAC,MAAM,CAAC,CAAA;IAChC,CAAC;CAAA;AACD,IAAI,EAAE,CAAA","file":"bin.js","sourcesContent":["#!/usr/bin/env node\n\nimport { Command, ICommand, IProgram, PersistentCommand } from '@aiot-toolkit/commander'\nimport { GoldfishInstance } from '@aiot-toolkit/emulator'\nimport { LOG_LEVEL } from '@aiot-toolkit/shared-utils'\nimport ColorConsole from '@aiot-toolkit/shared-utils/lib/ColorConsole'\nimport { getAiotCreateCommand } from 'create-aiot'\nimport os from 'os'\nimport path from 'path'\nimport IBuilder from './builder/IBuilder'\nimport UxBuilder from './builder/UxBuilder'\nimport XtsBuilder from './builder/XtsBuilder'\nimport DeviceUtil from './utils/DeviceUtil'\nimport VelaAvdUtil from './utils/VelaAvdUtils'\nimport waiter from './waiter'\n// 配置支持的 builder 类型,新增的项目类型,只需在此处加上类型\nconst builderTypeList = [UxBuilder, XtsBuilder]\n\nfunction findBuilder(projectPath: string): IBuilder | undefined {\n for (const item of builderTypeList) {\n const instance = new item()\n if (instance.match(projectPath)) {\n return instance\n }\n }\n return new UxBuilder()\n}\n\nfunction build(command: string, description: string): ICommand {\n const projectPath = process.cwd()\n const builder = findBuilder(projectPath)\n const paramList = builder?.params\n\n return {\n name: command,\n description,\n paramList,\n action: async (option: any) => {\n // 获取对应的 build;如果存在,执行 build 函数,不存在,提示\n const projectPath = process.cwd()\n const builder = findBuilder(projectPath)\n if (builder) {\n const { watch } = option\n await builder.build(projectPath, option)\n if (watch) {\n waiter.describe()\n waiter.start()\n }\n } else {\n ColorConsole.log({\n message: `This type of project is not currently supported. The supported projects are: ${builderTypeList\n .map((item) => item.PROJECT_TYPE)\n .join('、')}`,\n level: LOG_LEVEL.Error,\n isOnlyPrintError: true\n })\n }\n }\n }\n}\n\nfunction start(command: string, description: string): ICommand {\n const avdList = VelaAvdUtil.velaAvdCls.getVelaAvdList()\n return {\n name: command,\n description,\n paramList: [\n {\n name: 'avdname',\n description: 'name of the avd to start',\n type: 'select',\n choices: avdList.map((item) => {\n return { value: item.avdName }\n }),\n enableInquirer: true\n },\n {\n name: 'devtool',\n description: 'source map config'\n },\n {\n name: 'disableNSH',\n description: 'disable goldfish NSH terminal',\n defaultValue: false,\n type: 'confirm'\n }\n ],\n action: async (option: any) => {\n const goldfishInstance = new GoldfishInstance({\n sdkHome: path.resolve(os.homedir(), '.export'),\n avdHome: path.resolve(os.homedir(), '.android/avd'),\n projectPath: process.cwd()\n })\n const startOptions = {\n avdName: option.avdname,\n devtool: option.devtool,\n disableNSH: option.disableNSH\n }\n goldfishInstance.start(startOptions)\n // waiter\n const startWaiter: PersistentCommand = new PersistentCommand({\n description: 'aiot-toolkit start 的常驻命令',\n options: [\n {\n key: 'r',\n description: `重启快应用 ${option.disableNSH ? '' : '(需要手动关闭模拟器)'}`,\n action() {\n console.log('重启中......')\n goldfishInstance.stop()\n goldfishInstance.start(startOptions)\n }\n },\n {\n key: '?',\n description: '显示所有命令',\n action() {\n startWaiter.clearLog()\n startWaiter.describe()\n }\n }\n ]\n })\n startWaiter.describe()\n startWaiter.start()\n }\n }\n}\n\nasync function main() {\n const aiotCreate = await getAiotCreateCommand()\n const config: IProgram = {\n name: 'aiot-toolkit',\n description: 'contains build, dev, release, etc. commands for aiot toolkit',\n version: '2.0.1',\n commandList: [\n build('build', 'build project'),\n start('start', 'start project in goldfish'),\n {\n name: 'getConnectedDevices',\n description: 'get all connected devices',\n action: async (option) => {\n try {\n const connectedDevices = await DeviceUtil.getAllConnectedDevices()\n ColorConsole.log({\n message: `The connected devices are: ${\n connectedDevices ? connectedDevices.join(', ') : 'null'\n }`\n })\n } catch (error) {\n ColorConsole.log({ message: (error as Error).message, level: LOG_LEVEL.Error })\n }\n }\n },\n {\n name: 'getPlatforms',\n description: 'get available platform(s) on selected device',\n paramList: [\n {\n name: 'ip',\n description: 'device ip(eg 127.0.0.1)',\n type: 'string',\n enableInquirer: true\n },\n {\n name: 'port',\n description: 'device port(eg 39517)',\n type: 'string',\n enableInquirer: true\n },\n {\n name: 'sn',\n description:\n 'view the serial number of the connected device through the \"adb devices\" command, if it is a device connected via wifi, the format is \"ip address:5555\"',\n type: 'string',\n enableInquirer: true\n }\n ],\n action: async (option) => {\n await DeviceUtil.getAvailablePlatform(option)\n }\n },\n {\n name: 'installDbgAndMkp',\n description: 'install \"org.hapjs.debugger\" & \"org.hapjs.mockup\" ',\n paramList: [\n {\n name: 'ip',\n description: 'device ip(eg 127.0.0.1)',\n type: 'string'\n },\n {\n name: 'port',\n description: 'device ip(eg 5555)',\n type: 'string'\n }\n ],\n action: async (option) => {\n try {\n const successMessage = await DeviceUtil.installDbgAndMkp(option)\n ColorConsole.log({ message: successMessage, level: LOG_LEVEL.Success })\n } catch (error) {\n ColorConsole.log({ message: (error as Error).message, level: LOG_LEVEL.Error })\n }\n }\n },\n {\n name: 'createVelaAvd',\n description: 'create a vela avd instance',\n action: async () => {\n VelaAvdUtil.createVelaAvdByInquire()\n }\n },\n {\n ...aiotCreate,\n name: 'create',\n description: 'create aiot project'\n }\n ]\n }\n Command.registeProgram(config)\n}\nmain()\n"],"sourceRoot":"../src"}
@@ -0,0 +1,22 @@
1
+ import { IParam } from '@aiot-toolkit/commander';
2
+ /**
3
+ * IBuilder
4
+ */
5
+ export default interface IBuilder<O = any> {
6
+ /**
7
+ * build 的参数列表
8
+ */
9
+ readonly params: IParam[];
10
+ /**
11
+ * 打包项目
12
+ * @param projectPath 项目路径
13
+ * @param options 命令参数
14
+ * @param watch 是否监听文件变化并持续打包
15
+ */
16
+ build(projectPath: string, options: O): void | Promise<void>;
17
+ /**
18
+ * 当前 builder 是否可打包指定目录的项目
19
+ * @param projectPath 项目目录
20
+ */
21
+ match(projectPath: string): boolean;
22
+ }
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+
4
+ //# sourceMappingURL=IBuilder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["builder/IBuilder.ts"],"names":[],"mappings":"","file":"IBuilder.js","sourcesContent":["import { IParam } from '@aiot-toolkit/commander'\n\n/**\n * IBuilder\n */\nexport default interface IBuilder<O = any> {\n /**\n * build 的参数列表\n */\n readonly params: IParam[]\n\n /**\n * 打包项目\n * @param projectPath 项目路径\n * @param options 命令参数\n * @param watch 是否监听文件变化并持续打包\n */\n build(projectPath: string, options: O): void | Promise<void>\n\n /**\n * 当前 builder 是否可打包指定目录的项目\n * @param projectPath 项目目录\n */\n match(projectPath: string): boolean\n}\n"],"sourceRoot":"../../src"}
@@ -0,0 +1,26 @@
1
+ import CompileMode from '@aiot-toolkit/aiotpack/lib/compiler/enum/CompileMode';
2
+ import ParamType from '@aiot-toolkit/commander/lib/interface/IParam';
3
+ import { Dictionary } from '@aiot-toolkit/shared-utils/lib/type/Type';
4
+ import IBuilder from './IBuilder';
5
+ interface IUxBuilderOption extends Dictionary {
6
+ watch?: boolean;
7
+ mode: CompileMode;
8
+ }
9
+ /**
10
+ * UxBuilder
11
+ */
12
+ declare class UxBuilder implements IBuilder<IUxBuilderOption> {
13
+ readonly QUICKAPP_CONFIG = "quickapp.config.js";
14
+ /**
15
+ * ux项目的build函数
16
+ * @param projectPath 项目路径
17
+ * @param options 命令参数
18
+ * @param watch 是否开启监听
19
+ */
20
+ build(projectPath: string, options: IUxBuilderOption): Promise<void>;
21
+ private readQuickAppConfig;
22
+ static readonly PROJECT_TYPE = "ux quick app";
23
+ params: ParamType[];
24
+ match(projectPath: string): boolean;
25
+ }
26
+ export default UxBuilder;
@@ -0,0 +1,102 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ const CompileMode_1 = __importDefault(require("@aiot-toolkit/aiotpack/lib/compiler/enum/CompileMode"));
16
+ const JavascriptDefaultCompileOption_1 = __importDefault(require("@aiot-toolkit/aiotpack/lib/compiler/javascript/JavascriptDefaultCompileOption"));
17
+ const UxConfig_1 = __importDefault(require("@aiot-toolkit/aiotpack/lib/config/UxConfig"));
18
+ const ColorConsole2_1 = __importDefault(require("@aiot-toolkit/shared-utils/lib/ColorConsole2"));
19
+ const file_lane_1 = require("file-lane");
20
+ const fs_extra_1 = __importDefault(require("fs-extra"));
21
+ const lodash_1 = __importDefault(require("lodash"));
22
+ const path_1 = __importDefault(require("path"));
23
+ /**
24
+ * UxBuilder
25
+ */
26
+ class UxBuilder {
27
+ constructor() {
28
+ this.QUICKAPP_CONFIG = 'quickapp.config.js';
29
+ this.params = [
30
+ {
31
+ name: 'enable-e2e',
32
+ description: 'inject test-suite for current project'
33
+ },
34
+ {
35
+ name: 'devtool',
36
+ description: 'source map config'
37
+ },
38
+ {
39
+ name: 'disable-subpackages',
40
+ description: 'disable subpackages'
41
+ },
42
+ {
43
+ type: 'confirm',
44
+ name: 'disabled-jsc',
45
+ description: 'disabled jsc bundle',
46
+ defaultValue: true,
47
+ enableInquirer: true
48
+ }
49
+ ];
50
+ }
51
+ /**
52
+ * ux项目的build函数
53
+ * @param projectPath 项目路径
54
+ * @param options 命令参数
55
+ * @param watch 是否开启监听
56
+ */
57
+ build(projectPath, options) {
58
+ return __awaiter(this, void 0, void 0, function* () {
59
+ const { watch } = options;
60
+ // 读取项目中文件的配置
61
+ const quickappConfig = this.readQuickAppConfig(projectPath);
62
+ options = lodash_1.default.merge({}, options, quickappConfig === null || quickappConfig === void 0 ? void 0 : quickappConfig.cli);
63
+ // 项目配置
64
+ const uxProjectConfig = new UxConfig_1.default(projectPath);
65
+ // 编译配置
66
+ const compilerOption = lodash_1.default.merge({
67
+ projectPath: path_1.default.join(projectPath, uxProjectConfig.output),
68
+ mode: CompileMode_1.default.DEVELOPMENT,
69
+ disabledJSC: options.disabledJsc
70
+ }, JavascriptDefaultCompileOption_1.default, quickappConfig === null || quickappConfig === void 0 ? void 0 : quickappConfig.webpack);
71
+ ColorConsole2_1.default.info({
72
+ word: JSON.stringify({
73
+ step: 'build ux',
74
+ projectPath,
75
+ options,
76
+ watch
77
+ }, null, 2)
78
+ });
79
+ // 开始编译项目
80
+ yield new file_lane_1.FileLane(uxProjectConfig, projectPath, compilerOption).start({ watch });
81
+ });
82
+ }
83
+ readQuickAppConfig(projectPath) {
84
+ const path = path_1.default.join(projectPath, this.QUICKAPP_CONFIG);
85
+ if (fs_extra_1.default.existsSync(path)) {
86
+ try {
87
+ return fs_extra_1.default.readJsonSync(path);
88
+ }
89
+ catch (error) {
90
+ ColorConsole2_1.default.throw((error === null || error === void 0 ? void 0 : error.toString()) || '');
91
+ }
92
+ }
93
+ return;
94
+ }
95
+ match(projectPath) {
96
+ return projectPath.includes('ux');
97
+ }
98
+ }
99
+ UxBuilder.PROJECT_TYPE = 'ux quick app';
100
+ exports.default = UxBuilder;
101
+
102
+ //# sourceMappingURL=UxBuilder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["builder/UxBuilder.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,uGAA8E;AAC9E,mJAA0H;AAE1H,0FAAiE;AAGjE,iGAAwE;AAExE,yCAAoC;AACpC,wDAAyB;AACzB,oDAA2B;AAC3B,gDAAuB;AAQvB;;GAEG;AACH,MAAM,SAAS;IAAf;QACW,oBAAe,GAAG,oBAAoB,CAAA;QA0D/C,WAAM,GA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S;YACT,MAAM,IAAI,oBAAQ,CAChB,eAAe,EACf,WAAW,EACX,cAA0C,CAC3C,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,CAAC,CAAA;QACpB,CAAC;KAAA;IAEO,kBAAkB,CAAC,WAAmB;QAC5C,MAAM,IAAI,GAAG,cAAI,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,eAAe,CAAC,CAAA;QACzD,IAAI,kBAAE,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE;YACvB,IAAI;gBACF,OAAO,kBAAE,CAAC,YAAY,CAAC,IAAI,CAAC,CAAA;aAC7B;YAAC,OAAO,KAAK,EAAE;gBACd,uBAAa,CAAC,KAAK,CAAC,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,QAAQ,EAAE,KAAI,EAAE,CAAC,CAAA;aAC7C;SACF;QACD,OAAM;IACR,CAAC;IAwBD,KAAK,CAAC,WAAmB;QACvB,OAAO,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAA;IACnC,CAAC;;AAzBe,sBAAY,GAAG,cAAH,AAAiB,CAAA;AA2B/C,kBAAe,SAAS,CAAA","file":"UxBuilder.js","sourcesContent":["import CompileMode from '@aiot-toolkit/aiotpack/lib/compiler/enum/CompileMode'\nimport JavascriptDefaultCompileOption from '@aiot-toolkit/aiotpack/lib/compiler/javascript/JavascriptDefaultCompileOption'\nimport IJavascriptCompileOption from '@aiot-toolkit/aiotpack/lib/compiler/javascript/interface/IJavascriptCompileOption'\nimport UxConfig from '@aiot-toolkit/aiotpack/lib/config/UxConfig'\nimport IQuickAppConfig from '@aiot-toolkit/aiotpack/src/compiler/javascript/vela/interface/IQuickAppConfig'\nimport ParamType from '@aiot-toolkit/commander/lib/interface/IParam'\nimport ColorConsole2 from '@aiot-toolkit/shared-utils/lib/ColorConsole2'\nimport { Dictionary } from '@aiot-toolkit/shared-utils/lib/type/Type'\nimport { FileLane } from 'file-lane'\nimport Fs from 'fs-extra'\nimport Lodash from 'lodash'\nimport Path from 'path'\nimport IBuilder from './IBuilder'\n\ninterface IUxBuilderOption extends Dictionary {\n watch?: boolean\n mode: CompileMode\n}\n\n/**\n * UxBuilder\n */\nclass UxBuilder implements IBuilder<IUxBuilderOption> {\n readonly QUICKAPP_CONFIG = 'quickapp.config.js'\n /**\n * ux项目的build函数\n * @param projectPath 项目路径\n * @param options 命令参数\n * @param watch 是否开启监听\n */\n async build(projectPath: string, options: IUxBuilderOption): Promise<void> {\n const { watch } = options\n // 读取项目中文件的配置\n const quickappConfig = this.readQuickAppConfig(projectPath)\n options = Lodash.merge({}, options, quickappConfig?.cli)\n // 项目配置\n const uxProjectConfig: UxConfig = new UxConfig(projectPath)\n\n // 编译配置\n const compilerOption: Partial<IJavascriptCompileOption> = Lodash.merge(\n {\n projectPath: Path.join(projectPath, uxProjectConfig.output),\n mode: CompileMode.DEVELOPMENT,\n disabledJSC: options.disabledJsc\n },\n JavascriptDefaultCompileOption,\n quickappConfig?.webpack\n )\n\n ColorConsole2.info({\n word: JSON.stringify(\n {\n step: 'build ux',\n projectPath,\n options,\n watch\n },\n null,\n 2\n )\n })\n // 开始编译项目\n await new FileLane<IJavascriptCompileOption>(\n uxProjectConfig,\n projectPath,\n compilerOption as IJavascriptCompileOption\n ).start({ watch })\n }\n\n private readQuickAppConfig(projectPath: string): IQuickAppConfig | undefined {\n const path = Path.join(projectPath, this.QUICKAPP_CONFIG)\n if (Fs.existsSync(path)) {\n try {\n return Fs.readJsonSync(path)\n } catch (error) {\n ColorConsole2.throw(error?.toString() || '')\n }\n }\n return\n }\n static readonly PROJECT_TYPE = 'ux quick app'\n params: ParamType[] = [\n {\n name: 'enable-e2e',\n description: 'inject test-suite for current project'\n },\n {\n name: 'devtool',\n description: 'source map config'\n },\n {\n name: 'disable-subpackages',\n description: 'disable subpackages'\n },\n {\n type: 'confirm',\n name: 'disabled-jsc',\n description: 'disabled jsc bundle',\n defaultValue: true,\n enableInquirer: true\n }\n ]\n\n match(projectPath: string): boolean {\n return projectPath.includes('ux')\n }\n}\nexport default UxBuilder\n"],"sourceRoot":"../../src"}