aiot-toolkit 2.0.1-alpha.9 → 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 +38 -29
- package/lib/bin.js +79 -37
- package/lib/builder/IBuilder.js +0 -2
- package/lib/builder/UxBuilder.d.ts +1 -0
- package/lib/builder/UxBuilder.js +37 -14
- package/lib/builder/XtsBuilder.js +30 -12
- package/lib/interface/CommandInterface.js +0 -2
- package/lib/interface/VelaEmulatorInterface.d.ts +6 -1
- package/lib/interface/VelaEmulatorInterface.js +0 -2
- package/lib/starter/IStarter.d.ts +23 -0
- package/lib/starter/IStarter.js +45 -0
- package/lib/starter/UxStarter.d.ts +10 -0
- package/lib/starter/UxStarter.js +136 -0
- package/lib/starter/XtsStarter.d.ts +9 -0
- package/lib/starter/XtsStarter.js +16 -0
- package/lib/utils/AdbUtils.js +2 -11
- package/lib/utils/DeviceUtil.d.ts +1 -1
- package/lib/utils/DeviceUtil.js +22 -93
- package/lib/utils/RequestUtils.js +4 -19
- package/lib/utils/VelaAvdUtils.d.ts +2 -2
- package/lib/utils/VelaAvdUtils.js +37 -78
- package/lib/waiter.js +0 -2
- package/package.json +11 -7
- package/lib/bin.js.map +0 -1
- package/lib/builder/IBuilder.js.map +0 -1
- package/lib/builder/UxBuilder.js.map +0 -1
- package/lib/builder/XtsBuilder.js.map +0 -1
- package/lib/interface/CommandInterface.js.map +0 -1
- package/lib/interface/VelaEmulatorInterface.js.map +0 -1
- package/lib/starter/GoldfishStarter.d.ts +0 -9
- package/lib/starter/GoldfishStarter.js +0 -108
- package/lib/starter/GoldfishStarter.js.map +0 -1
- package/lib/utils/AdbUtils.js.map +0 -1
- package/lib/utils/DeviceUtil.js.map +0 -1
- package/lib/utils/RequestUtils.js.map +0 -1
- package/lib/utils/VelaAvdUtils.js.map +0 -1
- package/lib/waiter.js.map +0 -1
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)
|
package/lib/bin.js
CHANGED
|
@@ -13,22 +13,34 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
13
13
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
14
14
|
};
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
const CompileMode_1 = __importDefault(require("@aiot-toolkit/aiotpack/lib/compiler/enum/CompileMode"));
|
|
16
17
|
const commander_1 = require("@aiot-toolkit/commander");
|
|
17
|
-
const shared_utils_1 = require("@aiot-toolkit/shared-utils");
|
|
18
18
|
const ColorConsole_1 = __importDefault(require("@aiot-toolkit/shared-utils/lib/ColorConsole"));
|
|
19
|
-
const
|
|
19
|
+
const fs_1 = __importDefault(require("fs"));
|
|
20
|
+
const path_1 = __importDefault(require("path"));
|
|
21
|
+
const UxBuilder_1 = __importDefault(require("./builder/UxBuilder"));
|
|
20
22
|
const XtsBuilder_1 = __importDefault(require("./builder/XtsBuilder"));
|
|
21
|
-
const
|
|
23
|
+
const UxStarter_1 = __importDefault(require("./starter/UxStarter"));
|
|
24
|
+
const XtsStarter_1 = __importDefault(require("./starter/XtsStarter"));
|
|
22
25
|
const DeviceUtil_1 = __importDefault(require("./utils/DeviceUtil"));
|
|
23
26
|
const VelaAvdUtils_1 = __importDefault(require("./utils/VelaAvdUtils"));
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
// 配置支持的 builder 类型,新增的项目类型,需在此处加上类型
|
|
28
|
+
const projectMapper = {
|
|
29
|
+
ux: {
|
|
30
|
+
builder: UxBuilder_1.default,
|
|
31
|
+
starter: UxStarter_1.default
|
|
32
|
+
},
|
|
33
|
+
xts: {
|
|
34
|
+
builder: XtsBuilder_1.default,
|
|
35
|
+
starter: XtsStarter_1.default
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
function findBuilder() {
|
|
39
|
+
const projectType = getProjectType();
|
|
40
|
+
return new projectMapper[projectType].builder();
|
|
28
41
|
}
|
|
29
42
|
function build(command, description) {
|
|
30
|
-
const
|
|
31
|
-
const builder = findBuilder(projectPath);
|
|
43
|
+
const builder = findBuilder();
|
|
32
44
|
const paramList = builder === null || builder === void 0 ? void 0 : builder.params;
|
|
33
45
|
return {
|
|
34
46
|
name: command,
|
|
@@ -36,48 +48,60 @@ function build(command, description) {
|
|
|
36
48
|
paramList,
|
|
37
49
|
action: (option) => __awaiter(this, void 0, void 0, function* () {
|
|
38
50
|
// 获取对应的 build;如果存在,执行 build 函数,不存在,提示
|
|
51
|
+
option.mode = command === 'release' ? CompileMode_1.default.PRODUCTION : CompileMode_1.default.DEVELOPMENT;
|
|
39
52
|
const projectPath = process.cwd();
|
|
40
|
-
|
|
41
|
-
if (builder) {
|
|
42
|
-
const { watch } = option;
|
|
43
|
-
yield builder.build(projectPath, option);
|
|
44
|
-
if (watch) {
|
|
45
|
-
waiter_1.default.describe();
|
|
46
|
-
waiter_1.default.start();
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
else {
|
|
50
|
-
ColorConsole_1.default.log({
|
|
51
|
-
message: `This type of project is not currently supported. The supported projects : xts`,
|
|
52
|
-
level: shared_utils_1.LOG_LEVEL.Error,
|
|
53
|
-
isOnlyPrintError: true
|
|
54
|
-
});
|
|
55
|
-
}
|
|
53
|
+
yield builder.build(projectPath, option);
|
|
56
54
|
})
|
|
57
55
|
};
|
|
58
56
|
}
|
|
57
|
+
function getProjectType() {
|
|
58
|
+
const projectPath = process.cwd();
|
|
59
|
+
const isXts = fs_1.default.existsSync(path_1.default.resolve(projectPath, 'app/app.xts'));
|
|
60
|
+
const isUx = fs_1.default.existsSync(path_1.default.resolve(projectPath, 'src/app.ux'));
|
|
61
|
+
if (isUx) {
|
|
62
|
+
return "ux" /* ProjectType.UX */;
|
|
63
|
+
}
|
|
64
|
+
else if (isXts) {
|
|
65
|
+
return "xts" /* ProjectType.XTS */;
|
|
66
|
+
}
|
|
67
|
+
ColorConsole_1.default.throw(`Unsupported project type`);
|
|
68
|
+
}
|
|
69
|
+
function findStarter(command, description) {
|
|
70
|
+
const projectType = getProjectType();
|
|
71
|
+
return new projectMapper[projectType].starter(command, description);
|
|
72
|
+
}
|
|
59
73
|
function main() {
|
|
60
74
|
return __awaiter(this, void 0, void 0, function* () {
|
|
61
|
-
const aiotCreate = yield (0, create_aiot_1.getAiotCreateCommand)();
|
|
62
75
|
const config = {
|
|
63
76
|
name: 'aiot-toolkit',
|
|
64
77
|
description: 'contains build, dev, release, etc. commands for aiot toolkit',
|
|
65
78
|
version: '2.0.1',
|
|
66
79
|
commandList: [
|
|
67
80
|
build('build', 'build project'),
|
|
68
|
-
|
|
81
|
+
build('release', 'release the project'),
|
|
82
|
+
findStarter('start', 'start project').getCommond(),
|
|
83
|
+
{
|
|
84
|
+
name: 'watch',
|
|
85
|
+
description: 'recompile project while file changes',
|
|
86
|
+
action: (option) => __awaiter(this, void 0, void 0, function* () {
|
|
87
|
+
const projectPath = process.cwd();
|
|
88
|
+
const builder = findBuilder();
|
|
89
|
+
option.watch = true;
|
|
90
|
+
yield builder.build(projectPath, option);
|
|
91
|
+
// waiter.describe()
|
|
92
|
+
// waiter.start()
|
|
93
|
+
})
|
|
94
|
+
},
|
|
69
95
|
{
|
|
70
96
|
name: 'getConnectedDevices',
|
|
71
97
|
description: 'get all connected devices',
|
|
72
|
-
action: (
|
|
98
|
+
action: () => __awaiter(this, void 0, void 0, function* () {
|
|
73
99
|
try {
|
|
74
100
|
const connectedDevices = yield DeviceUtil_1.default.getAllConnectedDevices();
|
|
75
|
-
ColorConsole_1.default.
|
|
76
|
-
message: `The connected devices are: ${connectedDevices ? connectedDevices.join(', ') : 'null'}`
|
|
77
|
-
});
|
|
101
|
+
ColorConsole_1.default.info(`The connected devices are: ${connectedDevices ? connectedDevices.join(', ') : 'null'}`);
|
|
78
102
|
}
|
|
79
103
|
catch (error) {
|
|
80
|
-
ColorConsole_1.default.
|
|
104
|
+
ColorConsole_1.default.throw(`Error: getConnectedDevices failed`);
|
|
81
105
|
}
|
|
82
106
|
})
|
|
83
107
|
},
|
|
@@ -126,10 +150,10 @@ function main() {
|
|
|
126
150
|
action: (option) => __awaiter(this, void 0, void 0, function* () {
|
|
127
151
|
try {
|
|
128
152
|
const successMessage = yield DeviceUtil_1.default.installDbgAndMkp(option);
|
|
129
|
-
ColorConsole_1.default.
|
|
153
|
+
ColorConsole_1.default.success(`${successMessage}`);
|
|
130
154
|
}
|
|
131
155
|
catch (error) {
|
|
132
|
-
ColorConsole_1.default.
|
|
156
|
+
ColorConsole_1.default.throw(`installDbgAndMkp failed, errorMessage: ${(error === null || error === void 0 ? void 0 : error.toString()) || 'unknown error'}'}`);
|
|
133
157
|
}
|
|
134
158
|
})
|
|
135
159
|
},
|
|
@@ -140,12 +164,30 @@ function main() {
|
|
|
140
164
|
VelaAvdUtils_1.default.createVelaAvdByInquire();
|
|
141
165
|
})
|
|
142
166
|
},
|
|
143
|
-
|
|
167
|
+
{
|
|
168
|
+
name: 'deleteVelaAvd',
|
|
169
|
+
description: 'delete vela avd instance(s)',
|
|
170
|
+
paramList: [
|
|
171
|
+
{
|
|
172
|
+
name: 'avdNames',
|
|
173
|
+
description: 'avd names to delete',
|
|
174
|
+
enableInquirer: true,
|
|
175
|
+
type: 'checkbox',
|
|
176
|
+
choices: VelaAvdUtils_1.default.velaAvdCls.getVelaAvdList().map((item) => {
|
|
177
|
+
return { name: item.avdName, value: item.avdName };
|
|
178
|
+
})
|
|
179
|
+
}
|
|
180
|
+
],
|
|
181
|
+
action: (option) => __awaiter(this, void 0, void 0, function* () {
|
|
182
|
+
const { avdNames } = option;
|
|
183
|
+
avdNames.forEach((avdName) => {
|
|
184
|
+
VelaAvdUtils_1.default.velaAvdCls.deleteVelaAvd(avdName);
|
|
185
|
+
});
|
|
186
|
+
})
|
|
187
|
+
}
|
|
144
188
|
]
|
|
145
189
|
};
|
|
146
190
|
commander_1.Command.registeProgram(config);
|
|
147
191
|
});
|
|
148
192
|
}
|
|
149
193
|
main();
|
|
150
|
-
|
|
151
|
-
//# sourceMappingURL=bin.js.map
|
package/lib/builder/IBuilder.js
CHANGED
package/lib/builder/UxBuilder.js
CHANGED
|
@@ -8,6 +8,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
12
|
+
var t = {};
|
|
13
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
14
|
+
t[p] = s[p];
|
|
15
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
16
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
17
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
18
|
+
t[p[i]] = s[p[i]];
|
|
19
|
+
}
|
|
20
|
+
return t;
|
|
21
|
+
};
|
|
11
22
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
23
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
24
|
};
|
|
@@ -15,7 +26,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
15
26
|
const CompileMode_1 = __importDefault(require("@aiot-toolkit/aiotpack/lib/compiler/enum/CompileMode"));
|
|
16
27
|
const JavascriptDefaultCompileOption_1 = __importDefault(require("@aiot-toolkit/aiotpack/lib/compiler/javascript/JavascriptDefaultCompileOption"));
|
|
17
28
|
const UxConfig_1 = __importDefault(require("@aiot-toolkit/aiotpack/lib/config/UxConfig"));
|
|
18
|
-
const
|
|
29
|
+
const shared_utils_1 = require("@aiot-toolkit/shared-utils");
|
|
30
|
+
const ColorConsole_1 = __importDefault(require("@aiot-toolkit/shared-utils/lib/ColorConsole"));
|
|
19
31
|
const file_lane_1 = require("file-lane");
|
|
20
32
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
21
33
|
const lodash_1 = __importDefault(require("lodash"));
|
|
@@ -43,8 +55,14 @@ class UxBuilder {
|
|
|
43
55
|
type: 'confirm',
|
|
44
56
|
name: 'disabled-jsc',
|
|
45
57
|
description: 'disabled jsc bundle',
|
|
46
|
-
defaultValue:
|
|
58
|
+
defaultValue: false,
|
|
47
59
|
enableInquirer: true
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
name: 'enable-protobuf',
|
|
63
|
+
description: 'enable protobuf',
|
|
64
|
+
type: 'confirm',
|
|
65
|
+
defaultValue: false
|
|
48
66
|
}
|
|
49
67
|
];
|
|
50
68
|
}
|
|
@@ -56,24 +74,30 @@ class UxBuilder {
|
|
|
56
74
|
*/
|
|
57
75
|
build(projectPath, options) {
|
|
58
76
|
return __awaiter(this, void 0, void 0, function* () {
|
|
59
|
-
const
|
|
77
|
+
const watch = options.watch || false;
|
|
60
78
|
// 读取项目中文件的配置
|
|
61
79
|
const quickappConfig = this.readQuickAppConfig(projectPath);
|
|
62
|
-
|
|
80
|
+
const _a = quickappConfig || {}, { cli } = _a, otherConfig = __rest(_a, ["cli"]);
|
|
81
|
+
options = lodash_1.default.merge({}, options, cli);
|
|
63
82
|
// 项目配置
|
|
64
83
|
const uxProjectConfig = new UxConfig_1.default(projectPath);
|
|
65
84
|
// 编译配置
|
|
66
85
|
const compilerOption = lodash_1.default.merge({
|
|
67
86
|
projectPath: path_1.default.join(projectPath, uxProjectConfig.output),
|
|
68
|
-
mode: CompileMode_1.default.DEVELOPMENT,
|
|
69
|
-
disabledJSC: options.disabledJsc
|
|
70
|
-
|
|
71
|
-
|
|
87
|
+
mode: options.mode || CompileMode_1.default.DEVELOPMENT,
|
|
88
|
+
disabledJSC: options.disabledJsc,
|
|
89
|
+
enableProtobuf: options.enableProtobuf
|
|
90
|
+
}, JavascriptDefaultCompileOption_1.default, otherConfig);
|
|
91
|
+
ColorConsole_1.default.info('start build: ', {
|
|
92
|
+
style: ColorConsole_1.default.getStyle(shared_utils_1.LOG_LEVEL.Info),
|
|
72
93
|
word: JSON.stringify({
|
|
73
|
-
step: 'build ux',
|
|
74
94
|
projectPath,
|
|
75
95
|
options,
|
|
76
|
-
watch
|
|
96
|
+
watch,
|
|
97
|
+
node: process.version,
|
|
98
|
+
platform: process.platform,
|
|
99
|
+
arch: process.arch,
|
|
100
|
+
toolkit: require('../../package.json').version
|
|
77
101
|
}, null, 2)
|
|
78
102
|
});
|
|
79
103
|
// 开始编译项目
|
|
@@ -84,10 +108,11 @@ class UxBuilder {
|
|
|
84
108
|
const path = path_1.default.join(projectPath, this.QUICKAPP_CONFIG);
|
|
85
109
|
if (fs_extra_1.default.existsSync(path)) {
|
|
86
110
|
try {
|
|
87
|
-
|
|
111
|
+
const data = require(path);
|
|
112
|
+
return data;
|
|
88
113
|
}
|
|
89
114
|
catch (error) {
|
|
90
|
-
|
|
115
|
+
ColorConsole_1.default.throw((error === null || error === void 0 ? void 0 : error.toString()) || '');
|
|
91
116
|
}
|
|
92
117
|
}
|
|
93
118
|
return;
|
|
@@ -98,5 +123,3 @@ class UxBuilder {
|
|
|
98
123
|
}
|
|
99
124
|
UxBuilder.PROJECT_TYPE = 'ux quick app';
|
|
100
125
|
exports.default = UxBuilder;
|
|
101
|
-
|
|
102
|
-
//# sourceMappingURL=UxBuilder.js.map
|
|
@@ -18,6 +18,7 @@ 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 StringUtil_1 = __importDefault(require("@aiot-toolkit/shared-utils/lib/utils/StringUtil"));
|
|
20
20
|
const file_lane_1 = require("file-lane");
|
|
21
|
+
const FileLaneUtil_1 = __importDefault(require("file-lane/lib/utils/FileLaneUtil"));
|
|
21
22
|
const fs_1 = __importDefault(require("fs"));
|
|
22
23
|
const path_1 = __importDefault(require("path"));
|
|
23
24
|
/**
|
|
@@ -29,7 +30,7 @@ class XtsBuilder {
|
|
|
29
30
|
{
|
|
30
31
|
name: 'skip',
|
|
31
32
|
type: 'string',
|
|
32
|
-
description:
|
|
33
|
+
description: `Can configure skip steps, comma separated, optional values: ${ICompileOptions_1.skipList.join(',')}`,
|
|
33
34
|
validate(value) {
|
|
34
35
|
// TODO: validate 不起作用
|
|
35
36
|
const res = StringUtil_1.default.string2arrayByComma(value);
|
|
@@ -49,24 +50,41 @@ class XtsBuilder {
|
|
|
49
50
|
return fs_1.default.existsSync(path_1.default.resolve(projectPath, 'app/app.xts'));
|
|
50
51
|
}
|
|
51
52
|
build(projectPath, options) {
|
|
53
|
+
var _a;
|
|
52
54
|
return __awaiter(this, void 0, void 0, function* () {
|
|
53
|
-
const
|
|
54
|
-
ColorConsole_1.default.
|
|
55
|
-
message: JSON.stringify({
|
|
56
|
-
projectPath,
|
|
57
|
-
options
|
|
58
|
-
}, undefined, 2),
|
|
59
|
-
level: shared_utils_1.LOG_LEVEL.Success
|
|
60
|
-
});
|
|
55
|
+
const watch = options.watch || false;
|
|
56
|
+
ColorConsole_1.default.success('Start build...\n', { word: 'ProjectPath: ', style: ColorConsole_1.default.getStyle(shared_utils_1.LOG_LEVEL.Success) }, projectPath, '\n', { word: 'buildOptions: ', style: ColorConsole_1.default.getStyle(shared_utils_1.LOG_LEVEL.Success) }, JSON.stringify(options));
|
|
61
57
|
const compilerOptions = {
|
|
62
58
|
skip: StringUtil_1.default.string2arrayByComma(options.skip)
|
|
63
59
|
};
|
|
64
60
|
const config = new aiotpack_1.XtsConfig();
|
|
65
|
-
|
|
61
|
+
if ((_a = compilerOptions.skip) === null || _a === void 0 ? void 0 : _a.includes('xts2ts')) {
|
|
62
|
+
ColorConsole_1.default.info("### skip compile xts to ts due to --skip ${compilerOptions?.skip.join(',')}");
|
|
63
|
+
const context = FileLaneUtil_1.default.createContext(config.output, projectPath);
|
|
64
|
+
const preWorks = config.preWorks || [];
|
|
65
|
+
for (let item of preWorks) {
|
|
66
|
+
try {
|
|
67
|
+
yield item(context, [], config, compilerOptions);
|
|
68
|
+
}
|
|
69
|
+
catch (error) {
|
|
70
|
+
// 报错 prework的item error
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
const follWorks = config.followWorks || [];
|
|
74
|
+
for (let item of follWorks) {
|
|
75
|
+
try {
|
|
76
|
+
yield item(context, config, compilerOptions);
|
|
77
|
+
}
|
|
78
|
+
catch (error) {
|
|
79
|
+
// 报错 prework的item error
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
return new file_lane_1.FileLane(config, projectPath, compilerOptions).start({ watch });
|
|
85
|
+
}
|
|
66
86
|
});
|
|
67
87
|
}
|
|
68
88
|
}
|
|
69
89
|
XtsBuilder.PROJECT_TYPE = 'xts quick app';
|
|
70
90
|
exports.default = XtsBuilder;
|
|
71
|
-
|
|
72
|
-
//# sourceMappingURL=XtsBuilder.js.map
|
|
@@ -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;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ICommand, IParam } from '@aiot-toolkit/commander';
|
|
2
|
+
/**
|
|
3
|
+
* IStarter
|
|
4
|
+
*/
|
|
5
|
+
export default class IStarter<O = any> {
|
|
6
|
+
protected name: string;
|
|
7
|
+
protected description: string;
|
|
8
|
+
/**
|
|
9
|
+
* start 的参数列表
|
|
10
|
+
*/
|
|
11
|
+
readonly params: IParam[];
|
|
12
|
+
constructor(name: string, description: string);
|
|
13
|
+
/**
|
|
14
|
+
* start 的命令
|
|
15
|
+
*/
|
|
16
|
+
getCommond(): ICommand;
|
|
17
|
+
/**
|
|
18
|
+
* 运行项目
|
|
19
|
+
* @param projectPath 项目路径
|
|
20
|
+
* @param options 命令参数
|
|
21
|
+
*/
|
|
22
|
+
start(projectPath: string, options: O): void | Promise<void>;
|
|
23
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
/**
|
|
13
|
+
* IStarter
|
|
14
|
+
*/
|
|
15
|
+
class IStarter {
|
|
16
|
+
constructor(name, description) {
|
|
17
|
+
this.name = name;
|
|
18
|
+
this.description = description;
|
|
19
|
+
/**
|
|
20
|
+
* start 的参数列表
|
|
21
|
+
*/
|
|
22
|
+
this.params = [];
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* start 的命令
|
|
26
|
+
*/
|
|
27
|
+
getCommond() {
|
|
28
|
+
return {
|
|
29
|
+
name: this.name,
|
|
30
|
+
description: this.description,
|
|
31
|
+
paramList: this.params,
|
|
32
|
+
action: (option) => __awaiter(this, void 0, void 0, function* () {
|
|
33
|
+
const projectPath = process.cwd();
|
|
34
|
+
this.start(projectPath, option);
|
|
35
|
+
})
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* 运行项目
|
|
40
|
+
* @param projectPath 项目路径
|
|
41
|
+
* @param options 命令参数
|
|
42
|
+
*/
|
|
43
|
+
start(projectPath, options) { }
|
|
44
|
+
}
|
|
45
|
+
exports.default = IStarter;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import ParamType from '@aiot-toolkit/commander/lib/interface/IParam';
|
|
2
|
+
import { IStartOptions } from '@aiot-toolkit/emulator';
|
|
3
|
+
import UxBuilder from '../builder/UxBuilder';
|
|
4
|
+
import IStarter from './IStarter';
|
|
5
|
+
declare class UxStarter extends IStarter<IStartOptions> {
|
|
6
|
+
builder: UxBuilder;
|
|
7
|
+
params: ParamType[];
|
|
8
|
+
start(projectPath: string, options: any): Promise<void>;
|
|
9
|
+
}
|
|
10
|
+
export default UxStarter;
|