aiot-toolkit 2.0.2 → 2.0.3-beta.1

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
@@ -32,7 +32,6 @@ aiot-toolkit2.0目前支持的打包格式如下:
32
32
  | 命令 | 说明 |
33
33
  | ------------------------ | ------------------------ |
34
34
  | npm create aiot | 创建并手动选择项目 |
35
- | npm create aiot xts | 创建xts项目 |
36
35
  | npm create aiot ux | 创建ux项目 |
37
36
  | aiot build | 构建项目 |
38
37
  | aiot release | 构建项目-release模式 |
@@ -1,23 +1,17 @@
1
1
  import { IJavascriptCompileOption } from '@aiot-toolkit/aiotpack';
2
2
  import { Dictionary } from '@aiot-toolkit/shared-utils';
3
+ import IFileLaneEvents, { IFileLaneSuccessData } from 'file-lane/lib/interface/IFileLaneEvents';
3
4
  /**
4
5
  * UxBuilderBase
5
6
  */
6
7
  declare class UxBuilderBase<O extends Dictionary = any> {
7
- events: {
8
- onBuildSuccess?: (data: {
9
- costTime: number;
10
- }) => void;
11
- };
8
+ events: IFileLaneEvents;
12
9
  /**
13
10
  * 配置文件
14
11
  */
15
12
  readonly QUICKAPP_CONFIG = "quickapp.config.js";
16
- constructor(events?: {
17
- onBuildSuccess?: (data: {
18
- costTime: number;
19
- }) => void;
20
- });
13
+ private fileLane?;
14
+ constructor(events?: IFileLaneEvents);
21
15
  /**
22
16
  * ux项目的build函数
23
17
  * @param projectPath 项目路径
@@ -25,6 +19,10 @@ declare class UxBuilderBase<O extends Dictionary = any> {
25
19
  * @param watch 是否开启监听
26
20
  */
27
21
  build(projectPath: string, options: O): Promise<void>;
22
+ /**
23
+ *
24
+ */
25
+ stop(): Promise<void>;
28
26
  /**
29
27
  * 获取build的编译配置
30
28
  * @param projectPath 项目路径
@@ -34,3 +32,4 @@ declare class UxBuilderBase<O extends Dictionary = any> {
34
32
  private readQuickAppConfig;
35
33
  }
36
34
  export default UxBuilderBase;
35
+ export { IFileLaneEvents, IFileLaneSuccessData };
@@ -50,6 +50,10 @@ class UxBuilderBase {
50
50
  */
51
51
  build(projectPath, options) {
52
52
  return __awaiter(this, void 0, void 0, function* () {
53
+ if (this.fileLane) {
54
+ // 已经在运行中,请先停止
55
+ throw new Error('already running, please stop first: builder.stop()');
56
+ }
53
57
  const watch = options.watch || false;
54
58
  // 项目配置
55
59
  const uxProjectConfig = new aiotpack_1.UxConfig(projectPath);
@@ -68,7 +72,18 @@ class UxBuilderBase {
68
72
  }, null, 2)
69
73
  });
70
74
  // 开始编译项目
71
- yield new file_lane_1.default(uxProjectConfig, projectPath, compilerOption, this.events).start({ watch });
75
+ this.fileLane = new file_lane_1.default(uxProjectConfig, projectPath, compilerOption, this.events);
76
+ yield this.fileLane.start({ watch });
77
+ });
78
+ }
79
+ /**
80
+ *
81
+ */
82
+ stop() {
83
+ return __awaiter(this, void 0, void 0, function* () {
84
+ var _a;
85
+ yield ((_a = this.fileLane) === null || _a === void 0 ? void 0 : _a.stop());
86
+ this.fileLane = undefined;
72
87
  });
73
88
  }
74
89
  /**
@@ -8,6 +8,12 @@ interface IUxBuilderOption extends Dictionary {
8
8
  mode: CompileMode;
9
9
  enableJsc: boolean;
10
10
  enableE2e?: boolean;
11
+ /**
12
+ * 此选项控制是否生成,以及如何生成 source map
13
+ *
14
+ * @see https://www.webpackjs.com/configuration/devtool/#devtool
15
+ */
16
+ devtool?: string;
11
17
  /**
12
18
  * 是否自动补全 manifest.json 中的 features 配置
13
19
  */
