@talex-touch/utils 1.0.6 → 1.0.9
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/channel/index.ts +1 -1
- package/package.json +4 -3
- package/plugin/channel.ts +5 -4
- package/help/tree-generator.ts +0 -38
package/channel/index.ts
CHANGED
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"module": "./index.ts",
|
|
6
6
|
"license": "MPL-2.0",
|
|
7
7
|
"private": false,
|
|
8
|
-
"version": "1.0.
|
|
8
|
+
"version": "1.0.9",
|
|
9
9
|
"scripts": {
|
|
10
10
|
"publish": "npm publish --access public"
|
|
11
11
|
},
|
|
@@ -20,10 +20,11 @@
|
|
|
20
20
|
},
|
|
21
21
|
"description": "TalexTouch series utils",
|
|
22
22
|
"dependencies": {
|
|
23
|
+
"path-browserify": "^1.0.1",
|
|
23
24
|
"vue": "^3.3.4"
|
|
24
25
|
},
|
|
25
26
|
"peerDependencies": {
|
|
26
|
-
"
|
|
27
|
-
"
|
|
27
|
+
"electron": "^24.4.0",
|
|
28
|
+
"vue": "^3.2.47"
|
|
28
29
|
}
|
|
29
30
|
}
|
package/plugin/channel.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
const { ipcRenderer, IpcMainEvent } = require("electron");
|
|
1
|
+
// const { ipcRenderer, IpcMainEvent } = require("electron");
|
|
2
|
+
import { ipcRenderer, IpcRendererEvent } from "electron";
|
|
2
3
|
import {
|
|
3
4
|
ChannelType,
|
|
4
5
|
DataCode,
|
|
@@ -6,7 +7,7 @@ import {
|
|
|
6
7
|
RawChannelSyncData,
|
|
7
8
|
RawStandardChannelData,
|
|
8
9
|
StandardChannelData,
|
|
9
|
-
} from "
|
|
10
|
+
} from "../channel";
|
|
10
11
|
|
|
11
12
|
class TouchChannel implements ITouchClientChannel {
|
|
12
13
|
channelMap: Map<string, Function[]> = new Map();
|
|
@@ -21,7 +22,7 @@ class TouchChannel implements ITouchClientChannel {
|
|
|
21
22
|
ipcRenderer.on("@plugin-process-message", this.__handle_main.bind(this));
|
|
22
23
|
}
|
|
23
24
|
|
|
24
|
-
__parse_raw_data(e: typeof
|
|
25
|
+
__parse_raw_data(e: typeof IpcRendererEvent, arg: any): RawStandardChannelData | null {
|
|
25
26
|
console.log("Raw data: ", arg, e);
|
|
26
27
|
if (arg) {
|
|
27
28
|
const { name, header, code, data, sync } = arg;
|
|
@@ -46,7 +47,7 @@ class TouchChannel implements ITouchClientChannel {
|
|
|
46
47
|
// throw new Error("Invalid message!");
|
|
47
48
|
}
|
|
48
49
|
|
|
49
|
-
__handle_main(e: typeof
|
|
50
|
+
__handle_main(e: typeof IpcRendererEvent, _arg: any): any {
|
|
50
51
|
const arg = JSON.parse(_arg)
|
|
51
52
|
const rawData = this.__parse_raw_data(e, arg);
|
|
52
53
|
if ( !rawData ) return
|
package/help/tree-generator.ts
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import fse from "fs-extra";
|
|
2
|
-
import path from "path";
|
|
3
|
-
import fs from "fs";
|
|
4
|
-
|
|
5
|
-
export function genFileTree(basePath: string, depth: number = 0, options = {
|
|
6
|
-
maxDepth: 1,
|
|
7
|
-
ignores: [
|
|
8
|
-
"node_modules",
|
|
9
|
-
".git",
|
|
10
|
-
".vscode",
|
|
11
|
-
".idea",
|
|
12
|
-
".github",
|
|
13
|
-
".gitignore"
|
|
14
|
-
]
|
|
15
|
-
}) {
|
|
16
|
-
if (depth > options.maxDepth) return;
|
|
17
|
-
const name = path.basename(basePath);
|
|
18
|
-
|
|
19
|
-
if (options.ignores.includes(name)) return;
|
|
20
|
-
|
|
21
|
-
if (depth === 0) {
|
|
22
|
-
console.log("Touch tree helper: ");
|
|
23
|
-
console.log(` > ${name}:`);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
fse.readdirSync(basePath).forEach((file) => {
|
|
28
|
-
const fullPath = path.join(basePath, file);
|
|
29
|
-
const stat = fs.statSync(fullPath);
|
|
30
|
-
|
|
31
|
-
if (stat.isDirectory()) {
|
|
32
|
-
console.log(` ├${"─".repeat(depth + 2)} ${file}:`);
|
|
33
|
-
genFileTree(fullPath, depth + 1);
|
|
34
|
-
} else {
|
|
35
|
-
console.log(` ├${"─".repeat(depth * 2 )} ${file}`);
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
}
|