aiot-toolkit 2.0.4-beta.2 → 2.0.4-beta.4

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,3 +1,12 @@
1
+ <!-- 此文档由 tools/createFile.ts 生成, 请勿手动修改 -->
2
+ <!--
3
+
4
+ 生成方法
5
+ 1. 修改 tools/README.template.md
6
+ 2. 修改 tools/VelaBuilderParam.json
7
+ 3. 执行 tools/createFile.ts
8
+ -->
9
+
1
10
  # 项目介绍
2
11
 
3
12
  aiot-toolkit 2.0 是将 **源码项目** 转换为 **目标代码项目** 并生成 **目标代码应用** 的命令行工具,同时配备了 **模拟器** 相关功能供开发者使用。
@@ -39,7 +48,21 @@ aiot-toolkit2.0目前支持的打包格式如下:
39
48
  | aiot getConnectedDevices | 获取已连接设备列表 |
40
49
  | aiot getPlatforms | 获取设置平台 |
41
50
  | aiot installDbgAndMkp | 在真机上安装快应用调试器 |
42
- | aiot createVelaAvd | 创建 vela 模拟器 |
43
- | aiot deleteVelaAvd | 删除 vela 模拟器 |
44
-
45
- ## 函数调用
51
+ | aiot createVVD | 创建 vela 模拟器 |
52
+ | aiot deleteVVD | 删除 vela 模拟器 |
53
+
54
+ ## build 参数
55
+
56
+
57
+ | 参数 | 类型 | 描述 | 默认值 | 参考 |
58
+ | --- | --- | --- | --- | --- |
59
+ | *devtool* | string | source map 配置 | | https://www.webpackjs.com/configuration/devtool/#devtool |
60
+ | *enable-jsc* | confirm | 是否启用 jsc bundle | `false` | |
61
+ | *enable-protobuf* | confirm | 是否启用 `protobuf` | `false` | |
62
+ | *enable-e2e* | confirm | 是否为当前项目注入测试套件 | `false` | https://doc.quickapp.cn/tutorial/others/testing.html |
63
+ | *enable-stats* | confirm | 分析 webpack 输出文件的大小 | `false` | |
64
+ | *optimize-css-attr* | confirm | 优化压缩css名称 | `false` | |
65
+ | *complete-feature* | confirm | 自动将代码中使用的功能,补全到 manifest.json 的 features 字段中 | `false` | |
66
+ | *start-page* | string | 启动页面,示例:`--start-page 'pages/index?a=1&b=2'` | | |
67
+ | *~~enable-custom-component~~* | confirm | **已废弃** | | |
68
+ | *~~stats~~* | confirm | **已废弃** | | |
@@ -1,25 +1,7 @@
1
1
  import { IParam } from '@aiot-toolkit/commander';
2
2
  import IBuilder from './IBuilder';
3
- import UxBuilderBase, { IUxBuildOption } from './UxBuilderBase';
4
- export interface IVelaUxBuilderOption extends IUxBuildOption {
5
- watch?: boolean;
6
- enableJsc?: boolean;
7
- enableE2e?: boolean;
8
- enableStats?: boolean;
9
- optimizeCssAttr?: boolean;
10
- /**
11
- * 是否自动补全 manifest.json 中的 features 配置
12
- */
13
- completeFeature?: boolean;
14
- /**
15
- * 此选项控制是否生成,以及如何生成 source map
16
- *
17
- * @see https://www.webpackjs.com/configuration/devtool/#devtool
18
- */
19
- devtool?: string;
20
- enableProtobuf?: boolean;
21
- }
22
- export declare const velaUxBuilderParams: IParam[];
3
+ import UxBuilderBase from './UxBuilderBase';
4
+ import IVelaUxBuilderOption from '../interface/IVelaUxBuilderOption';
23
5
  /**
24
6
  * VelaUxBuilder
25
7
  */
@@ -3,66 +3,16 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.velaUxBuilderParams = exports.default = void 0;
6
+ exports.default = void 0;
7
7
  var _sharedUtils = require("@aiot-toolkit/shared-utils");
