aiot-toolkit 2.0.1-alpha.7 → 2.0.1-alpha.9

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.
@@ -1,7 +1,8 @@
1
1
  import { IParam } from '@aiot-toolkit/commander';
2
2
  import IBuilder from './IBuilder';
3
- interface IBuilderOption {
3
+ export interface IBuilderOption {
4
4
  watch?: boolean;
5
+ skip?: string;
5
6
  }
6
7
  /**
7
8
  * XtsBuilder
@@ -13,8 +13,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  const aiotpack_1 = require("@aiot-toolkit/aiotpack");
16
+ const ICompileOptions_1 = require("@aiot-toolkit/aiotpack/lib/interface/ICompileOptions");
16
17
  const shared_utils_1 = require("@aiot-toolkit/shared-utils");
17
18
  const ColorConsole_1 = __importDefault(require("@aiot-toolkit/shared-utils/lib/ColorConsole"));
19
+ const StringUtil_1 = __importDefault(require("@aiot-toolkit/shared-utils/lib/utils/StringUtil"));
18
20
  const file_lane_1 = require("file-lane");
19
21
  const fs_1 = __importDefault(require("fs"));
20
22
  const path_1 = __importDefault(require("path"));
@@ -23,7 +25,24 @@ const path_1 = __importDefault(require("path"));
23
25
  */
24
26
  class XtsBuilder {
25
27
  constructor() {
26
- this.params = [];
28
+ this.params = [
29
+ {
30
+ name: 'skip',
31
+ type: 'string',
32
+ description: 'Can configure skip steps, comma separated, optional values: install (skip install pre-dependencies),ts2wasm (skip compilation), package (skip packaging)',
33
+ validate(value) {
34
+ // TODO: validate 不起作用
35
+ const res = StringUtil_1.default.string2arrayByComma(value);
36
+ const unValid = res.find((r) => {
37
+ return !ICompileOptions_1.skipList.includes(r);
38
+ });
39
+ if (unValid) {
40
+ return `${unValid} is unvalidate, validate value are ${ICompileOptions_1.skipList.join(',')}, Multiple values separated by commas`;
41
+ }
42
+ return true;
43
+ }
44
+ }
45
+ ];
27
46
  }
28
47
  match(projectPath) {
29
48
  // app/app.xts 存在视为xts项目
@@ -39,8 +58,11 @@ class XtsBuilder {
39
58
  }, undefined, 2),
40
59
  level: shared_utils_1.LOG_LEVEL.Success
41
60
  });
61
+ const compilerOptions = {
62
+ skip: StringUtil_1.default.string2arrayByComma(options.skip)
63
+ };
42
64
  const config = new aiotpack_1.XtsConfig();
43
- return new file_lane_1.FileLane(config, projectPath).start({ watch });
65
+ return new file_lane_1.FileLane(config, projectPath, compilerOptions).start({ watch });
44
66
  });
45
67
  }
