@tencentcloud/trtc-cloud-wx 0.0.27 → 0.0.30
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 +3 -44
- package/{dist/trtc-cloud-wx.js → trtc-cloud-wx.js} +1 -146
- package/.babelrc +0 -6
- package/.eslintrc.json +0 -129
- package/build/chokidar.js +0 -19
- package/build/clear.js +0 -24
- package/build/copy.js +0 -24
- package/build/copy_to_roomkit.js +0 -19
- package/dist/package.json +0 -15
- package/docs/API/TRTCCloud.html +0 -4353
- package/docs/API/index.html +0 -98
- package/docs/API/scripts/add-toc.js +0 -57
- package/docs/API/scripts/collapse.js +0 -20
- package/docs/API/scripts/highlight/highlight.min.js +0 -1282
- package/docs/API/scripts/highlight/highlightjs-line-numbers.min.js +0 -1
- package/docs/API/scripts/linenumber.js +0 -25
- package/docs/API/scripts/nav.js +0 -12
- package/docs/API/scripts/polyfill.js +0 -4
- package/docs/API/scripts/prettify/Apache-License-2.0.txt +0 -202
- package/docs/API/scripts/prettify/lang-css.js +0 -2
- package/docs/API/scripts/prettify/prettify.js +0 -28
- package/docs/API/scripts/search.js +0 -83
- package/docs/API/styles/font.css +0 -81
- package/docs/API/styles/fonts/JTURjIg1_i6t8kCHKm45_dJE3g3D_vx3rCubqg.woff2 +0 -0
- package/docs/API/styles/fonts/JTURjIg1_i6t8kCHKm45_dJE3gTD_vx3rCubqg.woff2 +0 -0
- package/docs/API/styles/fonts/JTURjIg1_i6t8kCHKm45_dJE3gbD_vx3rCubqg.woff2 +0 -0
- package/docs/API/styles/fonts/JTURjIg1_i6t8kCHKm45_dJE3gfD_vx3rCubqg.woff2 +0 -0
- package/docs/API/styles/fonts/JTURjIg1_i6t8kCHKm45_dJE3gnD_vx3rCs.woff2 +0 -0
- package/docs/API/styles/fonts/JTUSjIg1_i6t8kCHKm459W1hyyTh89ZNpQ.woff2 +0 -0
- package/docs/API/styles/fonts/JTUSjIg1_i6t8kCHKm459WRhyyTh89ZNpQ.woff2 +0 -0
- package/docs/API/styles/fonts/JTUSjIg1_i6t8kCHKm459WZhyyTh89ZNpQ.woff2 +0 -0
- package/docs/API/styles/fonts/JTUSjIg1_i6t8kCHKm459WdhyyTh89ZNpQ.woff2 +0 -0
- package/docs/API/styles/fonts/JTUSjIg1_i6t8kCHKm459WlhyyTh89Y.woff2 +0 -0
- package/docs/API/styles/highlight/highlight.min.css +0 -26
- package/docs/API/styles/highlight/rainbow.min.css +0 -1
- package/docs/API/styles/jsdoc.css +0 -684
- package/docs/API/styles/prettify.css +0 -79
- package/docs/API/styles/toc.css +0 -44
- package/docs/API/tutorial-00-guideline.html +0 -81
- package/docs/doc-src/home.md +0 -7
- package/docs/doc-src/tutorials/00-guideline.md +0 -1
- package/docs/doc-src/tutorials/tutorials.json +0 -5
- package/jsdoc.json +0 -43
- package/rollup.config.js +0 -19
- package/sdk_publish.bash +0 -5
- package/src/TaskMachine.ts +0 -368
- package/src/deviceAuthorize.ts +0 -75
- package/src/index.ts +0 -1091
- package/src/interface/index.ts +0 -44
- package/src/interface/types.ts +0 -88
- package/src/log/logger.ts +0 -103
- package/src/types.d.ts +0 -1
- package/src/utils/common.ts +0 -67
- package/src/utils/index.ts +0 -2
- package/src/utils/translate.ts +0 -125
- package/tsconfig.json +0 -15
- package/typedoc.json +0 -21
package/package.json
CHANGED
|
@@ -1,56 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tencentcloud/trtc-cloud-wx",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.30",
|
|
4
4
|
"description": "",
|
|
5
|
-
"main": "
|
|
6
|
-
"module": "dist/trtc-cloud-wx.js",
|
|
5
|
+
"main": "./trtc-cloud-wx.js",
|
|
7
6
|
"type": "module",
|
|
8
|
-
"scripts": {
|
|
9
|
-
"build": "npm run clear && rollup -c && node ./build/copy_to_roomkit.js",
|
|
10
|
-
"dev": "node ./build/chokidar.js",
|
|
11
|
-
"clear": "node ./build/clear.js",
|
|
12
|
-
"copy": "node ./build/copy.js",
|
|
13
|
-
"doc": "npx typedoc --tsconfig typedoc.json",
|
|
14
|
-
"doc:watch": "typedoc --watch",
|
|
15
|
-
"doc:build": "jsdoc -c jsdoc.json",
|
|
16
|
-
"publish": "bash ./sdk_publish.bash"
|
|
17
|
-
},
|
|
18
7
|
"keywords": [],
|
|
19
8
|
"author": "",
|
|
20
9
|
"license": "ISC",
|
|
21
|
-
"devDependencies": {
|
|
22
|
-
"@babel/core": "^7.21.4",
|
|
23
|
-
"@babel/preset-env": "^7.21.4",
|
|
24
|
-
"@babel/preset-typescript": "^7.21.4",
|
|
25
|
-
"@rollup/plugin-babel": "^6.0.3",
|
|
26
|
-
"@rollup/plugin-json": "^6.0.0",
|
|
27
|
-
"@rollup/plugin-terser": "^0.4.3",
|
|
28
|
-
"@rollup/plugin-typescript": "^11.0.0",
|
|
29
|
-
"@types/node": "^18.15.11",
|
|
30
|
-
"@typescript-eslint/eslint-plugin": "^2.28.0",
|
|
31
|
-
"@typescript-eslint/parser": "^2.28.0",
|
|
32
|
-
"babel-loader": "^9.1.2",
|
|
33
|
-
"better-docs": "^2.7.2",
|
|
34
|
-
"chokidar": "^3.5.3",
|
|
35
|
-
"docdash-blue": "^1.1.9",
|
|
36
|
-
"eslint": "^5.14.1",
|
|
37
|
-
"eslint-config-airbnb-base": "13.1.0",
|
|
38
|
-
"eslint-loader": "^2.1.2",
|
|
39
|
-
"eslint-plugin-import": "^2.27.5",
|
|
40
|
-
"eslint-plugin-node": "^7.0.1",
|
|
41
|
-
"eslint-plugin-promise": "^3.8.0",
|
|
42
|
-
"jsdoc": "^4.0.2",
|
|
43
|
-
"rollup": "^3.27.1",
|
|
44
|
-
"rollup-plugin-uglify": "^6.0.4",
|
|
45
|
-
"taffydb": "^2.7.3",
|
|
46
|
-
"tslib": "^2.5.0",
|
|
47
|
-
"typedoc": "^0.24.4",
|
|
48
|
-
"typedoc-theme-hierarchy": "^3.1.0",
|
|
49
|
-
"typescript": "^5.0.2"
|
|
50
|
-
},
|
|
51
10
|
"dependencies": {
|
|
52
11
|
"aegis-mp-sdk": "^1.37.7",
|
|
53
12
|
"eventemitter3": "^5.0.0",
|
|
54
|
-
"trtc-wx-sdk": "
|
|
13
|
+
"trtc-wx-sdk": "1.1.7"
|
|
55
14
|
}
|
|
56
15
|
}
|
|
@@ -1274,23 +1274,6 @@ var formatTime = function formatTime() {
|
|
|
1274
1274
|
second = second < 10 ? "0".concat(second) : second;
|
|
1275
1275
|
return "".concat(hour, ":").concat(minute, ":").concat(second, ".").concat(millisecond);
|
|
1276
1276
|
};
|
|
1277
|
-
function debounce(func, wait) {
|
|
1278
|
-
var timeout = null;
|
|
1279
|
-
return function () {
|
|
1280
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
1281
|
-
args[_key] = arguments[_key];
|
|
1282
|
-
}
|
|
1283
|
-
// 清除上一次的定时器
|
|
1284
|
-
if (timeout) {
|
|
1285
|
-
clearTimeout(timeout);
|
|
1286
|
-
}
|
|
1287
|
-
// 设置一个新的定时器,在 wait 毫秒后执行原函数
|
|
1288
|
-
timeout = setTimeout(function () {
|
|
1289
|
-
func.apply(void 0, args);
|
|
1290
|
-
timeout = null;
|
|
1291
|
-
}, wait);
|
|
1292
|
-
};
|
|
1293
|
-
}
|
|
1294
1277
|
|
|
1295
1278
|
var aegis = new Aegis({
|
|
1296
1279
|
id: 'iHWefAYqxoRsFYGQvR' // 项目ID,即上报id
|
|
@@ -1413,7 +1396,7 @@ var Logger = /*#__PURE__*/function () {
|
|
|
1413
1396
|
var logger = new Logger();
|
|
1414
1397
|
|
|
1415
1398
|
var name = "@tencentcloud/trtc-cloud-wx";
|
|
1416
|
-
var version = "0.0.
|
|
1399
|
+
var version = "0.0.30";
|
|
1417
1400
|
var description = "";
|
|
1418
1401
|
var main = "dist/trtc-cloud-wx.js";
|
|
1419
1402
|
var module$1 = "dist/trtc-cloud-wx.js";
|
|
@@ -1482,132 +1465,6 @@ var packageJson = {
|
|
|
1482
1465
|
dependencies: dependencies
|
|
1483
1466
|
};
|
|
1484
1467
|
|
|
1485
|
-
var DeviceScope;
|
|
1486
|
-
(function (DeviceScope) {
|
|
1487
|
-
DeviceScope["RECORD"] = "scope.record";
|
|
1488
|
-
DeviceScope["CAMERA"] = "scope.camera";
|
|
1489
|
-
})(DeviceScope || (DeviceScope = {}));
|
|
1490
|
-
var DeviceType;
|
|
1491
|
-
(function (DeviceType) {
|
|
1492
|
-
DeviceType["MIC"] = "mic";
|
|
1493
|
-
DeviceType["CAMERA"] = "camera";
|
|
1494
|
-
})(DeviceType || (DeviceType = {}));
|
|
1495
|
-
/**
|
|
1496
|
-
* 获取设备权限,查看当前是否有麦克风以及摄像头权限
|
|
1497
|
-
* @param {Object} params - 参数对象
|
|
1498
|
-
* @param {Boolean} params.microphone 麦克风权限
|
|
1499
|
-
* @param {Boolean} params.camera 摄像头权限
|
|
1500
|
-
*/
|
|
1501
|
-
function deviceCheck(types) {
|
|
1502
|
-
return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
1503
|
-
var microphone, camera, res, isMicrophone, isCamera;
|
|
1504
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
1505
|
-
while (1) switch (_context.prev = _context.next) {
|
|
1506
|
-
case 0:
|
|
1507
|
-
if (types) {
|
|
1508
|
-
_context.next = 2;
|
|
1509
|
-
break;
|
|
1510
|
-
}
|
|
1511
|
-
return _context.abrupt("return", false);
|
|
1512
|
-
case 2:
|
|
1513
|
-
microphone = types.includes(DeviceType.MIC);
|
|
1514
|
-
camera = types.includes(DeviceType.CAMERA);
|
|
1515
|
-
_context.prev = 4;
|
|
1516
|
-
_context.next = 7;
|
|
1517
|
-
return wx.getSetting();
|
|
1518
|
-
case 7:
|
|
1519
|
-
res = _context.sent;
|
|
1520
|
-
isMicrophone = res.authSetting[DeviceScope.RECORD];
|
|
1521
|
-
isCamera = res.authSetting[DeviceScope.CAMERA]; // 同时检查麦克风和摄像头权限
|
|
1522
|
-
if (!(microphone && camera)) {
|
|
1523
|
-
_context.next = 12;
|
|
1524
|
-
break;
|
|
1525
|
-
}
|
|
1526
|
-
return _context.abrupt("return", isMicrophone && isCamera);
|
|
1527
|
-
case 12:
|
|
1528
|
-
if (!microphone) {
|
|
1529
|
-
_context.next = 14;
|
|
1530
|
-
break;
|
|
1531
|
-
}
|
|
1532
|
-
return _context.abrupt("return", isMicrophone);
|
|
1533
|
-
case 14:
|
|
1534
|
-
if (!camera) {
|
|
1535
|
-
_context.next = 16;
|
|
1536
|
-
break;
|
|
1537
|
-
}
|
|
1538
|
-
return _context.abrupt("return", isCamera);
|
|
1539
|
-
case 16:
|
|
1540
|
-
return _context.abrupt("return", false);
|
|
1541
|
-
case 19:
|
|
1542
|
-
_context.prev = 19;
|
|
1543
|
-
_context.t0 = _context["catch"](4);
|
|
1544
|
-
return _context.abrupt("return", false);
|
|
1545
|
-
case 22:
|
|
1546
|
-
case "end":
|
|
1547
|
-
return _context.stop();
|
|
1548
|
-
}
|
|
1549
|
-
}, _callee, null, [[4, 19]]);
|
|
1550
|
-
}));
|
|
1551
|
-
}
|
|
1552
|
-
function permissionPopup() {
|
|
1553
|
-
wx.showModal({
|
|
1554
|
-
title: '设备授权',
|
|
1555
|
-
content: '使用音视频功能请对相应设备进行授权',
|
|
1556
|
-
confirmText: '去设置',
|
|
1557
|
-
success: function success(res) {
|
|
1558
|
-
if (res.confirm) {
|
|
1559
|
-
wx.openSetting();
|
|
1560
|
-
}
|
|
1561
|
-
}
|
|
1562
|
-
});
|
|
1563
|
-
}
|
|
1564
|
-
var debouncePermissionPopup = debounce(permissionPopup, 300);
|
|
1565
|
-
function deviceAuthorize(deviceType, scope) {
|
|
1566
|
-
return function (target, key, descriptor) {
|
|
1567
|
-
var originalMethod = descriptor.value;
|
|
1568
|
-
descriptor.value = function () {
|
|
1569
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
1570
|
-
args[_key] = arguments[_key];
|
|
1571
|
-
}
|
|
1572
|
-
return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
1573
|
-
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
1574
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
1575
|
-
case 0:
|
|
1576
|
-
_context2.next = 2;
|
|
1577
|
-
return deviceCheck([deviceType]);
|
|
1578
|
-
case 2:
|
|
1579
|
-
if (_context2.sent) {
|
|
1580
|
-
_context2.next = 13;
|
|
1581
|
-
break;
|
|
1582
|
-
}
|
|
1583
|
-
_context2.prev = 3;
|
|
1584
|
-
_context2.next = 6;
|
|
1585
|
-
return wx.authorize({
|
|
1586
|
-
scope: scope
|
|
1587
|
-
});
|
|
1588
|
-
case 6:
|
|
1589
|
-
_context2.next = 12;
|
|
1590
|
-
break;
|
|
1591
|
-
case 8:
|
|
1592
|
-
_context2.prev = 8;
|
|
1593
|
-
_context2.t0 = _context2["catch"](3);
|
|
1594
|
-
debouncePermissionPopup();
|
|
1595
|
-
throw new Error(_context2.t0);
|
|
1596
|
-
case 12:
|
|
1597
|
-
return _context2.abrupt("return");
|
|
1598
|
-
case 13:
|
|
1599
|
-
return _context2.abrupt("return", originalMethod.apply(this, args));
|
|
1600
|
-
case 14:
|
|
1601
|
-
case "end":
|
|
1602
|
-
return _context2.stop();
|
|
1603
|
-
}
|
|
1604
|
-
}, _callee2, this, [[3, 8]]);
|
|
1605
|
-
}));
|
|
1606
|
-
};
|
|
1607
|
-
return descriptor;
|
|
1608
|
-
};
|
|
1609
|
-
}
|
|
1610
|
-
|
|
1611
1468
|
/**
|
|
1612
1469
|
* TRTCCloud
|
|
1613
1470
|
* @interface
|
|
@@ -3101,8 +2958,6 @@ var TRTCCloud = /*#__PURE__*/function () {
|
|
|
3101
2958
|
}]);
|
|
3102
2959
|
return TRTCCloud;
|
|
3103
2960
|
}();
|
|
3104
|
-
__decorate([deviceAuthorize(DeviceType.CAMERA, DeviceScope.CAMERA)], TRTCCloud.prototype, "startLocalPreview", null);
|
|
3105
|
-
__decorate([deviceAuthorize(DeviceType.MIC, DeviceScope.RECORD)], TRTCCloud.prototype, "startLocalAudio", null);
|
|
3106
2961
|
__decorate([setHandle], TRTCCloud.prototype, "setAttributes", null);
|
|
3107
2962
|
|
|
3108
2963
|
exports.TRTCCloud = TRTCCloud;
|
package/.babelrc
DELETED
package/.eslintrc.json
DELETED
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": [
|
|
3
|
-
"airbnb-base",
|
|
4
|
-
"plugin:promise/recommended",
|
|
5
|
-
"plugin:import/typescript",
|
|
6
|
-
"plugin:@typescript-eslint/recommended"
|
|
7
|
-
],
|
|
8
|
-
"parser": "@typescript-eslint/parser",
|
|
9
|
-
"plugins": [
|
|
10
|
-
"@typescript-eslint",
|
|
11
|
-
"import",
|
|
12
|
-
"node",
|
|
13
|
-
"promise"
|
|
14
|
-
],
|
|
15
|
-
"parserOptions": {
|
|
16
|
-
"ecmaVersion": 9,
|
|
17
|
-
"ecmaFeatures": {
|
|
18
|
-
"jsx": false
|
|
19
|
-
},
|
|
20
|
-
"sourceType": "module"
|
|
21
|
-
},
|
|
22
|
-
"env": {
|
|
23
|
-
"es6": true,
|
|
24
|
-
"node": true,
|
|
25
|
-
"jest": true
|
|
26
|
-
},
|
|
27
|
-
"settings": {
|
|
28
|
-
"import/resolver": {
|
|
29
|
-
"node": {
|
|
30
|
-
"extensions": [
|
|
31
|
-
".js",
|
|
32
|
-
".jsx",
|
|
33
|
-
".ts",
|
|
34
|
-
".tsx"
|
|
35
|
-
]
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
|
-
"rules": {
|
|
40
|
-
// "@typescript-eslint/explicit-function-return-type": "off",
|
|
41
|
-
"explicit-module-boundary-types": "off",
|
|
42
|
-
"max-len": ["error", {"code": 120}],
|
|
43
|
-
"import/extensions": 0,
|
|
44
|
-
"no-unused-expressions": [
|
|
45
|
-
"error",
|
|
46
|
-
{
|
|
47
|
-
"allowTernary": true
|
|
48
|
-
}
|
|
49
|
-
],
|
|
50
|
-
"no-empty-function": "off",
|
|
51
|
-
"@typescript-eslint/no-empty-function": "off",
|
|
52
|
-
"class-methods-use-this": "off",
|
|
53
|
-
"arrow-parens": "off",
|
|
54
|
-
"comma-dangle": [
|
|
55
|
-
"error",
|
|
56
|
-
"only-multiline"
|
|
57
|
-
],
|
|
58
|
-
"complexity": [
|
|
59
|
-
"error",
|
|
60
|
-
20
|
|
61
|
-
],
|
|
62
|
-
"func-names": "off",
|
|
63
|
-
"global-require": "off",
|
|
64
|
-
"handle-callback-err": [
|
|
65
|
-
"error",
|
|
66
|
-
"^(err|error)$"
|
|
67
|
-
],
|
|
68
|
-
"import/no-unresolved": [
|
|
69
|
-
"error",
|
|
70
|
-
{
|
|
71
|
-
"caseSensitive": true,
|
|
72
|
-
"commonjs": true,
|
|
73
|
-
"ignore": [
|
|
74
|
-
"^[^.]"
|
|
75
|
-
]
|
|
76
|
-
}
|
|
77
|
-
],
|
|
78
|
-
"import/prefer-default-export": "off",
|
|
79
|
-
"linebreak-style": "off",
|
|
80
|
-
"no-catch-shadow": "error",
|
|
81
|
-
"no-continue": "off",
|
|
82
|
-
"no-div-regex": "warn",
|
|
83
|
-
"no-else-return": "off",
|
|
84
|
-
"no-param-reassign": "off",
|
|
85
|
-
"no-plusplus": "off",
|
|
86
|
-
"no-shadow": "off",
|
|
87
|
-
"no-multi-assign": "off",
|
|
88
|
-
"no-underscore-dangle": "off",
|
|
89
|
-
"node/no-deprecated-api": "error",
|
|
90
|
-
"node/process-exit-as-throw": "error",
|
|
91
|
-
"object-curly-spacing": [
|
|
92
|
-
"error",
|
|
93
|
-
"never"
|
|
94
|
-
],
|
|
95
|
-
"operator-linebreak": [
|
|
96
|
-
"error",
|
|
97
|
-
"after",
|
|
98
|
-
{
|
|
99
|
-
"overrides": {
|
|
100
|
-
":": "before",
|
|
101
|
-
"?": "before"
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
],
|
|
105
|
-
"prefer-arrow-callback": "off",
|
|
106
|
-
"prefer-destructuring": "off",
|
|
107
|
-
"prefer-template": "off",
|
|
108
|
-
"quote-props": [
|
|
109
|
-
1,
|
|
110
|
-
"as-needed",
|
|
111
|
-
{
|
|
112
|
-
"unnecessary": true
|
|
113
|
-
}
|
|
114
|
-
],
|
|
115
|
-
"semi": [
|
|
116
|
-
"error",
|
|
117
|
-
"never"
|
|
118
|
-
],
|
|
119
|
-
"no-await-in-loop": "off",
|
|
120
|
-
"no-restricted-syntax": "off",
|
|
121
|
-
"promise/always-return": "off"
|
|
122
|
-
},
|
|
123
|
-
"globals": {
|
|
124
|
-
"window": true,
|
|
125
|
-
"document": true,
|
|
126
|
-
"App": true,
|
|
127
|
-
"wx": true
|
|
128
|
-
}
|
|
129
|
-
}
|
package/build/chokidar.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import path from 'path'
|
|
2
|
-
import chokidar from 'chokidar'
|
|
3
|
-
import {exec} from 'child_process'
|
|
4
|
-
|
|
5
|
-
const __dirname = new URL('.', import.meta.url).pathname
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const srcDir = path.resolve(__dirname, '../src')
|
|
9
|
-
|
|
10
|
-
chokidar.watch(srcDir).on('all', async (event, filePath) => {
|
|
11
|
-
console.log(`${event}: ${filePath}`)
|
|
12
|
-
if (event === 'change' || event === 'add') {
|
|
13
|
-
exec('npm run build', (err, stdout, stderr) => {
|
|
14
|
-
if (err) console.error(err)
|
|
15
|
-
console.log(stdout)
|
|
16
|
-
console.error(stderr)
|
|
17
|
-
})
|
|
18
|
-
}
|
|
19
|
-
})
|
package/build/clear.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import fs from 'fs'
|
|
2
|
-
import path from 'path'
|
|
3
|
-
|
|
4
|
-
// 获取 dist 目录的绝对路径
|
|
5
|
-
const distPath = path.resolve(new URL('.', import.meta.url).pathname, '../dist')
|
|
6
|
-
// 定义一个函数,用于删除指定目录下的所有文件和文件夹
|
|
7
|
-
function deleteFolderRecursive(folderPath) {
|
|
8
|
-
if (fs.existsSync(folderPath)) {
|
|
9
|
-
fs.readdirSync(folderPath).forEach(file => {
|
|
10
|
-
const curPath = path.join(folderPath, file)
|
|
11
|
-
if (fs.lstatSync(curPath).isDirectory()) {
|
|
12
|
-
deleteFolderRecursive(curPath)
|
|
13
|
-
} else if (!curPath.includes('package.json')) {
|
|
14
|
-
fs.unlinkSync(curPath)
|
|
15
|
-
}
|
|
16
|
-
})
|
|
17
|
-
// fs.rmdirSync(folderPath);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
// 调用函数,删除 dist 目录下的所有文件和文件夹
|
|
22
|
-
deleteFolderRecursive(distPath)
|
|
23
|
-
|
|
24
|
-
console.log('清理完成!')
|
package/build/copy.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import fs from 'fs'
|
|
2
|
-
import path from 'path'
|
|
3
|
-
|
|
4
|
-
const __dirname = new URL('.', import.meta.url).pathname
|
|
5
|
-
|
|
6
|
-
const distPath = path.resolve(__dirname, '../dist')
|
|
7
|
-
const targetPathList = [
|
|
8
|
-
// path.resolve(__dirname, "../trtc-custom-component/src"),
|
|
9
|
-
path.resolve(__dirname, '../../trtc-component-wx/miniprogram_dev/node_modules/@tencentcloud/trtc-cloud-wx'),
|
|
10
|
-
]
|
|
11
|
-
|
|
12
|
-
fs.readdir(distPath, (err, files) => {
|
|
13
|
-
if (err) throw err
|
|
14
|
-
files.forEach((file) => {
|
|
15
|
-
targetPathList.forEach((targetPath) => {
|
|
16
|
-
const srcPath = path.join(distPath, file)
|
|
17
|
-
const destPath = path.join(targetPath, file)
|
|
18
|
-
fs.copyFile(srcPath, destPath, (err) => {
|
|
19
|
-
if (err) throw err
|
|
20
|
-
console.log(`${file} has been copied to ${targetPath}`)
|
|
21
|
-
})
|
|
22
|
-
})
|
|
23
|
-
})
|
|
24
|
-
})
|
package/build/copy_to_roomkit.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import fs from 'fs'
|
|
2
|
-
import path from 'path'
|
|
3
|
-
|
|
4
|
-
const sourceDir = '/Users/connor/Desktop/work/TRTCCloud-wx/trtc-cloud-wx/dist'
|
|
5
|
-
const targetDir = '/Users/connor/Desktop/TUIRoomEngine/samples/tui-room-uniapp/dist/build/mp-weixin/node_modules/@tencentcloud/trtc-cloud-wx'
|
|
6
|
-
|
|
7
|
-
fs.readdir(sourceDir, (err, files) => {
|
|
8
|
-
if (err) throw err
|
|
9
|
-
|
|
10
|
-
files.forEach((file) => {
|
|
11
|
-
const sourceFile = path.join(sourceDir, file)
|
|
12
|
-
const targetFile = path.join(targetDir, file)
|
|
13
|
-
|
|
14
|
-
fs.copyFile(sourceFile, targetFile, (err) => {
|
|
15
|
-
if (err) throw err
|
|
16
|
-
console.log(`${sourceFile} was copied to ${targetFile}`)
|
|
17
|
-
})
|
|
18
|
-
})
|
|
19
|
-
})
|
package/dist/package.json
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@tencentcloud/trtc-cloud-wx",
|
|
3
|
-
"version": "0.0.26",
|
|
4
|
-
"description": "",
|
|
5
|
-
"main": "./trtc-cloud-wx.js",
|
|
6
|
-
"type": "module",
|
|
7
|
-
"keywords": [],
|
|
8
|
-
"author": "",
|
|
9
|
-
"license": "ISC",
|
|
10
|
-
"dependencies": {
|
|
11
|
-
"aegis-mp-sdk": "^1.37.7",
|
|
12
|
-
"eventemitter3": "^5.0.0",
|
|
13
|
-
"trtc-wx-sdk": "1.1.7"
|
|
14
|
-
}
|
|
15
|
-
}
|