@aiot-toolkit/aiotpack 2.0.4-beta.7 → 2.0.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/lib/compiler/javascript/interface/IJavascriptCompileOption.d.ts +13 -0
- package/lib/compiler/javascript/vela/utils/ZipUtil.js +1 -1
- package/lib/compiler/javascript/vela/utils/signature/SignUtil.d.ts +2 -2
- package/lib/compiler/javascript/vela/utils/signature/SignUtil.js +7 -5
- package/package.json +6 -6
|
@@ -56,4 +56,17 @@ export default interface IJavascriptCompileOption extends ICompileParam {
|
|
|
56
56
|
* 是否自动补全 manifest.json 中的 features 配置
|
|
57
57
|
*/
|
|
58
58
|
completeFeature?: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* 获取远程证书
|
|
61
|
+
*/
|
|
62
|
+
signRequest?: () => Promise<{
|
|
63
|
+
/**
|
|
64
|
+
* 证书私钥
|
|
65
|
+
*/
|
|
66
|
+
privatekey: Buffer;
|
|
67
|
+
/**
|
|
68
|
+
* 证书
|
|
69
|
+
*/
|
|
70
|
+
certificate: Buffer;
|
|
71
|
+
}>;
|
|
59
72
|
}
|
|
@@ -73,7 +73,7 @@ class ZipUtil {
|
|
|
73
73
|
} = await this.createPackagesDefinition(param, config, files);
|
|
74
74
|
|
|
75
75
|
// 生产出带签名的rpk文件buffer
|
|
76
|
-
const signConfig = _SignUtil.default.getProjectSignConfig(param);
|
|
76
|
+
const signConfig = await _SignUtil.default.getProjectSignConfig(param);
|
|
77
77
|
const rpkBuffer = await ZipUtil.buildProjectAndOutput(fullPackage, signConfig);
|
|
78
78
|
// 3
|
|
79
79
|
return this.generateDistFile(rpkBuffer, param, this.getFileName(param, config, 'rpk'));
|
|
@@ -9,10 +9,10 @@ declare class SignUtil {
|
|
|
9
9
|
* @param param IJavascriptCompileOption参数中获取签名目录等内容
|
|
10
10
|
* @returns
|
|
11
11
|
*/
|
|
12
|
-
static getProjectSignConfig(param: IJavascriptCompileOption): {
|
|
12
|
+
static getProjectSignConfig(param: IJavascriptCompileOption): Promise<{
|
|
13
13
|
privatekey: Buffer;
|
|
14
14
|
certificate: Buffer;
|
|
15
|
-
}
|
|
15
|
+
}>;
|
|
16
16
|
/**
|
|
17
17
|
* 对二进制zipBuffer签名
|
|
18
18
|
*
|
|
@@ -25,12 +25,16 @@ class SignUtil {
|
|
|
25
25
|
* @param param IJavascriptCompileOption参数中获取签名目录等内容
|
|
26
26
|
* @returns
|
|
27
27
|
*/
|
|
28
|
-
static getProjectSignConfig(param) {
|
|
28
|
+
static async getProjectSignConfig(param) {
|
|
29
29
|
const {
|
|
30
30
|
mode,
|
|
31
31
|
projectPath,
|
|
32
|
-
signRoot
|
|
32
|
+
signRoot,
|
|
33
|
+
signRequest
|
|
33
34
|
} = param;
|
|
35
|
+
if (signRequest) {
|
|
36
|
+
return signRequest();
|
|
37
|
+
}
|
|
34
38
|
const signPathFolder = _path.default.join(projectPath, signRoot || 'sign');
|
|
35
39
|
const signPathConfig = {
|
|
36
40
|
debug: {
|
|
@@ -55,7 +59,6 @@ class SignUtil {
|
|
|
55
59
|
// release模式 优先sign/release/证书 其次sign/证书
|
|
56
60
|
const releaseSignConfig = [signPathConfig.oldRelease, signPathConfig.sign];
|
|
57
61
|
let modeSignConfig = [];
|
|
58
|
-
let signConfig;
|
|
59
62
|
switch (mode) {
|
|
60
63
|
case _CompileMode.default.DEVELOPMENT:
|
|
61
64
|
modeSignConfig = developmentSignConfig;
|
|
@@ -87,7 +90,7 @@ class SignUtil {
|
|
|
87
90
|
word: certificatePath
|
|
88
91
|
});
|
|
89
92
|
// 读取证书内容
|
|
90
|
-
|
|
93
|
+
return {
|
|
91
94
|
privatekey: _fsExtra.default.readFileSync(privatekeyPath),
|
|
92
95
|
certificate: _fsExtra.default.readFileSync(certificatePath)
|
|
93
96
|
};
|
|
@@ -95,7 +98,6 @@ class SignUtil {
|
|
|
95
98
|
// 抛出错误,在指定模式下未找到证书
|
|
96
99
|
throw new Error(`The current mode is ${mode}, and there is a problem with the certification path`);
|
|
97
100
|
}
|
|
98
|
-
return signConfig;
|
|
99
101
|
}
|
|
100
102
|
|
|
101
103
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aiot-toolkit/aiotpack",
|
|
3
|
-
"version": "2.0.4
|
|
3
|
+
"version": "2.0.4",
|
|
4
4
|
"description": "The process tool for packaging aiot projects.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"aiotpack"
|
|
@@ -19,16 +19,16 @@
|
|
|
19
19
|
"test": "node ./__tests__/aiotpack.test.js"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@aiot-toolkit/generator": "2.0.4
|
|
23
|
-
"@aiot-toolkit/parser": "2.0.4
|
|
24
|
-
"@aiot-toolkit/shared-utils": "2.0.4
|
|
22
|
+
"@aiot-toolkit/generator": "2.0.4",
|
|
23
|
+
"@aiot-toolkit/parser": "2.0.4",
|
|
24
|
+
"@aiot-toolkit/shared-utils": "2.0.4",
|
|
25
25
|
"@hap-toolkit/aaptjs": "^2.0.0",
|
|
26
26
|
"@rspack/core": "^1.1.8",
|
|
27
27
|
"aiot-parse5": "^1.0.0",
|
|
28
28
|
"archiver": "^7.0.1",
|
|
29
29
|
"babel-loader": "^9.1.3",
|
|
30
30
|
"fast-glob": "^3.3.2",
|
|
31
|
-
"file-lane": "2.0.4
|
|
31
|
+
"file-lane": "2.0.4",
|
|
32
32
|
"file-loader": "^6.2.0",
|
|
33
33
|
"fs-extra": "^11.2.0",
|
|
34
34
|
"jsrsasign": "^11.1.0",
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"@types/jsrsasign": "^10.5.12",
|
|
47
47
|
"@types/webpack-sources": "^3.2.3"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "0668bd975b2d26018491625bcf526e265832bb97"
|
|
50
50
|
}
|