aiot-toolkit 2.0.1-alpha.9 → 2.0.2-beta.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.
Files changed (39) hide show
  1. package/README.md +32 -29
  2. package/lib/bin.js +95 -41
  3. package/lib/builder/IBuilder.js +0 -2
  4. package/lib/builder/UxBuilder.d.ts +1 -0
  5. package/lib/builder/UxBuilder.js +41 -15
  6. package/lib/builder/XtsBuilder.js +30 -12
  7. package/lib/interface/CommandInterface.js +0 -2
  8. package/lib/interface/VelaEmulatorInterface.d.ts +6 -1
  9. package/lib/interface/VelaEmulatorInterface.js +0 -2
  10. package/lib/starter/IStarter.d.ts +23 -0
  11. package/lib/starter/IStarter.js +39 -0
  12. package/lib/starter/UxStarter.d.ts +10 -0
  13. package/lib/starter/UxStarter.js +139 -0
  14. package/lib/starter/XtsStarter.d.ts +9 -0
  15. package/lib/starter/XtsStarter.js +19 -0
  16. package/lib/utils/AdbUtils.js +2 -11
  17. package/lib/utils/DeviceUtil.d.ts +1 -1
  18. package/lib/utils/DeviceUtil.js +22 -93
  19. package/lib/utils/RequestUtils.js +4 -19
  20. package/lib/utils/UxBuilderUtils.d.ts +8 -0
  21. package/lib/utils/UxBuilderUtils.js +51 -0
  22. package/lib/utils/VelaAvdUtils.d.ts +8 -2
  23. package/lib/utils/VelaAvdUtils.js +54 -79
  24. package/lib/waiter.js +0 -2
  25. package/package.json +13 -11
  26. package/lib/bin.js.map +0 -1
  27. package/lib/builder/IBuilder.js.map +0 -1
  28. package/lib/builder/UxBuilder.js.map +0 -1
  29. package/lib/builder/XtsBuilder.js.map +0 -1
  30. package/lib/interface/CommandInterface.js.map +0 -1
  31. package/lib/interface/VelaEmulatorInterface.js.map +0 -1
  32. package/lib/starter/GoldfishStarter.d.ts +0 -9
  33. package/lib/starter/GoldfishStarter.js +0 -108
  34. package/lib/starter/GoldfishStarter.js.map +0 -1
  35. package/lib/utils/AdbUtils.js.map +0 -1
  36. package/lib/utils/DeviceUtil.js.map +0 -1
  37. package/lib/utils/RequestUtils.js.map +0 -1
  38. package/lib/utils/VelaAvdUtils.js.map +0 -1
  39. package/lib/waiter.js.map +0 -1
package/README.md CHANGED
@@ -1,41 +1,44 @@
1
- # `aiot-toolkit`
1
+ # 项目介绍
2
2
 
3
- > aiot-toolkit 命令行工具
3
+ aiot-toolkit 2.0 是将 **源码项目** 转换为 **目标代码项目** 并生成 **目标代码应用** 的命令行工具,同时配备了 **模拟器** 相关功能供开发者使用。
4
4
 
5
- ## 使用
5
+ aiot-toolkit2.0目前支持的打包格式如下:
6
6
 
7
- ## 贡献代码
7
+ - ux:vela 平台下的应用,目前大量使用于小米手表、音箱等智能穿戴及物联网设备
8
8
 
9
- ### 增加打包支持的项目
9
+ ## 安装使用
10
10
 
11
- 1. 在`./src/builder` 中新增类文件 XBuilder,并实现 IBuilder接口
11
+ - 全局安装
12
12
 
13
- ```js
14
- import ParamType from '@aiot-toolkit/commander/lib/interface/IParam'
15
- import IBuild from './IBuild'
13
+ `npm i aiot-toolkit -g`
16
14
 
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
15
+ `npm i create-aiot -g`
27
16
 
28
- ```
17
+ - 创建项目
29
18
 
