trtc-electron-sdk 11.3.601-alpha.1 → 11.3.601-alpha.3

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "trtc-electron-sdk",
3
- "version": "11.3.601-alpha.1",
3
+ "version": "11.3.601-alpha.3",
4
4
  "description": "trtc electron sdk",
5
5
  "main": "./liteav/trtc.js",
6
6
  "types": "./liteav/trtc.d.ts",
@@ -1,17 +1,25 @@
1
1
  const path = require("path");
2
+ const fs = require("fs");
2
3
  const { removeSync, copySync } = require("fs-extra");
4
+ const signale = require('signale');
3
5
 
4
6
  // npm run copy:sdk
5
7
  const SDK_ROOT = path.resolve(__dirname, "../../");
6
8
  const SDK_CPP_PATH = path.join(SDK_ROOT, "trtc-electron-cpp");
7
9
  const SDK_JS_PATH = path.join(SDK_ROOT, "trtc-electron-sdk");
10
+ const sourceNodeFilePath = path.resolve(SDK_CPP_PATH, "build/Release/trtc_electron_sdk.node");
11
+ const targetNodeFilePath = path.resolve(SDK_JS_PATH, "build/Release/trtc_electron_sdk.node");
12
+
13
+ try {
14
+ fs.accessSync(sourceNodeFilePath)
15
+ } catch(err) {
16
+ signale.warn("No trtc_electron_sdk.node file, don't need to copy.");
17
+ return;
18
+ }
8
19
 
9
20
  removeSync(path.join(SDK_JS_PATH, "build"));
10
21
 
11
- copySync(
12
- path.resolve(SDK_CPP_PATH, "build/Release/trtc_electron_sdk.node"),
13
- path.resolve(SDK_JS_PATH, "build/Release/trtc_electron_sdk.node")
14
- );
22
+ copySync(sourceNodeFilePath, targetNodeFilePath);
15
23
  if (process.platform === "win32") {
16
24
  let dllPrefix = "";
17
25
  if (process.arch === "x64") {
@@ -67,4 +75,4 @@ if (process.platform === "win32") {
67
75
  }
68
76
 
69
77
 
70
- console.log("CopySDKManual.doCopy: 复制结束");
78
+ signale.log("CopySDKManual.doCopy: 复制结束");
@@ -6,8 +6,9 @@ const signale = require('signale');
6
6
  const { exec } = require('child_process');
7
7
  const { HttpsProxyAgent } = require('hpagent');
8
8
 
9
- const currentPath = path.join(__dirname, "../");
10
- if (currentPath.indexOf("source-sdk/trtc-electron-sdk")) {
9
+ const currentPath = process.cwd();
10
+ const pathFlagValue = `packages${process.platform === "win32" ? "\\" : "/"}trtc-electron-sdk`;
11
+ if (currentPath.indexOf(pathFlagValue) !== -1) {
11
12
  signale.info("trtc-electron-sdk: development mode, skip native sdk lib download");
12
13
  return;
13
14
  }