graceful-updater 1.0.9 → 1.1.0

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.
@@ -1,23 +1,17 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.AppUpdator = void 0;
7
4
  const eventemitter3_1 = require("eventemitter3");
8
5
  const nanoid_1 = require("nanoid");
9
- const path_1 = __importDefault(require("path"));
10
6
  const constants_1 = require("./common/constants");
11
7
  const download_file_1 = require("./utils/download-file");
12
8
  const utils_1 = require("./utils");
13
9
  const elelctron_app_adapter_1 = require("./elelctron-app-adapter");
14
- const DEFAULT_EXEFILE_DIR = path_1.default.join(__dirname, '..', 'helper');
15
10
  class AppUpdator extends eventemitter3_1.EventEmitter {
16
11
  constructor(options, app) {
17
12
  super();
18
13
  this.state = constants_1.StateType.Idle;
19
14
  this.options = options;
20
- this._windowHelperExeDir = this.options?.getWindowsHelperExeDir?.() || DEFAULT_EXEFILE_DIR;
21
15
  this.logger = this._wrapLogger(options.logger);
22
16
  this.app = app || new elelctron_app_adapter_1.ElectronAppAdapter();
23
17
  this.startUuid = this._getStartUuid();
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getExecuteFile = exports.requestUpdateInfo = exports.existFile = exports.cleanOldArchive = exports.spawnAsync = exports.waitUntil = exports.sleep = exports.getMacOSAppPath = exports.sudoPrompt = exports.existsSync = exports.createWriteStream = exports.isMac = exports.isWin = exports.execAsync = exports.rimrafAsync = exports.readdirAsync = exports.existsAsync = exports.renameAsync = void 0;
6
+ exports.requestUpdateInfo = exports.existFile = exports.cleanOldArchive = exports.spawnAsync = exports.waitUntil = exports.sleep = exports.getMacOSAppPath = exports.sudoPrompt = exports.existsSync = exports.createWriteStream = exports.isMac = exports.isWin = exports.execAsync = exports.rimrafAsync = exports.readdirAsync = exports.existsAsync = exports.renameAsync = void 0;
7
7
  const path_1 = __importDefault(require("path"));
8
8
  const util_1 = __importDefault(require("util"));
9
9
  const urllib_1 = __importDefault(require("urllib"));
@@ -115,8 +115,4 @@ const requestUpdateInfo = async (options) => {
115
115
  return res.data;
116
116
  };
117
117
  exports.requestUpdateInfo = requestUpdateInfo;
118
- const getExecuteFile = (helperExeFileDir, file) => {
119
- return path_1.default.join(helperExeFileDir, file);
120
- };
121
- exports.getExecuteFile = getExecuteFile;
122
118
  //# sourceMappingURL=index.js.map
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.WindowsUpdator = void 0;
7
7
  const path_1 = __importDefault(require("path"));
8
8
  const electron_1 = require("electron");
9
+ const graceful_updater_windows_helper_1 = require("graceful-updater-windows-helper");
9
10
  const constants_1 = require("./common/constants");
10
11
  const sudo_prompt_exec_1 = require("./utils/sudo-prompt-exec");
11
12
  const app_updator_1 = require("./app-updator");
@@ -35,7 +36,7 @@ class WindowsUpdator extends app_updator_1.AppUpdator {
35
36
  const { downloadTargetDir, resourcePath, latestAsarPath } = this.availableUpdate;
36
37
  this.logger.info('WindowsUpdator#doUnzip:start');
37
38
  try {
38
- const unzipExe = (0, utils_1.getExecuteFile)(this._windowHelperExeDir, 'unzip.exe');
39
+ const unzipExe = graceful_updater_windows_helper_1.unzipExeFilePath;
39
40
  const executeCommand = `"${unzipExe}" -o "${downloadTargetDir}" -d "${resourcePath}"`;
40
41
  await (0, utils_1.execAsync)(executeCommand);
41
42
  if (!await (0, utils_1.existsAsync)(latestAsarPath)) {
@@ -84,7 +85,7 @@ class WindowsUpdator extends app_updator_1.AppUpdator {
84
85
  const productName = this.options?.productName;
85
86
  const { resourcePath } = this.availableUpdate;
86
87
  const exePath = this.app.exePath;
87
- const updateExePath = (0, utils_1.getExecuteFile)(this._windowHelperExeDir, 'installer.exe');
88
+ const updateExePath = graceful_updater_windows_helper_1.installerExeFilePath;
88
89
  const targetPath = path_1.default.resolve(exePath, '..', 'resources');
89
90
  const executeCommand = `"${updateExePath}" "${targetPath}" "${resourcePath}" "${productName}.exe" "${exePath}"`;
90
91
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "graceful-updater",
3
- "version": "1.0.9",
3
+ "version": "1.1.0",
4
4
  "description": "graceful-updater is a software updator management solution for Electron applications, It is convenient to complete full software update and dynamic update.",
5
5
  "scripts": {
6
6
  "build": "sh ./build.sh",
@@ -17,8 +17,7 @@
17
17
  "auto-updator"
18
18
  ],
19
19
  "files": [
20
- "build/**/*.js",
21
- "build/**/*.exe"
20
+ "build/**/*.js"
22
21
  ],
23
22
  "repository": {
24
23
  "type": "git",
@@ -26,6 +25,7 @@
26
25
  },
27
26
  "dependencies": {
28
27
  "eventemitter3": "^4.0.0",
28
+ "graceful-updater-windows-helper": "1",
29
29
  "lodash": "4",
30
30
  "moment": "2",
31
31
  "nanoid": "^3.3.4",
Binary file
Binary file