aiot-toolkit 2.0.2-beta.16 → 2.0.2-beta.18
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.
|
@@ -47,8 +47,8 @@ class XtsBuilder {
|
|
|
47
47
|
return fs_1.default.existsSync(path_1.default.resolve(projectPath, 'app/app.xts'));
|
|
48
48
|
}
|
|
49
49
|
build(projectPath, options) {
|
|
50
|
-
var _a;
|
|
51
50
|
return __awaiter(this, void 0, void 0, function* () {
|
|
51
|
+
var _a;
|
|
52
52
|
const watch = options.watch || false;
|
|
53
53
|
shared_utils_1.ColorConsole.success('Start build...\n', { word: 'ProjectPath: ', style: shared_utils_1.ColorConsole.getStyle(shared_utils_1.Loglevel.SUCCESS) }, projectPath, '\n', { word: 'buildOptions: ', style: shared_utils_1.ColorConsole.getStyle(shared_utils_1.Loglevel.SUCCESS) }, JSON.stringify(options));
|
|
54
54
|
const compilerOptions = {
|
|
@@ -61,7 +61,7 @@ class XtsBuilder {
|
|
|
61
61
|
const preWorks = config.beforeCompile || [];
|
|
62
62
|
for (let item of preWorks) {
|
|
63
63
|
try {
|
|
64
|
-
yield item(context,
|
|
64
|
+
yield item({ context, config, compilerOption: compilerOptions });
|
|
65
65
|
}
|
|
66
66
|
catch (error) {
|
|
67
67
|
// 报错 prework的item error
|
|
@@ -70,7 +70,7 @@ class XtsBuilder {
|
|
|
70
70
|
const follWorks = config.afterCompile || [];
|
|
71
71
|
for (let item of follWorks) {
|
|
72
72
|
try {
|
|
73
|
-
yield item.worker(context, config, compilerOptions);
|
|
73
|
+
yield item.worker({ context, config, compilerOption: compilerOptions });
|
|
74
74
|
}
|
|
75
75
|
catch (error) {
|
|
76
76
|
// 报错 prework的item error
|
|
@@ -27,13 +27,13 @@ class PackageRouter {
|
|
|
27
27
|
this.param = param;
|
|
28
28
|
this.routeList = [
|
|
29
29
|
{
|
|
30
|
-
path: '/qrcode',
|
|
30
|
+
path: '/qrcode', // 获取二维码图片
|
|
31
31
|
handler: (ctx, next) => {
|
|
32
32
|
return this.handlerQrCode(ctx, next);
|
|
33
33
|
}
|
|
34
34
|
},
|
|
35
35
|
{
|
|
36
|
-
path: '/bundle',
|
|
36
|
+
path: '/bundle', // 获取 rpk 包
|
|
37
37
|
handler: (ctx, next) => {
|
|
38
38
|
this.recordDevice(ctx);
|
|
39
39
|
return this.handlerDownLoadRpk(ctx, next);
|
package/lib/utils/AdbUtils.d.ts
CHANGED
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
declare class AdbUtils {
|
|
5
5
|
static connect(ip: string, port: string): Promise<boolean>;
|
|
6
6
|
static getAllConnectedDevices(): Promise<string[]>;
|
|
7
|
-
static getUSBConnectedDevices(): Promise<string[]>;
|
|
8
7
|
static installApk(sn: string, apkPath: string): Promise<{
|
|
9
8
|
status: boolean;
|
|
10
9
|
msg: string;
|
package/lib/utils/AdbUtils.js
CHANGED
|
@@ -31,13 +31,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
31
31
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
32
|
});
|
|
33
33
|
};
|
|
34
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
35
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
36
|
-
};
|
|
37
34
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
35
|
const shared_utils_1 = require("@aiot-toolkit/shared-utils");
|
|
39
36
|
const adbMiwt = __importStar(require("@miwt/adb"));
|
|
40
|
-
const adb_commander_1 = __importDefault(require("adb-commander"));
|
|
41
37
|
/**
|
|
42
38
|
* AdbUtils
|
|
43
39
|
*/
|
|
@@ -56,13 +52,6 @@ class AdbUtils {
|
|
|
56
52
|
return res.map(({ sn }) => sn);
|
|
57
53
|
});
|
|
58
54
|
}
|
|
59
|
-
// 获取USB连接的设备
|
|
60
|
-
static getUSBConnectedDevices() {
|
|
61
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
62
|
-
const res = yield adb_commander_1.default.deviceList();
|
|
63
|
-
return res.deviceList;
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
55
|
// 安装设备
|
|
67
56
|
static installApk(sn, apkPath) {
|
|
68
57
|
return __awaiter(this, void 0, void 0, function* () {
|
package/lib/utils/DeviceUtil.js
CHANGED
|
@@ -55,7 +55,7 @@ class DeviceUtil {
|
|
|
55
55
|
// 1. 判断设备是否连接
|
|
56
56
|
yield this.connectDevice(ip);
|
|
57
57
|
// 2. 获取连接的设备
|
|
58
|
-
const deviceList = yield AdbUtils_1.default.
|
|
58
|
+
const deviceList = yield AdbUtils_1.default.getAllConnectedDevices();
|
|
59
59
|
const finalDeviceList = deviceList.length > 0
|
|
60
60
|
? yield this.queryDevice(deviceList, 'Install Quickapp debugger or previewer ')
|
|
61
61
|
: [];
|
|
@@ -152,8 +152,8 @@ class DeviceUtil {
|
|
|
152
152
|
* @param orderText
|
|
153
153
|
* @returns
|
|
154
154
|
*/
|
|
155
|
-
static queryDevice(
|
|
156
|
-
return __awaiter(this,
|
|
155
|
+
static queryDevice(deviceList_1) {
|
|
156
|
+
return __awaiter(this, arguments, void 0, function* (deviceList, orderText = '') {
|
|
157
157
|
if (!deviceList || deviceList.length === 0) {
|
|
158
158
|
shared_utils_1.ColorConsole.throw(`No device is connected yet, please confirm and try again`);
|
|
159
159
|
return;
|
|
@@ -271,8 +271,8 @@ class DeviceUtil {
|
|
|
271
271
|
* @param apkPath
|
|
272
272
|
* @returns
|
|
273
273
|
*/
|
|
274
|
-
static installApk(
|
|
275
|
-
return __awaiter(this,
|
|
274
|
+
static installApk() {
|
|
275
|
+
return __awaiter(this, arguments, void 0, function* (deviceList = [], apkPath) {
|
|
276
276
|
try {
|
|
277
277
|
const newDeviceListPromiseArray = Array.from(deviceList, (deviceSn) => {
|
|
278
278
|
return AdbUtils_1.default.installApk(deviceSn, apkPath);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aiot-toolkit",
|
|
3
|
-
"version": "2.0.2-beta.
|
|
3
|
+
"version": "2.0.2-beta.18",
|
|
4
4
|
"description": "Tools for creating, developing, and packaging aiot applications.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"aiot"
|
|
@@ -21,18 +21,17 @@
|
|
|
21
21
|
"test": "node ./__tests__/aiot-toolkit.test.js"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@aiot-toolkit/aiotpack": "2.0.2-beta.
|
|
25
|
-
"@aiot-toolkit/commander": "2.0.2-beta.
|
|
26
|
-
"@aiot-toolkit/emulator": "2.0.2-beta.
|
|
27
|
-
"@aiot-toolkit/shared-utils": "2.0.2-beta.
|
|
24
|
+
"@aiot-toolkit/aiotpack": "2.0.2-beta.18",
|
|
25
|
+
"@aiot-toolkit/commander": "2.0.2-beta.18",
|
|
26
|
+
"@aiot-toolkit/emulator": "2.0.2-beta.18",
|
|
27
|
+
"@aiot-toolkit/shared-utils": "2.0.2-beta.18",
|
|
28
28
|
"@inquirer/prompts": "^5.3.0",
|
|
29
29
|
"@miwt/adb": "^0.9.0",
|
|
30
|
-
"adb-commander": "^0.1.9",
|
|
31
30
|
"adm-zip": "^0.5.10",
|
|
32
31
|
"axios": "^1.7.4",
|
|
33
32
|
"cli-progress": "^3.12.0",
|
|
34
33
|
"dayjs": "^1.11.10",
|
|
35
|
-
"file-lane": "2.0.2-beta.
|
|
34
|
+
"file-lane": "2.0.2-beta.18",
|
|
36
35
|
"fs-extra": "^11.2.0",
|
|
37
36
|
"koa-router": "^12.0.1",
|
|
38
37
|
"lodash": "^4.17.21",
|
|
@@ -49,5 +48,5 @@
|
|
|
49
48
|
"@types/semver": "^7.5.8",
|
|
50
49
|
"@types/ws": "^8.5.10"
|
|
51
50
|
},
|
|
52
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "b73a79ef04edac808f316bf8b8fb1718422daa1c"
|
|
53
52
|
}
|