win_webview2 1.1.5 → 1.1.7
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/buildtools/copyDll.ts
CHANGED
|
@@ -14,8 +14,13 @@ function debugDir(dirPath: string) {
|
|
|
14
14
|
|
|
15
15
|
let rootPath = path.join(__dirname, "../../");
|
|
16
16
|
let copyFromRoot = async (src: string, target: string) => {
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
try {
|
|
18
|
+
|
|
19
|
+
result += "\n" + target;
|
|
20
|
+
await copyFile(path.join(rootPath, src), path.join(rootPath, target));
|
|
21
|
+
} catch (error) {
|
|
22
|
+
|
|
23
|
+
}
|
|
19
24
|
}
|
|
20
25
|
|
|
21
26
|
try {
|
package/buildtools/tsconfig.json
CHANGED
|
@@ -27,7 +27,27 @@ let ww2Choise = {
|
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
};
|
|
30
|
+
async function fetchFromList() {
|
|
31
|
+
try {
|
|
32
|
+
console.log("get list example");
|
|
33
|
+
let url = "https://raw.githubusercontent.com/nnttoo/win_webview2/refs/heads/master/example/listexample.json";
|
|
34
|
+
let txt = await fetch(url);
|
|
35
|
+
let content = await txt.text();
|
|
36
|
+
let obj = JSON.parse(content);
|
|
37
|
+
for (let item of obj) {
|
|
38
|
+
ww2Choise[item.path] = {
|
|
39
|
+
description: item.desctiption,
|
|
40
|
+
fun: () => {
|
|
41
|
+
runCommand(`npx degit nnttoo/win_webview2/example/${item.path}#master ${item.path}`);
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
catch (error) {
|
|
47
|
+
}
|
|
48
|
+
}
|
|
30
49
|
async function ww2Init() {
|
|
50
|
+
await fetchFromList();
|
|
31
51
|
const response = await (0, prompts_1.default)({
|
|
32
52
|
type: 'select',
|
|
33
53
|
name: 'menu',
|
package/package.json
CHANGED
|
@@ -5,21 +5,21 @@ import path from "path";
|
|
|
5
5
|
import { exec, execSync } from "child_process";
|
|
6
6
|
import { ConfigWW2 } from "../tsExport/ww2_config";
|
|
7
7
|
import prompts from "prompts";
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
function runCommand(command
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
function runCommand(command: string) {
|
|
11
|
+
try {
|
|
12
|
+
const currentShell = process.platform === 'win32' ? 'cmd.exe' : '/bin/sh';
|
|
13
|
+
execSync(command, { stdio: 'inherit', shell: currentShell, killSignal: "SIGINT" });
|
|
14
|
+
} catch (error) {
|
|
15
|
+
console.error(`Command Error: ${command}`);
|
|
16
|
+
process.exit();
|
|
17
|
+
}
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
const jsonConfigFilePath = "./win_webview2.json";
|
|
21
21
|
let mdirname = getWw2Dirname();
|
|
22
|
-
|
|
22
|
+
|
|
23
23
|
|
|
24
24
|
interface ChoiseItem {
|
|
25
25
|
fun: () => any;
|
|
@@ -33,9 +33,9 @@ let ww2Choise: WW2Choise = {
|
|
|
33
33
|
"ww2_typescript": {
|
|
34
34
|
description: "init win_webview2",
|
|
35
35
|
fun: async () => {
|
|
36
|
-
|
|
36
|
+
runCommand('npx degit nnttoo/win_webview2/example/ww2_typescript#master ww2_typescript')
|
|
37
37
|
}
|
|
38
|
-
}
|
|
38
|
+
}
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
|
|
@@ -43,36 +43,68 @@ type promChoise = {
|
|
|
43
43
|
title: string,
|
|
44
44
|
value: () => any,
|
|
45
45
|
description: string,
|
|
46
|
-
disable
|
|
46
|
+
disable?: boolean
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
interface ListFromGithub {
|
|
50
|
+
path: string,
|
|
51
|
+
desctiption: string
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
async function fetchFromList() {
|
|
55
|
+
try {
|
|
56
|
+
console.log("get list example")
|
|
57
|
+
let url = "https://raw.githubusercontent.com/nnttoo/win_webview2/refs/heads/master/example/listexample.json";
|
|
58
|
+
let txt = await fetch(url);
|
|
59
|
+
let content = await txt.text();
|
|
60
|
+
let obj = JSON.parse(content) as ListFromGithub[];
|
|
61
|
+
|
|
62
|
+
for (let item of obj) {
|
|
63
|
+
|
|
64
|
+
ww2Choise[item.path] = {
|
|
65
|
+
description: item.desctiption,
|
|
66
|
+
fun: () => {
|
|
67
|
+
runCommand(`npx degit nnttoo/win_webview2/example/${item.path}#master ${item.path}`);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
}
|
|
72
|
+
} catch (error) {
|
|
73
|
+
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
|
|
47
77
|
}
|
|
48
78
|
|
|
49
79
|
export async function ww2Init() {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
80
|
+
await fetchFromList();
|
|
81
|
+
|
|
82
|
+
const response = await prompts({
|
|
83
|
+
type: 'select',
|
|
84
|
+
name: 'menu',
|
|
85
|
+
message: 'Pick one example',
|
|
86
|
+
instructions: '(Use arrow keys to navigate, press enter to select)',
|
|
87
|
+
choices: (() => {
|
|
88
|
+
let result: promChoise[] = [];
|
|
89
|
+
|
|
90
|
+
for (let item in ww2Choise) {
|
|
91
|
+
let val = ww2Choise[item];
|
|
92
|
+
|
|
93
|
+
result.push({
|
|
94
|
+
title: item,
|
|
95
|
+
value: val.fun,
|
|
96
|
+
description: val.description,
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
return result;
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
})(),
|
|
103
|
+
});
|
|
104
|
+
if (response && response.menu) {
|
|
105
|
+
|
|
106
|
+
await response.menu();
|
|
107
|
+
}
|
|
108
|
+
|
|
77
109
|
|
|
78
110
|
}
|
|
Binary file
|
|
Binary file
|