30
- 2. 实现对应的方法
31
- 3. 新增静态属性:
19
+ 1. `create-aiot ux`
20
+ 2. 在项目根目录执行:`npm i`
32
21
 
33
- ```js
34
- static readonly PROJECT_TYPE = '项目类型的名称'
35
- ```
22
+ - 本机运行项目
36
23
 
37
- 4. 在`./src/bin.ts` 的 `builderTypeList`中添加 XBuilder
24
+ 在项目根目录执行 `aiot start`,此会启动模拟器,并运行项目
38
25
 
39
- ```js
40
- const builderTypeList = [UxBuild, XtsBuild, XBuilder]
41
- ```
26
+ * 打包项目
27
+
28
+ 在项目根目录执行 `aiot release`
29
+
30
+ ## 常用命令
31
+
32
+ | 命令 | 说明 |
33
+ | ------------------------ | ------------------------ |
34
+ | npm create aiot | 创建并手动选择项目 |
35
+ | npm create aiot xts | 创建xts项目 |
36
+ | npm 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 模拟器 |
package/lib/bin.js CHANGED
@@ -13,22 +13,46 @@ 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 commander_1 = require("@aiot-toolkit/commander");
17
- const shared_utils_1 = require("@aiot-toolkit/shared-utils");
16
+ const semver_1 = __importDefault(require("semver"));
18
17
  const ColorConsole_1 = __importDefault(require("@aiot-toolkit/shared-utils/lib/ColorConsole"));
19
- const create_aiot_1 = require("create-aiot");
18
+ // 支持的最低node版本
19
+ const NODE_MINIMUM_VERSION = '16.0.0';
20
+ checkVersion();
21
+ const CompileMode_1 = __importDefault(require("@aiot-toolkit/aiotpack/lib/compiler/enum/CompileMode"));
22
+ const commander_1 = require("@aiot-toolkit/commander");
23
+ const fs_1 = __importDefault(require("fs"));
24
+ const path_1 = __importDefault(require("path"));
25
+ const UxBuilder_1 = __importDefault(require("./builder/UxBuilder"));
20
26
  const XtsBuilder_1 = __importDefault(require("./builder/XtsBuilder"));
21
- const GoldfishStarter_1 = __importDefault(require("./starter/GoldfishStarter"));
27
+ const UxStarter_1 = __importDefault(require("./starter/UxStarter"));
28
+ const XtsStarter_1 = __importDefault(require("./starter/XtsStarter"));
22
29
  const DeviceUtil_1 = __importDefault(require("./utils/DeviceUtil"));
23
30
  const VelaAvdUtils_1 = __importDefault(require("./utils/VelaAvdUtils"));
