aiot-toolkit 2.0.1-alpha.6 → 2.0.1-alpha.7
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/lib/bin.js +2 -12
- package/lib/bin.js.map +1 -1
- package/package.json +5 -5
package/lib/bin.js
CHANGED
|
@@ -17,22 +17,14 @@ const commander_1 = require("@aiot-toolkit/commander");
|
|
|
17
17
|
const shared_utils_1 = require("@aiot-toolkit/shared-utils");
|
|
18
18
|
const ColorConsole_1 = __importDefault(require("@aiot-toolkit/shared-utils/lib/ColorConsole"));
|
|
19
19
|
const create_aiot_1 = require("create-aiot");
|
|
20
|
-
const UxBuilder_1 = __importDefault(require("./builder/UxBuilder"));
|
|
21
20
|
const XtsBuilder_1 = __importDefault(require("./builder/XtsBuilder"));
|
|
22
21
|
const GoldfishStarter_1 = __importDefault(require("./starter/GoldfishStarter"));
|
|
23
22
|
const DeviceUtil_1 = __importDefault(require("./utils/DeviceUtil"));
|
|
24
23
|
const VelaAvdUtils_1 = __importDefault(require("./utils/VelaAvdUtils"));
|
|
25
24
|
const waiter_1 = __importDefault(require("./waiter"));
|
|
26
25
|
// 配置支持的 builder 类型,新增的项目类型,只需在此处加上类型
|
|
27
|
-
const builderTypeList = [UxBuilder_1.default, XtsBuilder_1.default];
|
|
28
26
|
function findBuilder(projectPath) {
|
|
29
|
-
|
|
30
|
-
const instance = new item();
|
|
31
|
-
if (instance.match(projectPath)) {
|
|
32
|
-
return instance;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
return new UxBuilder_1.default();
|
|
27
|
+
return new XtsBuilder_1.default();
|
|
36
28
|
}
|
|
37
29
|
function build(command, description) {
|
|
38
30
|
const projectPath = process.cwd();
|
|
@@ -56,9 +48,7 @@ function build(command, description) {
|
|
|
56
48
|
}
|
|
57
49
|
else {
|
|
58
50
|
ColorConsole_1.default.log({
|
|
59
|
-
message: `This type of project is not currently supported. The supported projects
|
|
60
|
-
.map((item) => item.PROJECT_TYPE)
|
|
61
|
-
.join('、')}`,
|
|
51
|
+
message: `This type of project is not currently supported. The supported projects : xts`,
|
|
62
52
|
level: shared_utils_1.LOG_LEVEL.Error,
|
|
63
53
|
isOnlyPrintError: true
|
|
64
54
|
});
|
package/lib/bin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["bin.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAEA,uDAAqE;AACrE,6DAAsD;AACtD,+FAAsE;AACtE,6CAAkD;AAElD,
|
|
1
|
+
{"version":3,"sources":["bin.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAEA,uDAAqE;AACrE,6DAAsD;AACtD,+FAAsE;AACtE,6CAAkD;AAElD,sEAA6C;AAC7C,gFAAuD;AACvD,oEAA2C;AAC3C,wEAA8C;AAC9C,sDAA6B;AAC7B,qCAAqC;AAErC,SAAS,WAAW,CAAC,WAAmB;IACtC,OAAO,IAAI,oBAAU,EAAE,CAAA;AACzB,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,SAAS,GAAG,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,MAAM,CAAA;IAEjC,OAAO;QACL,IAAI,EAAE,OAAO;QACb,WAAW;QACX,SAAS;QACT,MAAM,EAAE,CAAO,MAAW,EAAE,EAAE;YAC5B,sCAAsC;YACtC,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,EAAE,CAAA;YACjC,MAAM,OAAO,GAAG,WAAW,CAAC,WAAW,CAAC,CAAA;YACxC,IAAI,OAAO,EAAE;gBACX,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,CAAA;gBACxB,MAAM,OAAO,CAAC,KAAK,CAAC,WAAW,EAAE,MAAM,CAAC,CAAA;gBACxC,IAAI,KAAK,E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AS,EAAE;wBACjB,sBAAW,CAAC,sBAAsB,EAAE,CAAA;oBACtC,CAAC,CAAA;iBACF;gDAEI,UAAU,KACb,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 } from '@aiot-toolkit/commander'\nimport { LOG_LEVEL } from '@aiot-toolkit/shared-utils'\nimport ColorConsole from '@aiot-toolkit/shared-utils/lib/ColorConsole'\nimport { getAiotCreateCommand } from 'create-aiot'\nimport IBuilder from './builder/IBuilder'\nimport XtsBuilder from './builder/XtsBuilder'\nimport GoldfishStarter from './starter/GoldfishStarter'\nimport DeviceUtil from './utils/DeviceUtil'\nimport VelaAvdUtil from './utils/VelaAvdUtils'\nimport waiter from './waiter'\n// 配置支持的 builder 类型,新增的项目类型,只需在此处加上类型\n\nfunction findBuilder(projectPath: string): IBuilder | undefined {\n return new XtsBuilder()\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 : xts`,\n level: LOG_LEVEL.Error,\n isOnlyPrintError: true\n })\n }\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 new GoldfishStarter('start', 'start project').getParamList(),\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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aiot-toolkit",
|
|
3
|
-
"version": "2.0.1-alpha.
|
|
3
|
+
"version": "2.0.1-alpha.7",
|
|
4
4
|
"description": "Tools for creating, developing, and packaging aiot applications.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"aiot"
|
|
@@ -25,18 +25,18 @@
|
|
|
25
25
|
"test": "node ./__tests__/aiot-toolkit.test.js"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@aiot-toolkit/emulator": "2.0.1-alpha.
|
|
29
|
-
"@aiot-toolkit/shared-utils": "2.0.1-alpha.
|
|
28
|
+
"@aiot-toolkit/emulator": "2.0.1-alpha.7",
|
|
29
|
+
"@aiot-toolkit/shared-utils": "2.0.1-alpha.7",
|
|
30
30
|
"@miwt/adb": "^0.7.1",
|
|
31
31
|
"adb-commander": "^0.1.9",
|
|
32
32
|
"adm-zip": "^0.5.10",
|
|
33
33
|
"axios": "^1.5.0",
|
|
34
34
|
"cli-progress": "^3.12.0",
|
|
35
|
-
"create-aiot": "2.0.1-alpha.
|
|
35
|
+
"create-aiot": "2.0.1-alpha.7",
|
|
36
36
|
"fast-glob": "^3.3.2"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@types/adm-zip": "^0.5.4"
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "9fbe39dfddc2745c97d472827ff10273ab67b499"
|
|
42
42
|
}
|