8
8
  var _UxBuilderBase = _interopRequireDefault(require("./UxBuilderBase"));
9
+ var _IVelaUxBuilderOption = require("../interface/IVelaUxBuilderOption");
9
10
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
10
- const velaUxBuilderParams = exports.velaUxBuilderParams = [{
11
- type: 'string',
12
- name: 'devtool',
13
- description: 'source map config'
14
- }, {
15
- name: 'disable-subpackages',
16
- description: 'disable subpackages'
17
- }, {
18
- type: 'confirm',
19
- name: 'enable-jsc',
20
- description: 'enable jsc bundle',
21
- defaultValue: false
22
- }, {
23
- type: 'confirm',
24
- name: 'enable-protobuf',
25
- description: 'enable protobuf',
26
- defaultValue: false
27
- }, {
28
- type: 'confirm',
29
- name: 'enable-e2e',
30
- description: 'inject test-suite for current project',
31
- defaultValue: false
32
- }, {
33
- type: 'confirm',
34
- name: 'enable-stats',
35
- description: 'analyse time and size of webpack output files',
36
- defaultValue: false
37
- }, {
38
- type: 'confirm',
39
- name: 'optimize-css-attr',
40
- description: 'optimize css attr',
41
- defaultValue: false
42
- }, {
43
- type: 'confirm',
44
- name: 'complete-feature',
45
- description: 'auto complete the features are used in the code into the features field of the manifest.json file',
46
- defaultValue: false
47
- }, {
48
- type: 'confirm',
49
- name: 'enable-custom-component',
50
- description: 'deprecated',
51
- deprecated: 'please remove it now',
52
- deprecatedVersion: '2.1.0'
53
- }, {
54
- type: 'confirm',
55
- name: 'stats',
56
- description: 'deprecated',
57
- deprecated: 'please use `enable-stats` instead',
58
- deprecatedVersion: '2.1.0'
59
- }];
60
-
61
11
  /**
62
12
  * VelaUxBuilder
63
13
  */
