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.
@@ -45,7 +45,6 @@ async function buildForServer() {
45
45
  await response.menu();
46
46
  }
47
47
  }
48
- console.log("ww2 version : v6 \n\n");
49
48
  const args = process.argv.slice(2);
50
49
  if (args.length > 0) {
51
50
  let argument = args[0];
@@ -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 userDir = (0, dirnameTool_1.findUserProjectRoot)();
13
- if (userDir == null)
14
- return null;
15
- let str = await (0, promises_1.readFile)(node_path_1.default.join(userDir, jsonConfigFilePath));
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,6 +1,6 @@
1
1
  {
2
2
  "name": "win_webview2",
3
- "version": "1.1.7",
3
+ "version": "1.1.8",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/nnttoo/win_webview2"
@@ -62,8 +62,7 @@ export async function buildForServer() {
62
62
 
63
63
  await response.menu();
64
64
  }
65
- }
66
- console.log("ww2 version : v6 \n\n");
65
+ }
67
66
  const args = process.argv.slice(2);
68
67
 
69
68
 
@@ -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 userDir = findUserProjectRoot();
16
- if (userDir == null) return null;
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 str = await readFile(path.join(userDir, jsonConfigFilePath));
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
  }