electron-incremental-update 0.8.8 → 0.8.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/README.md CHANGED
@@ -81,7 +81,6 @@ make sure the plugin is set in the **last** build task
81
81
  ```ts
82
82
  // vite.config.ts
83
83
  export default defineConfig(({ command }) => {
84
-
85
84
  const isBuild = command === 'build'
86
85
  // ...
87
86
 
@@ -13,15 +13,13 @@ var appInfo = {
13
13
  win: process.platform === "win32",
14
14
  mac: process.platform === "darwin",
15
15
  linux: process.platform === "linux",
16
- electronVersion: getElectronVersion(),
17
- appVersion: getAppVersion,
18
16
  systemVersion: release()
19
17
  };
20
18
  function getLocale() {
21
19
  return app.isReady() ? app.getLocale() : void 0;
22
20
  }
23
21
  function getProductAsarPath(name = DEFAULT_APP_NAME) {
24
- return !app.isPackaged ? "DEV.asar" : join(dirname(app.getAppPath()), `${name}.asar`);
22
+ return !app.isPackaged ? join(dirname(app.getAppPath()), `${name}.asar`) : "DEV.asar";
25
23
  }
26
24
  function getElectronVersion() {
27
25
  return app.getVersion();
@@ -63,16 +61,13 @@ function restartApp() {
63
61
  app2.relaunch();
64
62
  app2.quit();
65
63
  }
66
- function waitAppReady(duration = 1e3) {
67
- if (app2.isReady()) {
68
- return Promise.resolve();
69
- }
70
- return new Promise((resolve, reject) => {
71
- const timeout = setTimeout(() => {
64
+ function waitAppReady(timeout = 1e3) {
65
+ return app2.isReady() ? Promise.resolve() : new Promise((resolve, reject) => {
66
+ const _ = setTimeout(() => {
72
67
  reject(new Error("app is not ready"));
73
- }, duration);
68
+ }, timeout);
74
69
  app2.whenReady().then(() => {
75
- clearTimeout(timeout);
70
+ clearTimeout(_);
76
71
  resolve();
77
72
  });
78
73
  });
package/dist/index.js CHANGED
@@ -44,12 +44,10 @@ var appInfo = {
44
44
  win: process.platform === "win32",
45
45
  mac: process.platform === "darwin",
46
46
  linux: process.platform === "linux",
47
- electronVersion: getElectronVersion(),
48
- appVersion: getAppVersion,
49
47
  systemVersion: (0, import_node_os.release)()
50
48
  };
51
49
  function getProductAsarPath(name = DEFAULT_APP_NAME) {
52
- return !import_electron.app.isPackaged ? "DEV.asar" : (0, import_node_path.join)((0, import_node_path.dirname)(import_electron.app.getAppPath()), `${name}.asar`);
50
+ return !import_electron.app.isPackaged ? (0, import_node_path.join)((0, import_node_path.dirname)(import_electron.app.getAppPath()), `${name}.asar`) : "DEV.asar";
53
51
  }
54
52
  function getElectronVersion() {
55
53
  return import_electron.app.getVersion();
@@ -106,16 +104,13 @@ async function unzipFile(gzipPath, targetFilePath = gzipPath.slice(0, -3)) {
106
104
 
107
105
  // src/utils/utils.ts
108
106
  var import_electron2 = require("electron");
109
- function waitAppReady(duration = 1e3) {
110
- if (import_electron2.app.isReady()) {
111
- return Promise.resolve();
112
- }
113
- return new Promise((resolve2, reject) => {
114
- const timeout = setTimeout(() => {
107
+ function waitAppReady(timeout = 1e3) {
108
+ return import_electron2.app.isReady() ? Promise.resolve() : new Promise((resolve2, reject) => {
109
+ const _ = setTimeout(() => {
115
110
  reject(new Error("app is not ready"));
116
- }, duration);
111
+ }, timeout);
117
112
  import_electron2.app.whenReady().then(() => {
118
- clearTimeout(timeout);
113
+ clearTimeout(_);
119
114
  resolve2();
120
115
  });
121
116
  });
package/dist/index.mjs CHANGED
@@ -8,7 +8,7 @@ import {
8
8
  getElectronVersion,
9
9
  getProductAsarPath,
10
10
  waitAppReady
11
- } from "./chunk-OGAOUYV3.mjs";
11
+ } from "./chunk-6V5SXFGA.mjs";
12
12
  import {
13
13
  __require,
14
14
  parseVersion,
package/dist/utils.d.mts CHANGED
@@ -4,8 +4,6 @@ type Info = {
4
4
  win: boolean;
5
5
  mac: boolean;
6
6
  linux: boolean;
7
- electronVersion: string;
8
- appVersion: (name?: string) => string;
9
7
  /**
10
8
  * `os.release()`
11
9
  */
@@ -68,8 +66,13 @@ declare function parseGithubCdnURL(originRepoURL: string, cdnPrefix: string, rel
68
66
  declare function restartApp(): void;
69
67
  /**
70
68
  * ensure app is ready.
69
+ * @param timeout wait timeout, @default 1000
70
+ */
71
+ declare function waitAppReady(timeout?: number): Promise<void>;
72
+ /**
73
+ * handle all unhandled error
74
+ * @param callback callback function
71
75
  */
72
- declare function waitAppReady(duration?: number): Promise<void>;
73
76
  declare function handleUnexpectedErrors(callback: (err: unknown) => void): void;
74
77
 
75
78
  export { DEFAULT_APP_NAME, NoSuchNativeModuleError, Version, appInfo, getAppVersion, getElectronVersion, getLocale, getProductAsarPath, handleUnexpectedErrors, isNoSuchNativeModuleError, parseGithubCdnURL, parseVersion, requireNative, restartApp, unzipFile, waitAppReady, zipFile };
package/dist/utils.d.ts CHANGED
@@ -4,8 +4,6 @@ type Info = {
4
4
  win: boolean;
5
5
  mac: boolean;
6
6
  linux: boolean;
7
- electronVersion: string;
8
- appVersion: (name?: string) => string;
9
7
  /**
10
8
  * `os.release()`
11
9
  */
@@ -68,8 +66,13 @@ declare function parseGithubCdnURL(originRepoURL: string, cdnPrefix: string, rel
68
66
  declare function restartApp(): void;
69
67
  /**
70
68
  * ensure app is ready.
69
+ * @param timeout wait timeout, @default 1000
70
+ */
71
+ declare function waitAppReady(timeout?: number): Promise<void>;
72
+ /**
73
+ * handle all unhandled error
74
+ * @param callback callback function
71
75
  */
72
- declare function waitAppReady(duration?: number): Promise<void>;
73
76
  declare function handleUnexpectedErrors(callback: (err: unknown) => void): void;
74
77
 
75
78
  export { DEFAULT_APP_NAME, NoSuchNativeModuleError, Version, appInfo, getAppVersion, getElectronVersion, getLocale, getProductAsarPath, handleUnexpectedErrors, isNoSuchNativeModuleError, parseGithubCdnURL, parseVersion, requireNative, restartApp, unzipFile, waitAppReady, zipFile };
package/dist/utils.js CHANGED
@@ -50,15 +50,13 @@ var appInfo = {
50
50
  win: process.platform === "win32",
51
51
  mac: process.platform === "darwin",
52
52
  linux: process.platform === "linux",
53
- electronVersion: getElectronVersion(),
54
- appVersion: getAppVersion,
55
53
  systemVersion: (0, import_node_os.release)()
56
54
  };
57
55
  function getLocale() {
58
56
  return import_electron.app.isReady() ? import_electron.app.getLocale() : void 0;
59
57
  }
60
58
  function getProductAsarPath(name = DEFAULT_APP_NAME) {
61
- return !import_electron.app.isPackaged ? "DEV.asar" : (0, import_node_path.join)((0, import_node_path.dirname)(import_electron.app.getAppPath()), `${name}.asar`);
59
+ return !import_electron.app.isPackaged ? (0, import_node_path.join)((0, import_node_path.dirname)(import_electron.app.getAppPath()), `${name}.asar`) : "DEV.asar";
62
60
  }
63
61
  function getElectronVersion() {
64
62
  return import_electron.app.getVersion();
@@ -161,16 +159,13 @@ function restartApp() {
161
159
  import_electron2.app.relaunch();
162
160
  import_electron2.app.quit();
163
161
  }
164
- function waitAppReady(duration = 1e3) {
165
- if (import_electron2.app.isReady()) {
166
- return Promise.resolve();
167
- }
168
- return new Promise((resolve, reject) => {
169
- const timeout = setTimeout(() => {
162
+ function waitAppReady(timeout = 1e3) {
163
+ return import_electron2.app.isReady() ? Promise.resolve() : new Promise((resolve, reject) => {
164
+ const _ = setTimeout(() => {
170
165
  reject(new Error("app is not ready"));
171
- }, duration);
166
+ }, timeout);
172
167
  import_electron2.app.whenReady().then(() => {
173
- clearTimeout(timeout);
168
+ clearTimeout(_);
174
169
  resolve();
175
170
  });
176
171
  });
package/dist/utils.mjs CHANGED
@@ -12,7 +12,7 @@ import {
12
12
  requireNative,
13
13
  restartApp,
14
14
  waitAppReady
15
- } from "./chunk-OGAOUYV3.mjs";
15
+ } from "./chunk-6V5SXFGA.mjs";
16
16
  import {
17
17
  parseVersion,
18
18
  unzipFile,
package/dist/vite.d.mts CHANGED
@@ -43,7 +43,7 @@ type Options = {
43
43
  * the name of you application
44
44
  *
45
45
  * you can set as 'name' in `package.json`
46
- */
46
+ */
47
47
  productName: string;
48
48
  /**
49
49
  * the version of you application
package/dist/vite.d.ts CHANGED
@@ -43,7 +43,7 @@ type Options = {
43
43
  * the name of you application
44
44
  *
45
45
  * you can set as 'name' in `package.json`
46
- */
46
+ */
47
47
  productName: string;
48
48
  /**
49
49
  * the version of you application
package/package.json CHANGED
@@ -1,29 +1,15 @@
1
1
  {
2
2
  "name": "electron-incremental-update",
3
- "author": "subframe7536",
4
- "version": "0.8.8",
3
+ "version": "0.8.9",
5
4
  "description": "electron incremental update tools, powered by vite",
6
- "scripts": {
7
- "build": "tsup && node fix-module.js",
8
- "release": "pnpm test && pnpm run build && bumpp --all && npm publish",
9
- "test": "vitest --run",
10
- "lint": "eslint . --fix"
11
- },
12
- "publishConfig": {
13
- "access": "public",
14
- "registry": "https://registry.npmjs.org/"
15
- },
16
- "repository": "https://github.com/subframe7536/electron-incremental-update",
5
+ "author": "subframe7536",
17
6
  "license": "MIT",
18
- "files": [
19
- "dist",
20
- "vite.js",
21
- "vite.d.ts",
22
- "utils.js",
23
- "utils.d.ts"
7
+ "repository": "https://github.com/subframe7536/electron-incremental-update",
8
+ "keywords": [
9
+ "electron",
10
+ "incremental update",
11
+ "updater"
24
12
  ],
25
- "main": "dist/index.js",
26
- "module": "dist/index.mjs",
27
13
  "exports": {
28
14
  ".": {
29
15
  "import": "./dist/index.mjs",
@@ -38,25 +24,39 @@
38
24
  "require": "./dist/utils.js"
39
25
  }
40
26
  },
41
- "keywords": [
42
- "electron",
43
- "incremental update",
44
- "updater"
27
+ "main": "dist/index.js",
28
+ "module": "dist/index.mjs",
29
+ "files": [
30
+ "dist",
31
+ "utils.d.ts",
32
+ "utils.js",
33
+ "vite.d.ts",
34
+ "vite.js"
45
35
  ],
36
+ "scripts": {
37
+ "build": "tsup && node fix-module.js",
38
+ "release": "pnpm test && pnpm run build && bumpp --all && npm publish",
39
+ "test": "vitest --run",
40
+ "lint": "eslint . --fix"
41
+ },
42
+ "publishConfig": {
43
+ "access": "public",
44
+ "registry": "https://registry.npmjs.org/"
45
+ },
46
+ "dependencies": {
47
+ "@electron/asar": "^3.2.8",
48
+ "ci-info": "^4.0.0",
49
+ "selfsigned": "^2.4.1",
50
+ "vite": "^4.5.0"
51
+ },
46
52
  "devDependencies": {
47
- "@subframe7536/eslint-config": "^0.2.9",
48
- "@types/node": "^20.6.0",
53
+ "@subframe7536/eslint-config": "^0.4.1",
54
+ "@types/node": "^20.9.0",
49
55
  "bumpp": "^9.2.0",
50
- "electron": "^26.2.0",
51
- "eslint": "^8.49.0",
56
+ "electron": "^27.0.4",
57
+ "eslint": "^8.53.0",
52
58
  "tsup": "^7.2.0",
53
59
  "typescript": "^5.2.2",
54
- "vitest": "^0.34.4"
55
- },
56
- "dependencies": {
57
- "@electron/asar": "^3.2.4",
58
- "ci-info": "^3.8.0",
59
- "selfsigned": "^2.1.1",
60
- "vite": "^4.4.9"
60
+ "vitest": "^0.34.6"
61
61
  }
62
62
  }