46
68
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["builder/XtsBuilder.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,qDAAkD;AAElD,6DAAsD;AACtD,+FAAsE;AACtE,yCAAoC;AACpC,4CAAmB;AACnB,gDAAuB;AAOvB;;GAEG;AACH,MAAM,UAAU;IAAhB;QAyBW,WAAM,GAAa,EAAE,CAAA;IAChC,CAAC;IAvBC,KAAK,CAAC,WAAmB;QACvB,wBAAwB;QACxB,OAAO,YAAE,CAAC,UAAU,CAAC,cAAI,CAAC,OAAO,CAAC,WAAW,EAAE,aAAa,CAAC,CAAC,CAAA;IAChE,CAAC;IAEK,KAAK,CAAC,WAAmB,EAAE,OAAuB;;YACtD,MAAM,EAAE,KAAK,EAAE,GAAG,OAAO,CAAA;YACzB,sBAAY,CAAC,GAAG,CAAC;gBACf,OAAO,EAAE,IAAI,CAAC,SAAS,CACrB;oBACE,WAAW;oBACX,OAAO;iBACR,EACD,SAAS,EACT,CAAC,CACF;gBACD,KAAK,EAAE,wBAAS,CAAC,OAAO;aACzB,CAAC,CAAA;YACF,MAAM,MAAM,GAAG,IAAI,oBAAS,EAAE,CAAA;YAC9B,OAAO,IAAI,oBAAQ,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,CAAC,CAAA;QAC3D,CAAC;KAAA;;AAtBe,uBAAY,GAAG,eAAH,AAAkB,CAAA;AA0BhD,kBAAe,UAAU,CAAA","file":"XtsBuilder.js","sourcesContent":["import { XtsConfig } from '@aiot-toolkit/aiotpack'\nimport { IParam } from '@aiot-toolkit/commander'\nimport { LOG_LEVEL } from '@aiot-toolkit/shared-utils'\nimport ColorConsole from '@aiot-toolkit/shared-utils/lib/ColorConsole'\nimport { FileLane } from 'file-lane'\nimport fs from 'fs'\nimport path from 'path'\nimport IBuilder from './IBuilder'\n\ninterface IBuilderOption {\n watch?: boolean\n}\n\n/**\n * XtsBuilder\n */\nclass XtsBuilder implements IBuilder<IBuilderOption> {\n static readonly PROJECT_TYPE = 'xts quick app'\n\n match(projectPath: string): boolean {\n // app/app.xts 存在视为xts项目\n return fs.existsSync(path.resolve(projectPath, 'app/app.xts'))\n }\n\n async build(projectPath: string, options: IBuilderOption) {\n const { watch } = options\n ColorConsole.log({\n message: JSON.stringify(\n {\n projectPath,\n options\n },\n undefined,\n 2\n ),\n level: LOG_LEVEL.Success\n })\n const config = new XtsConfig()\n return new FileLane(config, projectPath).start({ watch })\n }\n\n readonly params: IParam[] = []\n}\nexport default XtsBuilder\n"],"sourceRoot":"../../src"}
1
+ {"version":3,"sources":["builder/XtsBuilder.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,qDAAkD;AAKlD,0FAA+E;AAG/E,6DAAsD;AACtD,+FAAsE;AACtE,iGAAwE;AACxE,yCAAoC;AACpC,4CAAmB;AACnB,gDAAuB;AAQvB;;GAEG;AACH,MAAM,UAAU;IAAhB;QA4BW,WAAM,GAAa;YAC1B;gBACE,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,QAAQ;gBACd,WAAW,EACT,0JAA0J;gBAC5J,QAAQ,CAAC,KAAa;oBACpB,sBAAsB;oBACtB,MAAM,GAAG,GAAG,oBAAU,CAAC,mBAAmB,CAAC,KAAK,CAAqB,CAAA;oBACrE,MAAM,OAAO,GAAG,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE;wBAC7B,OAAO,CAAC,0BAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAA;oBAC9B,CAAC,CAAC,CAAA;oBAEF,IAAI,OAAO,EAAE;wBACX,OAAO,GAAG,OAAO,uCAAuC,0BAAQ,CAAC,IAAI,CACnE,GAAG,CACJ,uCAAuC,CAAA;qBACzC;oBACD,OAAO,IAAI,CAAA;gBACb,CAAC;aACF;SACF,CAAA;IACH,CAAC;IA/CC,KAAK,CAAC,WAAmB;QACvB,wBAAwB;QACxB,OAAO,YAAE,CAAC,UAAU,CAAC,cAAI,CAAC,OAAO,CAAC,WAAW,EAAE,aAAa,CAAC,CAAC,CAAA;IAChE,CAAC;IAEK,KAAK,CAAC,WAAmB,EAAE,OAAuB;;YACtD,MAAM,EAAE,KAAK,EAAE,GAAG,OAAO,CAAA;YACzB,sBAAY,CAAC,GAAG,CAAC;gBACf,OAAO,EAAE,IAAI,CAAC,SAAS,CACrB;oBACE,WAAW;oBACX,OAAO;iBACR,EACD,SAAS,EACT,CAAC,CACF;gBACD,KAAK,EAAE,wBAAS,CAAC,OAAO;aACzB,CAAC,CAAA;YACF,MAAM,eAAe,GAAuB;gBAC1C,IAAI,EAAE,oBAAU,CAAC,mBAAmB,CAAC,OAAO,CAAC,IAAI,CAAyB;aAC3E,CAAA;YACD,MAAM,MAAM,GAAG,IAAI,oBAAS,EAAE,CAAA;YAC9B,OAAO,IAAI,oBAAQ,CAAqB,MAAM,EAAE,WAAW,EAAE,eAAe,CAAC,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,CAAC,CAAA;QAChG,CAAC;KAAA;;AAzBe,uBAAY,GAAG,eAAH,AAAkB,CAAA;AAkDhD,kBAAe,UAAU,CAAA","file":"XtsBuilder.js","sourcesContent":["import { XtsConfig } from '@aiot-toolkit/aiotpack'\nimport type {\n ISkipList,\n IXtsCompileOptions\n} from '@aiot-toolkit/aiotpack/lib/interface/ICompileOptions'\nimport { skipList } from '@aiot-toolkit/aiotpack/lib/interface/ICompileOptions'\n\nimport { IParam } from '@aiot-toolkit/commander'\nimport { LOG_LEVEL } from '@aiot-toolkit/shared-utils'\nimport ColorConsole from '@aiot-toolkit/shared-utils/lib/ColorConsole'\nimport StringUtil from '@aiot-toolkit/shared-utils/lib/utils/StringUtil'\nimport { FileLane } from 'file-lane'\nimport fs from 'fs'\nimport path from 'path'\nimport IBuilder from './IBuilder'\n\nexport interface IBuilderOption {\n watch?: boolean\n skip?: string\n}\n\n/**\n * XtsBuilder\n */\nclass XtsBuilder implements IBuilder<IBuilderOption> {\n static readonly PROJECT_TYPE = 'xts quick app'\n\n match(projectPath: string): boolean {\n // app/app.xts 存在视为xts项目\n return fs.existsSync(path.resolve(projectPath, 'app/app.xts'))\n }\n\n async build(projectPath: string, options: IBuilderOption) {\n const { watch } = options\n ColorConsole.log({\n message: JSON.stringify(\n {\n projectPath,\n options\n },\n undefined,\n 2\n ),\n level: LOG_LEVEL.Success\n })\n const compilerOptions: IXtsCompileOptions = {\n skip: StringUtil.string2arrayByComma(options.skip) as unknown as ISkipList\n }\n const config = new XtsConfig()\n return new FileLane<IXtsCompileOptions>(config, projectPath, compilerOptions).start({ watch })\n }\n\n readonly params: IParam[] = [\n {\n name: 'skip',\n type: 'string',\n description:\n 'Can configure skip steps, comma separated, optional values: install (skip install pre-dependencies),ts2wasm (skip compilation), package (skip packaging)',\n validate(value: string) {\n // TODO: validate 不起作用\n const res = StringUtil.string2arrayByComma(value) as any as ISkipList\n const unValid = res.find((r) => {\n return !skipList.includes(r)\n })\n\n if (unValid) {\n return `${unValid} is unvalidate, validate value are ${skipList.join(\n ','\n )}, Multiple values separated by commas`\n }\n return true\n }\n }\n ]\n}\nexport default XtsBuilder\n"],"sourceRoot":"../../src"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aiot-toolkit",
3
- "version": "2.0.1-alpha.7",
3
+ "version": "2.0.1-alpha.9",
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.7",
29
- "@aiot-toolkit/shared-utils": "2.0.1-alpha.7",
28
+ "@aiot-toolkit/emulator": "2.0.1-alpha.9",
29
+ "@aiot-toolkit/shared-utils": "2.0.1-alpha.9",
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.7",
35
+ "create-aiot": "2.0.1-alpha.9",
36
36
  "fast-glob": "^3.3.2"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@types/adm-zip": "^0.5.4"
40
40
  },
41
- "gitHead": "9fbe39dfddc2745c97d472827ff10273ab67b499"
41
+ "gitHead": "d593999b9ca345bce8b3ba40a7d11f6685ac03b5"
42
42
  }