trtc-electron-sdk 11.0.404-beta.1 → 11.0.404-beta.2
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/package.json +2 -1
- package/scripts/download.js +18 -2
- package/scripts/utils.js +7 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "trtc-electron-sdk",
|
|
3
|
-
"version": "11.0.404-beta.
|
|
3
|
+
"version": "11.0.404-beta.2",
|
|
4
4
|
"description": "trtc electron sdk",
|
|
5
5
|
"main": "./liteav/trtc.js",
|
|
6
6
|
"types": "./liteav/trtc.d.ts",
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
"@typescript-eslint/eslint-plugin": "^4.2.0",
|
|
28
28
|
"@typescript-eslint/parser": "^4.2.0",
|
|
29
29
|
"docdash-blue": "^1.1.4",
|
|
30
|
+
"hpagent": "^1.2.0",
|
|
30
31
|
"jsdoc": "^3.6.6",
|
|
31
32
|
"pretty": "^2.0.0",
|
|
32
33
|
"replace": "^1.2.0",
|
package/scripts/download.js
CHANGED
|
@@ -4,6 +4,7 @@ const fs = require('fs-extra');
|
|
|
4
4
|
const rimraf = require('rimraf');
|
|
5
5
|
const signale = require('signale');
|
|
6
6
|
const { exec } = require('child_process');
|
|
7
|
+
const { HttpsProxyAgent } = require('hpagent');
|
|
7
8
|
|
|
8
9
|
const {
|
|
9
10
|
readCliArgv,
|
|
@@ -11,6 +12,7 @@ const {
|
|
|
11
12
|
detectOS,
|
|
12
13
|
detectOwnVersion,
|
|
13
14
|
detectOwnName,
|
|
15
|
+
readProxyUrlFromEnv,
|
|
14
16
|
} = require('./utils');
|
|
15
17
|
|
|
16
18
|
const buildDownloadInfo = () => {
|
|
@@ -60,10 +62,24 @@ const main = () => {
|
|
|
60
62
|
|
|
61
63
|
// start
|
|
62
64
|
signale.pending('Downloading C++ addon Electron SDK...\n');
|
|
63
|
-
|
|
65
|
+
const downloadOptions = {
|
|
64
66
|
strip: 0,
|
|
65
67
|
extract: true
|
|
66
|
-
}
|
|
68
|
+
};
|
|
69
|
+
const proxyUrl = readProxyUrlFromEnv(downloadUrl);
|
|
70
|
+
if (proxyUrl) {
|
|
71
|
+
downloadOptions.agent = {
|
|
72
|
+
https: new HttpsProxyAgent({
|
|
73
|
+
keepAlive: true,
|
|
74
|
+
keepAliveMsecs: 1000,
|
|
75
|
+
maxSockets: 256,
|
|
76
|
+
maxFreeSockets: 256,
|
|
77
|
+
scheduling: 'lifo',
|
|
78
|
+
proxy: proxyUrl
|
|
79
|
+
})
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
download(downloadUrl, outputDir, downloadOptions).then(() => {
|
|
67
83
|
signale.success('Success', 'Download finished');
|
|
68
84
|
|
|
69
85
|
fs.copy(path.join(outputDir, './build'), buildDir)
|
package/scripts/utils.js
CHANGED
|
@@ -30,6 +30,13 @@ module.exports.readCliArgv = function() {
|
|
|
30
30
|
return newArgv;
|
|
31
31
|
};
|
|
32
32
|
|
|
33
|
+
module.exports.readProxyUrlFromEnv = function(downloadUrl) {
|
|
34
|
+
if (downloadUrl.indexOf('https') === 0) {
|
|
35
|
+
return process.env.https_proxy || ''
|
|
36
|
+
}
|
|
37
|
+
return process.env.http_proxy || '';
|
|
38
|
+
}
|
|
39
|
+
|
|
33
40
|
module.exports.readArgvFromNpmEnv = function() {
|
|
34
41
|
if (process.env.npm_config_trtc_electron_arch) {
|
|
35
42
|
return {
|