trtc-electron-sdk 11.0.501 → 11.0.502-beta.0
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 +5 -1
- package/scripts/download.js +0 -3
- package/scripts/postinstall.js +46 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "trtc-electron-sdk",
|
|
3
|
-
"version": "11.0.
|
|
3
|
+
"version": "11.0.502-beta.0",
|
|
4
4
|
"description": "trtc electron sdk",
|
|
5
5
|
"main": "./liteav/trtc.js",
|
|
6
6
|
"types": "./liteav/trtc.d.ts",
|
|
@@ -18,6 +18,9 @@
|
|
|
18
18
|
"yuv-canvas": "^1.2.6",
|
|
19
19
|
"hpagent": "^1.2.0"
|
|
20
20
|
},
|
|
21
|
+
"peerDependencies": {
|
|
22
|
+
"electron": ">=4.0.0"
|
|
23
|
+
},
|
|
21
24
|
"devDependencies": {
|
|
22
25
|
"@babel/cli": "^7.11.6",
|
|
23
26
|
"@babel/core": "^7.11.6",
|
|
@@ -37,6 +40,7 @@
|
|
|
37
40
|
"scripts": {
|
|
38
41
|
"download": "node ./scripts/download.js",
|
|
39
42
|
"install": "npm run download",
|
|
43
|
+
"postinstall": "node ./scripts/postinstall.js",
|
|
40
44
|
"build": "npm run build:types && npm run build:js && npm run copy:types",
|
|
41
45
|
"build:types": "rimraf ./types && tsc -p dtsconfig.json",
|
|
42
46
|
"build:js": "rimraf ./liteav && tsc -p tsconfig.json",
|
package/scripts/download.js
CHANGED
|
@@ -142,9 +142,6 @@ const main = () => {
|
|
|
142
142
|
);
|
|
143
143
|
signale.success(`copy success! - mac ${anotherArch}`);
|
|
144
144
|
|
|
145
|
-
// Mac 下完成文件下载后,执行该命令,同步文件到 Electron 目录下
|
|
146
|
-
exec(`rsync -a ../../node_modules/trtc-electron-sdk/build/mac-framework/${archType}/ ../../node_modules/electron/dist/Electron.app/Contents/Frameworks`);
|
|
147
|
-
|
|
148
145
|
rimraf.sync(outputDir);
|
|
149
146
|
})
|
|
150
147
|
.catch(err => {
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
const { exec } = require('child_process');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const { arch, platform } = process;
|
|
5
|
+
|
|
6
|
+
let retryCount = 0;
|
|
7
|
+
const retryInterval = 5000; // ms
|
|
8
|
+
const maxRetryCount = 60;
|
|
9
|
+
|
|
10
|
+
function rsync() {
|
|
11
|
+
if (platform === 'darwin') {
|
|
12
|
+
const sourcePath = path.join(__dirname, `../../trtc-electron-sdk/build/mac-framework/${arch}/`);
|
|
13
|
+
const targetPath = path.join(__dirname, '../../electron/dist/Electron.app/Contents/Frameworks');
|
|
14
|
+
|
|
15
|
+
if (targetPath.indexOf("node_modules") === -1) {
|
|
16
|
+
// SDK 本身安装,不用同步动态库,直接退出
|
|
17
|
+
console.warn(`trtc-electron-sdk self install do not need 'rsync'`);
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
retryCount++;
|
|
22
|
+
if (fs.existsSync(targetPath)) {
|
|
23
|
+
const command = `rsync -a ${sourcePath} ${targetPath}`;
|
|
24
|
+
console.log(command);
|
|
25
|
+
exec(command);
|
|
26
|
+
} else {
|
|
27
|
+
if (retryCount <= maxRetryCount) {
|
|
28
|
+
setTimeout(rsync, retryInterval);
|
|
29
|
+
} else {
|
|
30
|
+
const errorMessage = `
|
|
31
|
+
'trtc-electron-sdk' 安装失败,请先确认 'Electron' 已安装,再执行 'npm install trtc-electron-sdk' 命令重新安装一次。
|
|
32
|
+
Failed to install trtc-electron-sdk correctly, please make sure that 'Electron' has been installed, then run 'npm install trtc-electron-sdk' command to try again.
|
|
33
|
+
|
|
34
|
+
more detail:
|
|
35
|
+
trtc-electron-sdk postinstall cwd: ${process.cwd()}
|
|
36
|
+
__dirname: ${__dirname}
|
|
37
|
+
sourcePath: ${sourcePath}
|
|
38
|
+
targetPath: ${targetPath}
|
|
39
|
+
`;
|
|
40
|
+
console.error(errorMessage);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
rsync();
|