64
14
  class VelaUxBuilder extends _UxBuilderBase.default {
65
- params = (() => velaUxBuilderParams)();
15
+ params = (() => _IVelaUxBuilderOption.velaUxBuilderParams)();
66
16
  match(projectPath) {
67
17
  return _sharedUtils.ProjectType.getProjectType(projectPath) === _sharedUtils.ProjectType.VELA_UX;
68
18
  }
@@ -0,0 +1,56 @@
1
+ /*****
2
+ * 由 tools/createFile.ts 生成, 请勿手动修改
3
+ *
4
+ * 生成方法
5
+ * 1. 修改 tools/VelaBuilderParam.json
6
+ * 2. 执行 tools/createFile.ts
7
+ */
8
+ import { IParam } from '@aiot-toolkit/commander';
9
+ import { IUxBuildOption } from '../builder/UxBuilderBase';
10
+ interface IVelaUxBuilderOption extends IUxBuildOption {
11
+ /**
12
+ * source map 配置
13
+ * @see https://www.webpackjs.com/configuration/devtool/#devtool
14
+ */
15
+ devtool?: string;
16
+ /**
17
+ * 是否启用 jsc bundle
18
+ */
19
+ enableJsc?: boolean;
20
+ /**
21
+ * 是否启用 `protobuf`
22
+ */
23
+ enableProtobuf?: boolean;
24
+ /**
25
+ * 是否为当前项目注入测试套件
26
+ * @see https://doc.quickapp.cn/tutorial/others/testing.html
27
+ */
28
+ enableE2e?: boolean;
29
+ /**
30
+ * 分析 webpack 输出文件的大小
31
+ */
32
+ enableStats?: boolean;
33
+ /**
34
+ * 优化压缩css名称
35
+ */
36
+ optimizeCssAttr?: boolean;
37
+ /**
38
+ * 自动将代码中使用的功能,补全到 manifest.json 的 features 字段中
39
+ */
40
+ completeFeature?: boolean;
41
+ /**
42
+ * 已废弃,请删除
43
+ */
44
+ enableCustomComponent?: boolean;
45
+ /**
46
+ * 已废弃,请使用 `enable-stats` 代替
47
+ */
48
+ stats?: boolean;
49
+ /**
50
+ * 启动页面,示例:`--start-page 'pages/index?a=1&b=2'`
51
+ */
52
+ startPage?: string;
53
+ }
54
+ declare const velaUxBuilderParams: IParam[];
55
+ export { velaUxBuilderParams };
56
+ export default IVelaUxBuilderOption;
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.velaUxBuilderParams = void 0;
7
+ /*****
8
+ * 由 tools/createFile.ts 生成, 请勿手动修改
9
+ *
10
+ * 生成方法
11
+ * 1. 修改 tools/VelaBuilderParam.json
12
+ * 2. 执行 tools/createFile.ts
13
+ */
14
+
15
+ const velaUxBuilderParams = exports.velaUxBuilderParams = [{
16
+ "type": "string",
17
+ "name": "devtool",
18
+ "description": "source map config"
19
+ }, {
20
+ "type": "confirm",
21
+ "name": "enable-jsc",
22
+ "description": "enable jsc bundle",
23
+ "defaultValue": false
24
+ }, {
25
+ "type": "confirm",
26
+ "name": "enable-protobuf",
27
+ "description": "enable protobuf",
28
+ "defaultValue": false
29
+ }, {
30
+ "type": "confirm",
31
+ "name": "enable-e2e",
32
+ "description": "inject test-suite for current project",
33
+ "defaultValue": false
34
+ }, {
35
+ "type": "confirm",
36
+ "name": "enable-stats",
37
+ "description": "analyse time and size of webpack output files",
38
+ "defaultValue": false
39
+ }, {
40
+ "type": "confirm",
41
+ "name": "optimize-css-attr",
42
+ "description": "optimize css attr",
43
+ "defaultValue": false
44
+ }, {
45
+ "type": "confirm",
46
+ "name": "complete-feature",
47
+ "description": "auto complete the features are used in the code into the features field of the manifest.json file",
48
+ "defaultValue": false
49
+ }, {
50
+ "type": "confirm",
51
+ "name": "enable-custom-component",
52
+ "description": "deprecated",
53
+ "deprecated": "please remove it now",
54
+ "deprecatedVersion": "2.1.0"
55
+ }, {
56
+ "type": "confirm",
57
+ "name": "stats",
58
+ "description": "deprecated",
59
+ "deprecated": "please use `enable-stats` instead",
60
+ "deprecatedVersion": "2.1.0"
61
+ }, {
62
+ "type": "string",
63
+ "name": "start-page",
64
+ "description": "start page of current project, example: --start-page 'pages/index?a=1&b=2'"
65
+ }];
@@ -10,15 +10,14 @@ var _sharedUtils = require("@aiot-toolkit/shared-utils");
10
10
  var _prompts = require("@inquirer/prompts");
11
11
  var _path = _interopRequireDefault(require("path"));
12
12
  var _portfinder = _interopRequireDefault(require("portfinder"));
13
- var _VelaUxBuilder = _interopRequireWildcard(require("../builder/VelaUxBuilder"));
13
+ var _VelaUxBuilder = _interopRequireDefault(require("../builder/VelaUxBuilder"));
14
14
  var _VelaAvdUtils = _interopRequireDefault(require("../utils/VelaAvdUtils"));
15
15
  var _IStarter = _interopRequireDefault(require("./IStarter"));
16
16
  var _fsExtra = _interopRequireDefault(require("fs-extra"));
17
17
  var _aiotpack = require("@aiot-toolkit/aiotpack");
18
18
  var _events = _interopRequireDefault(require("events"));
19
19
  var _FileLaneTriggerType = _interopRequireDefault(require("file-lane/lib/enum/FileLaneTriggerType"));
20
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
21
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
20
+ var _IVelaUxBuilderOption = require("../interface/IVelaUxBuilderOption");
22
21
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
23
22
  /**
24
23
  * VelaUxStarter
@@ -61,7 +60,7 @@ class VelaUxStarter extends _IStarter.default {
61
60
  description: 'deprecated',
62
61
  deprecated: 'please remove it now',
63
62
  deprecatedVersion: '2.1.0'
64
- }, ..._VelaUxBuilder.velaUxBuilderParams])();
63
+ }, ..._IVelaUxBuilderOption.velaUxBuilderParams])();
65
64
  async start(projectPath, options) {
66
65
  const check = await _VelaAvdUtils.default.checkEmulatorEnv();
67
66
  if (!check) {
@@ -126,7 +125,7 @@ class VelaUxStarter extends _IStarter.default {
126
125
  if (!this.emulatorInstance) {
127
126
  throw new Error('emulatorInstance is undefined');
128
127
  }
129
- const projectInfo = _aiotpack.UxFileUtils.getMainfestInfo(projectPath, compilerOption.sourceRoot);
128
+ const projectInfo = _aiotpack.UxFileUtils.getManifestInfo(projectPath, compilerOption.sourceRoot);
130
129
  if (this.lastRpk && _fsExtra.default.existsSync(this.lastRpk)) {
131
130
  const targetPath = await this.emulatorInstance?.pushRpk(this.lastRpk, projectInfo.package);
132
131
  await this.emulatorInstance?.install(targetPath, projectInfo.package);
@@ -61,7 +61,7 @@ class VelaVvdUtils {
61
61
  let width = '466';
62
62
  let height = '466';
63
63
  // vela4.0不允许自定义分辨率
64
- if (velaImage === _emulator.VelaImageType.REL) {
64
+ if ((0, _emulator.isMiwearImageType)(velaImage)) {
65
65
  const needSkin = await (0, _prompts.confirm)({
66
66
  message: 'need vvd skin?',
67
67
  default: true
@@ -94,6 +94,7 @@ class VelaVvdUtils {
94
94
  });
95
95
  if ((await vvdManager.hasSDKPartUpdate()).length > 0) {
96
96
  const downloder = await vvdManager.downloadSDK({
97
+ imageTypeArr: [velaImage],
97
98
  force: false,
98
99
  cliProgress: true,
99
100
  parallelDownloads: 6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aiot-toolkit",
3
- "version": "2.0.4-beta.2",
3
+ "version": "2.0.4-beta.4",
4
4
  "description": "Tools for creating, developing, and packaging aiot applications.",
5
5
  "keywords": [
6
6
  "aiot"
@@ -22,14 +22,14 @@
22
22
  "test": "node ./__tests__/aiot-toolkit.test.js"
23
23
  },
24
24
  "dependencies": {
25
- "@aiot-toolkit/aiotpack": "2.0.4-beta.2",
26
- "@aiot-toolkit/commander": "2.0.4-beta.2",
27
- "@aiot-toolkit/emulator": "2.0.4-beta.2",
28
- "@aiot-toolkit/shared-utils": "2.0.4-beta.2",
25
+ "@aiot-toolkit/aiotpack": "2.0.4-beta.4",
26
+ "@aiot-toolkit/commander": "2.0.4-beta.4",
27
+ "@aiot-toolkit/emulator": "2.0.4-beta.4",
28
+ "@aiot-toolkit/shared-utils": "2.0.4-beta.4",
29
29
  "@inquirer/prompts": "^5.3.0",
30
30
  "@miwt/adb": "^0.9.0",
31
31
  "axios": "^1.7.4",
32
- "file-lane": "2.0.4-beta.2",
32
+ "file-lane": "2.0.4-beta.4",
33
33
  "fs-extra": "^11.2.0",
34
34
  "koa-router": "^13.0.1",
35
35
  "lodash": "^4.17.21",
@@ -43,5 +43,5 @@
43
43
  "@types/qr-image": "^3.2.9",
44
44
  "@types/semver": "^7.5.8"
45
45
  },
46
- "gitHead": "e9015685f29790709c420a9f8c41ade936a85300"
46
+ "gitHead": "f06b80be7d99c43f88db001415c0eb15acb65286"
47
47
  }