@@ -54,7 +54,7 @@ class XtsBuilder {
54
54
  const compilerOptions = {
55
55
  skip: shared_utils_1.StringUtil.string2arrayByComma(options.skip)
56
56
  };
57
- const config = new aiotpack_1.XtsConfig();
57
+ const config = new aiotpack_1.XtsConfig(projectPath);
58
58
  if ((_a = compilerOptions.skip) === null || _a === void 0 ? void 0 : _a.includes('xts2ts')) {
59
59
  shared_utils_1.ColorConsole.info("### skip compile xts to ts due to --skip ${compilerOptions?.skip.join(',')}");
60
60
  const context = file_lane_1.FileLaneUtil.createContext(config.output, projectPath);
package/lib/index.d.ts ADDED
@@ -0,0 +1,6 @@
1
+ import VelaUxBuilder from './builder/VelaUxBuilder';
2
+ import AndroidUxBuilder from './builder/AndroidUxBuilder';
3
+ import FileLaneTriggerType from 'file-lane/lib/enum/FileLaneTriggerType';
4
+ import { CompileMode } from '@aiot-toolkit/aiotpack';
5
+ import IFileLaneEvents, { IFileLaneSuccessData } from 'file-lane/lib/interface/IFileLaneEvents';
6
+ export { VelaUxBuilder, AndroidUxBuilder, FileLaneTriggerType, CompileMode, IFileLaneEvents, IFileLaneSuccessData };
package/lib/index.js ADDED
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.CompileMode = exports.FileLaneTriggerType = exports.AndroidUxBuilder = exports.VelaUxBuilder = void 0;
7
+ const VelaUxBuilder_1 = __importDefault(require("./builder/VelaUxBuilder"));
8
+ exports.VelaUxBuilder = VelaUxBuilder_1.default;
9
+ const AndroidUxBuilder_1 = __importDefault(require("./builder/AndroidUxBuilder"));
10
+ exports.AndroidUxBuilder = AndroidUxBuilder_1.default;
11
+ const FileLaneTriggerType_1 = __importDefault(require("file-lane/lib/enum/FileLaneTriggerType"));
12
+ exports.FileLaneTriggerType = FileLaneTriggerType_1.default;
13
+ const aiotpack_1 = require("@aiot-toolkit/aiotpack");
14
+ Object.defineProperty(exports, "CompileMode", { enumerable: true, get: function () { return aiotpack_1.CompileMode; } });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aiot-toolkit",
3
- "version": "2.0.2",
3
+ "version": "2.0.3-beta.1",
4
4
  "description": "Tools for creating, developing, and packaging aiot applications.",
5
5
  "keywords": [
6
6
  "aiot"
@@ -10,6 +10,7 @@
10
10
  "bin": {
11
11
  "aiot": "lib/bin.js"
12
12
  },
13
+ "main": "lib/index",
13
14
  "directories": {
14
15
  "lib": "lib",
15
16
  "test": "__tests__"
@@ -21,17 +22,17 @@
21
22
  "test": "node ./__tests__/aiot-toolkit.test.js"
22
23
  },
23
24
  "dependencies": {
24
- "@aiot-toolkit/aiotpack": "2.0.2",
25
- "@aiot-toolkit/commander": "2.0.2",
26
- "@aiot-toolkit/emulator": "2.0.2",
27
- "@aiot-toolkit/shared-utils": "2.0.2",
25
+ "@aiot-toolkit/aiotpack": "2.0.3-beta.1",
26
+ "@aiot-toolkit/commander": "2.0.3-beta.1",
27
+ "@aiot-toolkit/emulator": "2.0.3-beta.1",
28
+ "@aiot-toolkit/shared-utils": "2.0.3-beta.1",
28
29
  "@inquirer/prompts": "^5.3.0",
29
30
  "@miwt/adb": "^0.9.0",
30
31
  "adm-zip": "^0.5.10",
31
32
  "axios": "^1.7.4",
32
33
  "cli-progress": "^3.12.0",
33
34
  "dayjs": "^1.11.10",
34
- "file-lane": "2.0.2",
35
+ "file-lane": "2.0.3-beta.1",
35
36
  "fs-extra": "^11.2.0",
36
37
  "koa-router": "^13.0.1",
37
38
  "lodash": "^4.17.21",
@@ -48,5 +49,5 @@
48
49
  "@types/semver": "^7.5.8",
49
50
  "@types/ws": "^8.5.10"
50
51
  },
51
- "gitHead": "8ca4bf2ed7bcf11911e5c514696951bdba4fc12d"
52
+ "gitHead": "77b1b0aab9b5c227b5cc355b585a7c93761cc9a3"
52
53
  }