aiot-toolkit 2.0.2-dev.1 → 2.0.2-dev.2
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.
package/README.md
CHANGED
|
@@ -1,41 +1,50 @@
|
|
|
1
|
-
#
|
|
1
|
+
# 项目介绍
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
aiot-toolkit 2.0 是将 **源码项目** 转换为 **目标代码项目** 并生成 **目标代码应用** 的命令行工具,同时配备了 **模拟器** 相关功能供开发者使用。
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
aiot-toolkit2.0目前支持的打包格式如下:
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
- ux:vela 平台下的应用,目前大量使用于小米手表、音箱等智能穿戴及物联网设备
|
|
8
|
+
- xts:新一代vela应用
|
|
8
9
|
|
|
9
|
-
|
|
10
|
+
## 安装使用
|
|
10
11
|
|
|
11
|
-
|
|
12
|
+
- 全局安装
|
|
12
13
|
|
|
13
|
-
|
|
14
|
-
import ParamType from '@aiot-toolkit/commander/lib/interface/IParam'
|
|
15
|
-
import IBuild from './IBuild'
|
|
14
|
+
`npm i aiot-toolkit -g`
|
|
16
15
|
|
|
17
|
-
|
|
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
|
|
16
|
+
`npm i create-aiot -g`
|
|
27
17
|
|
|
28
|
-
|
|
18
|
+
- 创建项目
|
|
29
19
|
|
|
30
|
-
|
|
31
|
-
|
|
20
|
+
1. `create-aiot ux`
|
|
21
|
+
2. 在项目根目录执行:`npm i`
|
|
32
22
|
|
|
33
|
-
|
|
34
|
-
static readonly PROJECT_TYPE = '项目类型的名称'
|
|
35
|
-
```
|
|
23
|
+
- 本机运行项目
|
|
36
24
|
|
|
37
|
-
|
|
25
|
+
在项目根目录执行 `aiot start`,此会启动模拟器,并运行项目
|
|
38
26
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
27
|
+
* 打包项目
|
|
28
|
+
|
|
29
|
+
在项目根目录执行 `aiot release`
|
|
30
|
+
|
|
31
|
+
## 常用命令
|
|
32
|
+
|
|
33
|
+
| 命令 | 说明 |
|
|
34
|
+
| ------------------------ | ------------------------ |
|
|
35
|
+
| create-aiot xts | 创建xts项目 |
|
|
36
|
+
| create-aiot ux | 创建ux项目 |
|
|
37
|
+
| aiot build | 构建项目 |
|
|
38
|
+
| aiot release | 构建项目-release模式 |
|
|
39
|
+
| aiot start | 构建项目并运行到模拟器 |
|
|
40
|
+
| aiot getConnectedDevices | 获取已连接设备列表 |
|
|
41
|
+
| aiot getPlatforms | 获取设置平台 |
|
|
42
|
+
| aiot installDbgAndMkp | 在真机上安装快应用调试器 |
|
|
43
|
+
| aiot createVelaAvd | 创建 vela 模拟器 |
|
|
44
|
+
| aiot deleteVelaAvd | 删除 vela 模拟器 |
|
|
45
|
+
|
|
46
|
+
## 参考
|
|
47
|
+
|
|
48
|
+
> [贡献代码](./doc/贡献代码.md) >
|
|
49
|
+
|
|
50
|
+
> [ux解析流程](./doc/ux解析流程.md)
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
+
export interface ISystemImagesVersionInfo {
|
|
2
|
+
release: string;
|
|
3
|
+
dev: string;
|
|
4
|
+
}
|
|
5
|
+
export type ISystemImagesType = keyof ISystemImagesVersionInfo;
|
|
1
6
|
export interface IGoldfishVersionInfo {
|
|
2
7
|
name: string;
|
|
3
8
|
emulator: string;
|
|
4
|
-
'system-images':
|
|
9
|
+
'system-images': ISystemImagesVersionInfo;
|
|
5
10
|
qa: string;
|
|
6
11
|
skins: string;
|
|
7
12
|
tools: string;
|
|
@@ -26,7 +26,7 @@ declare class VelaAvdUtils {
|
|
|
26
26
|
/** 根据host获取模拟器下载地址 */
|
|
27
27
|
static getEmulatorUrl(version?: string): string;
|
|
28
28
|
/** 根据host获取vela镜像下载地址 */
|
|
29
|
-
static getSystemImageUrl(version?: string
|
|
29
|
+
static getSystemImageUrl(version?: string): string;
|
|
30
30
|
/** 根据host获取ya-vm-file-server下载地址 */
|
|
31
31
|
static getv9fsToolUrl(version?: string): string;
|
|
32
32
|
/** 获取资源文件下载地址 */
|
|
@@ -13,6 +13,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
const emulator_1 = require("@aiot-toolkit/emulator");
|
|
16
|
+
const constants_1 = require("@aiot-toolkit/emulator/lib/static/constants");
|
|
16
17
|
const utils_1 = require("@aiot-toolkit/emulator/lib/utils");
|
|
17
18
|
const ColorConsole_1 = __importDefault(require("@aiot-toolkit/shared-utils/lib/ColorConsole"));
|
|
18
19
|
const prompts_1 = require("@inquirer/prompts");
|
|
@@ -108,8 +109,8 @@ class VelaAvdUtils {
|
|
|
108
109
|
return `${VelaAvdUtils.emulatorBaseUrl}/v${version}/${hostOs}-${hostArch}.zip`;
|
|
109
110
|
}
|
|
110
111
|
/** 根据host获取vela镜像下载地址 */
|
|
111
|
-
static getSystemImageUrl(version = '
|
|
112
|
-
return `${VelaAvdUtils.systemImageBaseUrl}
|
|
112
|
+
static getSystemImageUrl(version = 'vela-release-4.0') {
|
|
113
|
+
return `${VelaAvdUtils.systemImageBaseUrl}/${version}/nuttx`;
|
|
113
114
|
}
|
|
114
115
|
/** 根据host获取ya-vm-file-server下载地址 */
|
|
115
116
|
static getv9fsToolUrl(version = '0.0.1') {
|
|
@@ -146,10 +147,7 @@ class VelaAvdUtils {
|
|
|
146
147
|
if (versionFileExist) {
|
|
147
148
|
versionInfo = fs_extra_1.default.readJSONSync(versionFile);
|
|
148
149
|
}
|
|
149
|
-
|
|
150
|
-
yield VelaAvdUtils.downloadFromCdn(VelaAvdUtils.versionUrl, VelaAvdUtils.sdkHome, 'online-version.json');
|
|
151
|
-
const onlineVersionFile = path_1.default.resolve(VelaAvdUtils.sdkHome, 'online-version.json');
|
|
152
|
-
const onlineVersionInfo = fs_extra_1.default.readJSONSync(onlineVersionFile);
|
|
150
|
+
const onlineVersionInfo = constants_1.emulatorEnvVersion;
|
|
153
151
|
// avdName
|
|
154
152
|
const avdName = yield (0, prompts_1.input)({
|
|
155
153
|
message: 'avd name starting with Vela. (eg. Vela_Virtual_Device)',
|
|
@@ -197,9 +195,12 @@ class VelaAvdUtils {
|
|
|
197
195
|
});
|
|
198
196
|
}
|
|
199
197
|
// 镜像,TODO:后续需要考虑多种设备的镜像
|
|
200
|
-
const
|
|
198
|
+
const velaImage = (yield (0, prompts_1.select)({
|
|
201
199
|
message: 'vela image.',
|
|
202
|
-
choices: [
|
|
200
|
+
choices: [
|
|
201
|
+
// { value: 'vela-release-4.0', name: 'vela正式版(4.0)' },
|
|
202
|
+
{ value: 'vela-dev-0.0.2', name: 'vela开发版(dev, 0.0.2)' }
|
|
203
|
+
]
|
|
203
204
|
}));
|
|
204
205
|
// 下载模拟器
|
|
205
206
|
const emulatorDir = path_1.default.resolve(VelaAvdUtils.sdkHome, 'emulator');
|
|
@@ -210,11 +211,10 @@ class VelaAvdUtils {
|
|
|
210
211
|
ColorConsole_1.default.success(`Download emulator succeed.`);
|
|
211
212
|
}
|
|
212
213
|
// 下载镜像
|
|
213
|
-
const velaImageDownloadUrl = this.getSystemImageUrl(
|
|
214
|
-
const imageDir = path_1.default.resolve(VelaAvdUtils.sdkHome, 'system-images',
|
|
214
|
+
const velaImageDownloadUrl = this.getSystemImageUrl(velaImage);
|
|
215
|
+
const imageDir = path_1.default.resolve(VelaAvdUtils.sdkHome, 'system-images', velaImage);
|
|
215
216
|
const imageExists = fs_extra_1.default.existsSync(path_1.default.resolve(imageDir, 'nuttx'));
|
|
216
|
-
if (!imageExists
|
|
217
|
-
(versionInfo && versionInfo['system-images'] < onlineVersionInfo['system-images'])) {
|
|
217
|
+
if (!imageExists) {
|
|
218
218
|
yield VelaAvdUtils.downloadFromCdn(velaImageDownloadUrl, imageDir, 'nuttx');
|
|
219
219
|
ColorConsole_1.default.success(`Download vela image succeed.`);
|
|
220
220
|
}
|
|
@@ -240,13 +240,11 @@ class VelaAvdUtils {
|
|
|
240
240
|
ColorConsole_1.default.success(`Download tools succeed.`);
|
|
241
241
|
}
|
|
242
242
|
// 替换version.json
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
}
|
|
246
|
-
fs_extra_1.default.renameSync(onlineVersionFile, versionFile);
|
|
243
|
+
const versionJson = JSON.stringify(onlineVersionInfo, null, 2);
|
|
244
|
+
fs_extra_1.default.writeFileSync(versionFile, versionJson);
|
|
247
245
|
// 创建avd文本文件
|
|
248
246
|
const avdImagePath = imageDir;
|
|
249
|
-
const avdParams = { avdName, avdSkin, avdWidth, avdHeight, avdArch, avdImagePath };
|
|
247
|
+
const avdParams = { avdName, avdSkin, avdWidth, avdHeight, avdArch: emulator_1.IAvdArchType.arm, avdImagePath };
|
|
250
248
|
VelaAvdUtils.velaAvdCls.createVelaAvd(avdParams);
|
|
251
249
|
ColorConsole_1.default.success(`Create avd succeed.`);
|
|
252
250
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aiot-toolkit",
|
|
3
|
-
"version": "2.0.2-dev.
|
|
3
|
+
"version": "2.0.2-dev.2",
|
|
4
4
|
"description": "Tools for creating, developing, and packaging aiot applications.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"aiot"
|
|
@@ -25,22 +25,22 @@
|
|
|
25
25
|
"test": "node ./__tests__/aiot-toolkit.test.js"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@aiot-toolkit/commander": "2.0.2-dev.
|
|
29
|
-
"@aiot-toolkit/emulator": "2.0.2-dev.
|
|
30
|
-
"@aiot-toolkit/shared-utils": "2.0.2-dev.
|
|
28
|
+
"@aiot-toolkit/commander": "2.0.2-dev.2",
|
|
29
|
+
"@aiot-toolkit/emulator": "2.0.2-dev.2",
|
|
30
|
+
"@aiot-toolkit/shared-utils": "2.0.2-dev.2",
|
|
31
31
|
"@miwt/adb": "^0.7.1",
|
|
32
32
|
"adb-commander": "^0.1.9",
|
|
33
33
|
"adm-zip": "^0.5.10",
|
|
34
34
|
"axios": "^1.5.0",
|
|
35
35
|
"cli-progress": "^3.12.0",
|
|
36
|
-
"create-aiot": "2.0.2-dev.
|
|
36
|
+
"create-aiot": "2.0.2-dev.2",
|
|
37
37
|
"fast-glob": "^3.3.2",
|
|
38
|
-
"file-lane": "2.0.2-dev.
|
|
38
|
+
"file-lane": "2.0.2-dev.2",
|
|
39
39
|
"ws": "^8.15.1"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@types/adm-zip": "^0.5.4",
|
|
43
43
|
"@types/ws": "^8.5.10"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "4979839c27a3477f7e72f1f1ed167200bc1d48b5"
|
|
46
46
|
}
|