24
- const waiter_1 = __importDefault(require("./waiter"));
25
- // 配置支持的 builder 类型,新增的项目类型,只需在此处加上类型
26
- function findBuilder(projectPath) {
27
- return new XtsBuilder_1.default();
31
+ // 校验当前环境中的node
32
+ function checkVersion() {
33
+ const currentVersion = process.versions.node;
34
+ if (semver_1.default.lt(currentVersion, NODE_MINIMUM_VERSION)) {
35
+ ColorConsole_1.default.throw('It is detected that the current NodeJS version ', { word: currentVersion }, ' is too low, please upgrade to NodeJS version higher than ', { word: NODE_MINIMUM_VERSION });
36
+ process.exit();
37
+ }
38
+ }
39
+ // 配置支持的 builder 类型,新增的项目类型,需在此处加上类型
40
+ const projectMapper = {
41
+ ux: {
42
+ builder: UxBuilder_1.default,
43
+ starter: UxStarter_1.default
44
+ },
45
+ xts: {
46
+ builder: XtsBuilder_1.default,
47
+ starter: XtsStarter_1.default
48
+ }
49
+ };
50
+ function findBuilder() {
51
+ const projectType = getProjectType();
52
+ return new projectMapper[projectType].builder();
28
53
  }
29
54
  function build(command, description) {
30
- const projectPath = process.cwd();
31
- const builder = findBuilder(projectPath);
55
+ const builder = findBuilder();
32
56
  const paramList = builder === null || builder === void 0 ? void 0 : builder.params;
33
57
  return {
34
58
  name: command,
@@ -36,48 +60,60 @@ function build(command, description) {
36
60
  paramList,
37
61
  action: (option) => __awaiter(this, void 0, void 0, function* () {
38
62
  // 获取对应的 build;如果存在,执行 build 函数,不存在,提示
63
+ option.mode = command === 'release' ? CompileMode_1.default.PRODUCTION : CompileMode_1.default.DEVELOPMENT;
39
64
  const projectPath = process.cwd();
40
- const builder = findBuilder(projectPath);
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
- }
65
+ yield builder.build(projectPath, option);
56
66
  })
57
67
  };
58
68
  }
69
+ function getProjectType() {
70
+ const projectPath = process.cwd();
71
+ const isXts = fs_1.default.existsSync(path_1.default.resolve(projectPath, 'app/app.xts'));
72
+ const isUx = fs_1.default.existsSync(path_1.default.resolve(projectPath, 'src/app.ux'));
73
+ if (isUx) {
74
+ return "ux" /* ProjectType.UX */;
75
+ }
76
+ else if (isXts) {
77
+ return "xts" /* ProjectType.XTS */;
78
+ }
79
+ return "ux" /* ProjectType.UX */;
80
+ }
81
+ function findStarter(command, description) {
82
+ const projectType = getProjectType();
83
+ return new projectMapper[projectType].starter(command, description);
84
+ }
59
85
  function main() {
60
86
  return __awaiter(this, void 0, void 0, function* () {
61
- const aiotCreate = yield (0, create_aiot_1.getAiotCreateCommand)();
62
87
  const config = {
63
88
  name: 'aiot-toolkit',
64
89
  description: 'contains build, dev, release, etc. commands for aiot toolkit',
65
- version: '2.0.1',
90
+ version: require('../package.json').version,
66
91
  commandList: [
67
92
  build('build', 'build project'),
68
- new GoldfishStarter_1.default('start', 'start project').getParamList(),
93
+ build('release', 'release the project'),
94
+ findStarter('start', 'start project').getCommond(),
95
+ {
96
+ name: 'watch',
97
+ description: 'recompile project while file changes',
98
+ action: (option) => __awaiter(this, void 0, void 0, function* () {
99
+ const projectPath = process.cwd();
100
+ const builder = findBuilder();
101
+ option.watch = true;
102
+ yield builder.build(projectPath, option);
103
+ // waiter.describe()
104
+ // waiter.start()
105
+ })
106
+ },
69
107
  {
70
108
  name: 'getConnectedDevices',
71
109
  description: 'get all connected devices',
72
- action: (option) => __awaiter(this, void 0, void 0, function* () {
110
+ action: () => __awaiter(this, void 0, void 0, function* () {
73
111
  try {
74
112
  const connectedDevices = yield DeviceUtil_1.default.getAllConnectedDevices();
75
- ColorConsole_1.default.log({
76
- message: `The connected devices are: ${connectedDevices ? connectedDevices.join(', ') : 'null'}`
77
- });
113
+ ColorConsole_1.default.info(`The connected devices are: ${connectedDevices ? connectedDevices.join(', ') : 'null'}`);
78
114
  }
79
115
  catch (error) {
80
- ColorConsole_1.default.log({ message: error.message, level: shared_utils_1.LOG_LEVEL.Error });
116
+ ColorConsole_1.default.throw(`Error: getConnectedDevices failed`);
81
117
  }
82
118
  })
83
119
  },
@@ -126,26 +162,44 @@ function main() {
126
162
  action: (option) => __awaiter(this, void 0, void 0, function* () {
127
163
  try {
128
164
  const successMessage = yield DeviceUtil_1.default.installDbgAndMkp(option);
129
- ColorConsole_1.default.log({ message: successMessage, level: shared_utils_1.LOG_LEVEL.Success });
165
+ ColorConsole_1.default.success(`${successMessage}`);
130
166
  }
131
167
  catch (error) {
132
- ColorConsole_1.default.log({ message: error.message, level: shared_utils_1.LOG_LEVEL.Error });
168
+ ColorConsole_1.default.throw(`installDbgAndMkp failed, errorMessage: ${(error === null || error === void 0 ? void 0 : error.toString()) || 'unknown error'}'}`);
133
169
  }
134
170
  })
135
171
  },
136
172
  {
137
- name: 'createVelaAvd',
138
- description: 'create a vela avd instance',
173
+ name: 'createVVD',
174
+ description: 'create a vela virtual device',
139
175
  action: () => __awaiter(this, void 0, void 0, function* () {
140
176
  VelaAvdUtils_1.default.createVelaAvdByInquire();
141
177
  })
142
178
  },
143
- Object.assign(Object.assign({}, aiotCreate), { name: 'create', description: 'create aiot project' })
179
+ {
180
+ name: 'deleteVVD',
181
+ description: 'delete vela virtual device(s)',
182
+ paramList: [
183
+ {
184
+ name: 'avdNames',
185
+ description: 'avd names to delete',
186
+ enableInquirer: true,
187
+ type: 'checkbox',
188
+ choices: VelaAvdUtils_1.default.velaAvdCls.getVelaAvdList().map((item) => {
189
+ return { name: item.avdName, value: item.avdName };
190
+ })
191
+ }
192
+ ],
193
+ action: (option) => __awaiter(this, void 0, void 0, function* () {
194
+ const { avdNames } = option;
195
+ avdNames.forEach((avdName) => {
196
+ VelaAvdUtils_1.default.velaAvdCls.deleteVelaAvd(avdName);
197
+ });
198
+ })
199
+ }
144
200
  ]
145
201
  };
146
202
  commander_1.Command.registeProgram(config);
147
203
  });
148
204
  }
149
205
  main();
150
-
151
- //# sourceMappingURL=bin.js.map
@@ -1,4 +1,2 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
-
4
- //# sourceMappingURL=IBuilder.js.map
@@ -5,6 +5,7 @@ import IBuilder from './IBuilder';
5
5
  interface IUxBuilderOption extends Dictionary {
6
6
  watch?: boolean;
7
7
  mode: CompileMode;
8
+ disabledJsc: boolean;
8
9
  }
9
10
  /**
10
11
  * UxBuilder
@@ -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,11 +26,13 @@ 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 ColorConsole2_1 = __importDefault(require("@aiot-toolkit/shared-utils/lib/ColorConsole2"));
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"));
22
34
  const path_1 = __importDefault(require("path"));
35
+ const UxBuilderUtils_1 = __importDefault(require("../utils/UxBuilderUtils"));
23
36
  /**
24
37
  * UxBuilder
25
38
  */
@@ -32,6 +45,7 @@ class UxBuilder {
32
45
  description: 'inject test-suite for current project'
33
46
  },
34
47
  {
48
+ type: 'string',
35
49
  name: 'devtool',
36
50
  description: 'source map config'
37
51
  },
@@ -43,8 +57,13 @@ class UxBuilder {
43
57
  type: 'confirm',
44
58
  name: 'disabled-jsc',
45
59
  description: 'disabled jsc bundle',
46
- defaultValue: true,
47
- enableInquirer: true
60
+ defaultValue: false
61
+ },
62
+ {
63
+ name: 'enable-protobuf',
64
+ description: 'enable protobuf',
65
+ type: 'confirm',
66
+ defaultValue: false
48
67
  }
49
68
  ];
50
69
  }
@@ -56,24 +75,32 @@ class UxBuilder {
56
75
  */
57
76
  build(projectPath, options) {
58
77
  return __awaiter(this, void 0, void 0, function* () {
59
- const { watch } = options;
78
+ const watch = options.watch || false;
60
79
  // 读取项目中文件的配置
61
80
  const quickappConfig = this.readQuickAppConfig(projectPath);
62
- options = lodash_1.default.merge({}, options, quickappConfig === null || quickappConfig === void 0 ? void 0 : quickappConfig.cli);
81
+ const _a = quickappConfig || {}, { cli } = _a, otherConfig = __rest(_a, ["cli"]);
82
+ options = lodash_1.default.merge({}, options, cli);
63
83
  // 项目配置
64
84
  const uxProjectConfig = new UxConfig_1.default(projectPath);
65
85
  // 编译配置
86
+ const compileMode = options.mode || CompileMode_1.default.DEVELOPMENT;
66
87
  const compilerOption = lodash_1.default.merge({
67
88
  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({
89
+ mode: compileMode,
90
+ disabledJSC: options.disabledJsc,
91
+ enableProtobuf: options.enableProtobuf,
92
+ devtool: UxBuilderUtils_1.default.getDevtoolValue(compileMode, options.devtool || false)
93
+ }, JavascriptDefaultCompileOption_1.default, otherConfig);
94
+ ColorConsole_1.default.info('start build: ', {
95
+ style: ColorConsole_1.default.getStyle(shared_utils_1.LOG_LEVEL.Info),
72
96
  word: JSON.stringify({
73
- step: 'build ux',
74
97
  projectPath,
75
98
  options,
76
- watch
99
+ watch,
100
+ node: process.version,
101
+ platform: process.platform,
102
+ arch: process.arch,
103
+ toolkit: require('../../package.json').version
77
104
  }, null, 2)
78
105
  });
79
106
  // 开始编译项目
@@ -84,10 +111,11 @@ class UxBuilder {
84
111
  const path = path_1.default.join(projectPath, this.QUICKAPP_CONFIG);
85
112
  if (fs_extra_1.default.existsSync(path)) {
86
113
  try {
87
- return fs_extra_1.default.readJsonSync(path);
114
+ const data = require(path);
115
+ return data;
88
116
  }
89
117
  catch (error) {
90
- ColorConsole2_1.default.throw((error === null || error === void 0 ? void 0 : error.toString()) || '');
118
+ ColorConsole_1.default.throw((error === null || error === void 0 ? void 0 : error.toString()) || '');
91
119
  }
92
120
  }
93
121
  return;
@@ -98,5 +126,3 @@ class UxBuilder {
98
126
  }
99
127
  UxBuilder.PROJECT_TYPE = 'ux quick app';
100
128
  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: 'Can configure skip steps, comma separated, optional values: install (skip install pre-dependencies),ts2wasm (skip compilation), package (skip packaging)',
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 { watch } = options;
54
- ColorConsole_1.default.log({
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
- return new file_lane_1.FileLane(config, projectPath, compilerOptions).start({ watch });
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.worker(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,4 +1,2 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
-
4
- //# sourceMappingURL=CommandInterface.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': string;
9
+ 'system-images': ISystemImagesVersionInfo;
5
10
  qa: string;
6
11
  skins: string;
7
12
  tools: string;
@@ -1,4 +1,2 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
-
4
- //# sourceMappingURL=VelaEmulatorInterface.js.map
@@ -0,0 +1,23 @@
1
+ import { ICommand, IParam } from '@aiot-toolkit/commander';
2
+ /**
3
+ * IStarter
4
+ */
5
+ export default abstract 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
+ abstract start(projectPath: string, options: O): void | Promise<void>;
23
+ }
@@ -0,0 +1,39 @@
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
+ 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;