win_webview2 1.1.7 → 1.1.8
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.
|
@@ -7,12 +7,17 @@ exports.readConfig = readConfig;
|
|
|
7
7
|
const promises_1 = require("node:fs/promises");
|
|
8
8
|
const dirnameTool_1 = require("./dirnameTool");
|
|
9
9
|
const node_path_1 = __importDefault(require("node:path"));
|
|
10
|
+
const node_fs_1 = require("node:fs");
|
|
10
11
|
const jsonConfigFilePath = "./win_webview2.json";
|
|
11
12
|
async function readConfig() {
|
|
12
|
-
let
|
|
13
|
-
if (
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
let jsonPath = node_path_1.default.join(__dirname, jsonConfigFilePath);
|
|
14
|
+
if (!(0, node_fs_1.existsSync)(jsonPath)) {
|
|
15
|
+
let userDir = (0, dirnameTool_1.findUserProjectRoot)();
|
|
16
|
+
if (userDir == null)
|
|
17
|
+
return null;
|
|
18
|
+
jsonPath = node_path_1.default.join(userDir, jsonConfigFilePath);
|
|
19
|
+
}
|
|
20
|
+
let str = await (0, promises_1.readFile)(jsonPath);
|
|
16
21
|
let jsonObj = JSON.parse(str.toString());
|
|
17
22
|
return jsonObj;
|
|
18
23
|
}
|
package/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { readFile } from "node:fs/promises";
|
|
2
2
|
import { findUserProjectRoot } from "./dirnameTool";
|
|
3
3
|
import path from "node:path";
|
|
4
|
+
import { existsSync } from "node:fs";
|
|
4
5
|
|
|
5
6
|
export type ConfigWW2 = {
|
|
6
|
-
appname: string;
|
|
7
|
+
appname: string;
|
|
7
8
|
entry_point: string;
|
|
8
9
|
outdir: string;
|
|
9
10
|
platform: 'Win32' | 'x64'
|
|
@@ -12,13 +13,15 @@ export type ConfigWW2 = {
|
|
|
12
13
|
|
|
13
14
|
const jsonConfigFilePath = "./win_webview2.json";
|
|
14
15
|
export async function readConfig() {
|
|
15
|
-
let
|
|
16
|
-
if (
|
|
16
|
+
let jsonPath = path.join(__dirname, jsonConfigFilePath);
|
|
17
|
+
if (!existsSync(jsonPath)) {
|
|
18
|
+
let userDir = findUserProjectRoot();
|
|
19
|
+
if (userDir == null) return null;
|
|
20
|
+
jsonPath = path.join(userDir, jsonConfigFilePath);
|
|
21
|
+
}
|
|
17
22
|
|
|
18
23
|
|
|
19
|
-
|
|
20
|
-
let
|
|
21
|
-
let jsonObj = JSON.parse(str.toString());
|
|
22
|
-
|
|
24
|
+
let str = await readFile(jsonPath);
|
|
25
|
+
let jsonObj = JSON.parse(str.toString());
|
|
23
26
|
return jsonObj as ConfigWW2;
|
|
24
27
|
}
|