@aiot-toolkit/aiotpack 2.0.5-beta.21 → 2.0.5-beta.23
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/lib/afterCompile/ux/UxAfterCompile.d.ts +0 -3
- package/lib/afterCompile/ux/UxAfterCompile.js +13 -26
- package/lib/compiler/javascript/vela/utils/LiteCard.d.ts +13 -0
- package/lib/compiler/javascript/vela/utils/LiteCard.js +41 -0
- package/lib/utils/ux/FileCompare.js +1 -1
- package/lib/utils/ux/UxFileUtils.js +1 -1
- package/package.json +6 -7
|
@@ -16,11 +16,10 @@ var _ZipUtil = _interopRequireDefault(require("../../compiler/javascript/vela/ut
|
|
|
16
16
|
var _UxFileUtils = _interopRequireDefault(require("../../utils/ux/UxFileUtils"));
|
|
17
17
|
var _FileLaneTriggerType = _interopRequireDefault(require("file-lane/lib/enum/FileLaneTriggerType"));
|
|
18
18
|
var _ZipFileUtil = _interopRequireDefault(require("@aiot-toolkit/shared-utils/lib/utils/ZipFileUtil"));
|
|
19
|
-
var _process = require("process");
|
|
20
19
|
var _ImageIcu = _interopRequireDefault(require("../../compiler/tools/icu/ImageIcu"));
|
|
20
|
+
var _LiteCard = _interopRequireDefault(require("../../compiler/javascript/vela/utils/LiteCard"));
|
|
21
21
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
22
22
|
const BinaryPlugin = require('@aiot-toolkit/parser/lib/ux/translate/vela/protobuf/BinaryPlugin');
|
|
23
|
-
const HapToolkit = require('hap-toolkit');
|
|
24
23
|
|
|
25
24
|
/**
|
|
26
25
|
* UxAfterCompile
|
|
@@ -259,9 +258,9 @@ class UxAfterCompile {
|
|
|
259
258
|
_fsExtra.default.outputFileSync(_path.default.join(outputAbsPath, _ZipUtil.default.CERT_PATH), buffer);
|
|
260
259
|
};
|
|
261
260
|
if (compilerOption) {
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
261
|
+
copyResourceFiles(compilerOption);
|
|
262
|
+
updateManifest(compilerOption);
|
|
263
|
+
genDeviceManifests(compilerOption);
|
|
265
264
|
await genMetaFiles(compilerOption);
|
|
266
265
|
}
|
|
267
266
|
};
|
|
@@ -406,9 +405,6 @@ class UxAfterCompile {
|
|
|
406
405
|
/**
|
|
407
406
|
* 编译轻卡ux
|
|
408
407
|
* 1. 使用hap-toolkit编译项目,编译结果存储在build文件夹
|
|
409
|
-
* 1.1 重写stdout以捕获hap-toolkit中的正常日志,错误日志正常输出
|
|
410
|
-
* 1.2 使用hap-toolkit编译项目
|
|
411
|
-
* 1.3 还原stdout
|
|
412
408
|
* 2. 取widgets中配置的轻卡内容,将build文件夹中对应的产物复制到临时文件夹
|
|
413
409
|
* @param params
|
|
414
410
|
*/
|
|
@@ -420,29 +416,20 @@ class UxAfterCompile {
|
|
|
420
416
|
try {
|
|
421
417
|
if (context?.liteCards?.length > 0 && compilerOption) {
|
|
422
418
|
const {
|
|
423
|
-
projectPath,
|
|
424
|
-
outputPath
|
|
419
|
+
projectPath: tempProjectPath,
|
|
420
|
+
outputPath: LITE_OUTPUT_PATH
|
|
425
421
|
} = compilerOption;
|
|
426
|
-
const
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
};
|
|
432
|
-
// 1.2
|
|
433
|
-
await HapToolkit.compile('native', 'dev', false, {
|
|
434
|
-
cwd: context.projectPath,
|
|
435
|
-
signMode: 'BUILD',
|
|
436
|
-
enableCustomComponent: true
|
|
437
|
-
});
|
|
438
|
-
// 1.3
|
|
439
|
-
_process.stdout.write = originalStdout;
|
|
422
|
+
const {
|
|
423
|
+
projectPath
|
|
424
|
+
} = context;
|
|
425
|
+
// 1.
|
|
426
|
+
await new _LiteCard.default(projectPath).compileLiteCard();
|
|
440
427
|
// 2.
|
|
441
428
|
context.liteCards.forEach(card => {
|
|
442
429
|
// hap-toolkit的产物在项目的build文件夹下
|
|
443
|
-
const fromPath = _path.default.join(
|
|
430
|
+
const fromPath = _path.default.join(projectPath, LITE_OUTPUT_PATH, card);
|
|
444
431
|
// aiot-toolkit的产物在临时项目的build文件夹下
|
|
445
|
-
const toPath = _path.default.join(
|
|
432
|
+
const toPath = _path.default.join(tempProjectPath, LITE_OUTPUT_PATH, card);
|
|
446
433
|
//确定目标目录存在,若不存在则创建到父目录
|
|
447
434
|
_fsExtra.default.ensureDirSync(_path.default.dirname(toPath));
|
|
448
435
|
// 复制文件
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
declare class LiteCard {
|
|
2
|
+
readonly projectPath: string;
|
|
3
|
+
constructor(projectPath: string);
|
|
4
|
+
/**
|
|
5
|
+
* 编译轻量级卡片
|
|
6
|
+
* 1. 重写stdout以捕获hap-toolkit中的正常日志,错误日志正常输出
|
|
7
|
+
* 2. 使用hap-toolkit编译项目
|
|
8
|
+
* 3. 还原stdout
|
|
9
|
+
* @returns Promise<void>
|
|
10
|
+
*/
|
|
11
|
+
compileLiteCard(): Promise<void>;
|
|
12
|
+
}
|
|
13
|
+
export default LiteCard;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _sharedUtils = require("@aiot-toolkit/shared-utils");
|
|
8
|
+
var _process = require("process");
|
|
9
|
+
class LiteCard {
|
|
10
|
+
constructor(projectPath) {
|
|
11
|
+
this.projectPath = projectPath;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* 编译轻量级卡片
|
|
15
|
+
* 1. 重写stdout以捕获hap-toolkit中的正常日志,错误日志正常输出
|
|
16
|
+
* 2. 使用hap-toolkit编译项目
|
|
17
|
+
* 3. 还原stdout
|
|
18
|
+
* @returns Promise<void>
|
|
19
|
+
*/
|
|
20
|
+
async compileLiteCard() {
|
|
21
|
+
const {
|
|
22
|
+
projectPath
|
|
23
|
+
} = this;
|
|
24
|
+
const originalStdout = _process.stdout.write;
|
|
25
|
+
_process.stdout.write = function () {
|
|
26
|
+
return true;
|
|
27
|
+
};
|
|
28
|
+
return _sharedUtils.CommonUtil.requireNodeModule(projectPath, 'hap-toolkit').then(async module => {
|
|
29
|
+
await module.compile('native', 'dev', false, {
|
|
30
|
+
cwd: projectPath,
|
|
31
|
+
signMode: 'BUILD'
|
|
32
|
+
});
|
|
33
|
+
}).catch(error => {
|
|
34
|
+
_sharedUtils.ColorConsole.throw(error.message);
|
|
35
|
+
return Promise.reject(error);
|
|
36
|
+
}).finally(() => {
|
|
37
|
+
_process.stdout.write = originalStdout;
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
var _default = exports.default = LiteCard;
|
|
@@ -42,6 +42,6 @@ function compareFiles(filePath1, filePath2) {
|
|
|
42
42
|
}
|
|
43
43
|
function computeFileHash(filePath) {
|
|
44
44
|
const fileData = _fs.default.readFileSync(filePath);
|
|
45
|
-
const hash = (0, _crypto.createHash)('
|
|
45
|
+
const hash = (0, _crypto.createHash)('SHA256').update(fileData);
|
|
46
46
|
return hash.digest('hex');
|
|
47
47
|
}
|
|
@@ -145,7 +145,7 @@ class UxFileUtils {
|
|
|
145
145
|
// 比较文件内容
|
|
146
146
|
const {
|
|
147
147
|
isEqual
|
|
148
|
-
} = (0, _FileCompare.compareFiles)(oldFilePath,
|
|
148
|
+
} = (0, _FileCompare.compareFiles)(oldFilePath, remainingNewFiles[index]);
|
|
149
149
|
if (!isEqual) {
|
|
150
150
|
diffList.push(_path.default.relative(newDir, remainingNewFiles[index]));
|
|
151
151
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aiot-toolkit/aiotpack",
|
|
3
|
-
"version": "2.0.5-beta.
|
|
3
|
+
"version": "2.0.5-beta.23",
|
|
4
4
|
"description": "The process tool for packaging aiot projects.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"aiotpack"
|
|
@@ -19,17 +19,16 @@
|
|
|
19
19
|
"test": "node ./__tests__/aiotpack.test.js"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@aiot-toolkit/generator": "2.0.5-beta.
|
|
23
|
-
"@aiot-toolkit/parser": "2.0.5-beta.
|
|
24
|
-
"@aiot-toolkit/shared-utils": "2.0.5-beta.
|
|
22
|
+
"@aiot-toolkit/generator": "2.0.5-beta.23",
|
|
23
|
+
"@aiot-toolkit/parser": "2.0.5-beta.23",
|
|
24
|
+
"@aiot-toolkit/shared-utils": "2.0.5-beta.23",
|
|
25
25
|
"@hap-toolkit/aaptjs": "^2.0.0",
|
|
26
26
|
"@rspack/core": "^1.3.9",
|
|
27
27
|
"aiot-parse5": "^1.0.2",
|
|
28
28
|
"babel-loader": "^9.1.3",
|
|
29
|
-
"file-lane": "2.0.5-beta.
|
|
29
|
+
"file-lane": "2.0.5-beta.23",
|
|
30
30
|
"file-loader": "^6.2.0",
|
|
31
31
|
"fs-extra": "^11.2.0",
|
|
32
|
-
"hap-toolkit": "^2.0.0",
|
|
33
32
|
"jsrsasign": "^11.1.0",
|
|
34
33
|
"jszip": "^3.10.1",
|
|
35
34
|
"lodash": "^4.17.21",
|
|
@@ -43,5 +42,5 @@
|
|
|
43
42
|
"@types/jsrsasign": "^10.5.12",
|
|
44
43
|
"@types/webpack-sources": "^3.2.3"
|
|
45
44
|
},
|
|
46
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "f4991bcb0dcaab6853597ca07d21a7999649a1cc"
|
|
47
46
|
}
|